[Guards] Executable graph-profile and breakable-cudagraph guards

New vllm/v1/e2_guards.py, called from the target and MTP constructors on every
rank before profiling or capture: the breakable-cudagraph pin is asserted
(three readings of the switch), a graph profile that cannot execute on v0.30.0
is refused, and VLLM_E2_EXPECTED_CUDAGRAPH_MODE is checked by name. Tests
cover the drafter. An inert knob is no longer hashed into the cache key.

Co-Authored-By: Hinata <hinata@idihore.id>
Signed-off-by: MOVZX <movzx@yahoo.com>
This commit is contained in:
2026-10-09 19:48:07 +07:00
co-authored by Hinata
parent 7351759ecf
commit bc0a1cee82
6 changed files with 288 additions and 131 deletions
+8
View File
@@ -78,6 +78,7 @@ from vllm.multimodal.inputs import MultiModalFeatureSpec
from vllm.sequence import IntermediateTensors
from vllm.tokenizers.registry import cached_tokenizer_from_config
from vllm.v1.attention.backends.registry import MambaAttentionBackendEnum
from vllm.v1.e2_guards import assert_graph_profile_is_executable
from vllm.v1.kv_cache_interface import MambaSpec
from ..common.mtp import make_mtp_hidden_buffer
@@ -759,6 +760,13 @@ class Qwen4ExpForCausalLM(
def __init__(self, *, vllm_config: VllmConfig, prefix: str = "") -> None:
super().__init__()
# V0.30.0 auto-enables breakable cudagraphs
# for this architecture when VLLM_USE_BREAKABLE_CUDAGRAPH is unset, and
# VLLM_COMPILE + a PIECEWISE mode dies at capture because #55272 left no
# compiled submodule. Fail here rather than let a reference-host run qualify an
# identity nobody chose. Qwen4ExpForConditionalGeneration constructs
# this class; Qwen4ExpMTP does not, and guards itself.
assert_graph_profile_is_executable(vllm_config, role="target")
config: Qwen4ExpTextConfig = vllm_config.model_config.hf_text_config
if vllm_config.lora_config is not None:
# LoRA does not support the merged QKV/indexer projection, so its
+5
View File
@@ -51,6 +51,7 @@ from vllm.model_executor.models.utils import (
maybe_prefix,
)
from vllm.sequence import IntermediateTensors
from vllm.v1.e2_guards import assert_graph_profile_is_executable
from .hyperconnection import GatedResidual, HyperConnectionConfig
from .low_latency_gemm import enable_qwen4_exp_low_latency_gemm
@@ -395,6 +396,10 @@ class Qwen4ExpMTP(
}
def __init__(self, *, vllm_config: VllmConfig, prefix: str = "") -> None:
# The drafter is NOT reached through Qwen4ExpForCausalLM --
# this class builds Qwen4ExpMultiTokenPredictor directly, from a config
# rebuilt at mtp.py:159 -- so its graph profile is checked here.
assert_graph_profile_is_executable(vllm_config, role="draft")
config: Qwen4ExpTextConfig = vllm_config.model_config.hf_text_config
self.vllm_config = vllm_config
self.quant_config = vllm_config.quant_config