From 5e6c37f2b4c68d3d86024252d3849a119165c5d1 Mon Sep 17 00:00:00 2001 From: Xingyu Liu <38244988+charlotte12l@users.noreply.github.com> Date: Tue, 4 Aug 2026 02:23:34 -0700 Subject: [PATCH] [cuda_graph] Gate breakable-CG capture_inputs retention to DP-gather paths (#32678) Signed-off-by: xingyuliu --- .../srt/model_executor/runner/prefill_cuda_graph_runner.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 63f477fc3..aa50b7255 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 @@ -1392,7 +1392,11 @@ class PrefillCudaGraphRunner(BaseCudaGraphRunner): run_once, # DP padding can install capture-only tensors on this dummy batch; # BCG retains it so their recorded addresses remain valid. - capture_inputs=forward_batch, + capture_inputs=( + forward_batch + if forward_batch.global_num_tokens_gpu is not None + else None + ), post_warmup_hook=post_warmup_hook, )