diff --git a/python/sglang/srt/model_executor/runner/prefill_cuda_graph_runner.py b/python/sglang/srt/model_executor/runner/prefill_cuda_graph_runner.py index e55ec24227..f169bf5bb7 100644 --- a/python/sglang/srt/model_executor/runner/prefill_cuda_graph_runner.py +++ b/python/sglang/srt/model_executor/runner/prefill_cuda_graph_runner.py @@ -305,9 +305,9 @@ class PrefillCudaGraphRunner(BaseCudaGraphRunner): def __init__(self, model_runner: ModelRunner): if get_schedule().enable_mixed_chunk: backend = get_exec().graph.cuda_graph_config.prefill.backend - assert backend == Backend.BREAKABLE, ( - "Mixed chunk prefill requires the breakable prefill CUDA " - f"graph backend; got '{backend}'." + assert backend in (Backend.BREAKABLE, Backend.FULL), ( + "Mixed chunk prefill requires a padded prefill CUDA graph " + f"backend; got '{backend}'." ) super().__init__(model_runner) self.dllm_attention = model_runner.attn_backend.dllm_attention diff --git a/test/registered/unit/model_executor/test_prefill_cuda_graph_runner.py b/test/registered/unit/model_executor/test_prefill_cuda_graph_runner.py index c655e375d0..6190a97180 100644 --- a/test/registered/unit/model_executor/test_prefill_cuda_graph_runner.py +++ b/test/registered/unit/model_executor/test_prefill_cuda_graph_runner.py @@ -107,6 +107,26 @@ class _FakeBatchRegistry: class TestPrefillCudaGraphRunnerChunkedPrefix(CustomTestCase): + def test_full_backend_accepts_mixed_chunks(self): + """Full pads the token and request axes and refreshes attention + metadata on every replay, so the mixed-chunk startup guard must not + reject it; it used to accept Breakable only.""" + with ( + get_context().override_server_args( + enable_mixed_chunk=True, + cuda_graph_config=SimpleNamespace( + prefill=SimpleNamespace(backend=Backend.FULL) + ), + ), + patch.object( + runner_module.BaseCudaGraphRunner, + "__init__", + side_effect=RuntimeError("reached base initialization"), + ), + self.assertRaisesRegex(RuntimeError, "reached base initialization"), + ): + PrefillCudaGraphRunner(object()) + @patch( "sglang.srt.model_executor.model_runner.require_gathered_buffer", return_value=True,