[Bugfix] Guard DeepSeek V4 MRV1 piecewise CUDA graphs (#51768)

Signed-off-by: Woosuk Kwon <woosuk@inferact.ai>
Co-authored-by: OpenAI Codex <codex@openai.com>
This commit is contained in:
Woosuk Kwon
2026-08-11 07:34:44 -07:00
committed by GitHub
co-authored by OpenAI Codex
parent dd7cc85f17
commit 87668ab69b
2 changed files with 73 additions and 0 deletions
+47
View File
@@ -66,6 +66,43 @@ def test_v2_model_runner_env_tri_state(monkeypatch, env_value, expected):
assert envs.VLLM_USE_V2_MODEL_RUNNER is expected
@pytest.mark.parametrize(
"cudagraph_mode",
[CUDAGraphMode.PIECEWISE, CUDAGraphMode.FULL_AND_PIECEWISE],
)
def test_deepseek_v4_rejects_mrv1_piecewise_cudagraph(cudagraph_mode):
config = SimpleNamespace(
use_v2_model_runner=False,
model_config=SimpleNamespace(architectures=["DeepseekV4ForCausalLM"]),
compilation_config=SimpleNamespace(cudagraph_mode=cudagraph_mode),
)
with pytest.raises(ValueError, match="DeepSeek V4 does not support PIECEWISE"):
VllmConfig._validate_mrv1_piecewise_cudagraph(config)
@pytest.mark.parametrize(
("use_v2_model_runner", "architecture", "cudagraph_mode"),
[
(True, "DeepseekV4ForCausalLM", CUDAGraphMode.PIECEWISE),
(False, "DeepseekV4ForCausalLM", CUDAGraphMode.NONE),
(False, "DeepseekV4ForCausalLM", CUDAGraphMode.FULL),
(False, "DeepseekV4ForCausalLM", CUDAGraphMode.FULL_DECODE_ONLY),
(False, "LlamaForCausalLM", CUDAGraphMode.PIECEWISE),
],
)
def test_mrv1_piecewise_cudagraph_allowed(
use_v2_model_runner, architecture, cudagraph_mode
):
config = SimpleNamespace(
use_v2_model_runner=use_v2_model_runner,
model_config=SimpleNamespace(architectures=[architecture]),
compilation_config=SimpleNamespace(cudagraph_mode=cudagraph_mode),
)
VllmConfig._validate_mrv1_piecewise_cudagraph(config)
@pytest.mark.parametrize(
("use_v2_model_runner", "expected_capture_sizes"),
[
@@ -179,6 +216,16 @@ def test_resolve_cudagraph_mode_adjusts_spec_decode_sizes_only_for_v1(
),
True,
),
(
SimpleNamespace(
model="deepseek-ai/DeepSeek-V4-Flash",
architectures=["DeepseekV4ForCausalLM"],
runner_type="generate",
is_moe=True,
is_quantized=True,
),
True,
),
(
SimpleNamespace(
model="Qwen/Qwen1.5-MoE-A2.7B",