Repository navigation
[bug-fix] Stabilize GLM-5.2 MTP IndexShare across PD and CUDA graph replay - #30839
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
/tag-and-rerun-ci |
|
/tag-and-rerun-ci |
kpham-sgl
left a comment
There was a problem hiding this comment.
Thank you for catching these issues! Can we split this PR into multiple parts to speedup review and merging for post1 image? I recommend splitting into the following parts
- PD Transfer and any necessary spec v2, cudagraph, forward batch changes along with it
- MTP with CP enabled changes
- MQA metadata refresh
| if ( | ||
| can_cuda_graph | ||
| and not forward_batch.forward_mode.is_idle() | ||
| and self.index_share_for_mtp_iteration | ||
| and draft_input.dsa_topk_indices is None | ||
| ): | ||
| can_cuda_graph = False |
There was a problem hiding this comment.
Why does draft cudagraph need to be turned off here
There was a problem hiding this comment.
This fallback triggered when the runtime batch lacks the draft-extend DSA seed.
The draft graph is captured assuming a seed exists (dsa_topk_indices is bound to a static buffer). With a None seed, replay zero-fills the buffer — and since 0 is a valid DSA index, the graph silently reuses wrong indices. The eager path correctly recomputes the indexer at step 0, with later MTP steps reusing the result.
Normal PD batches with a seed still use CUDA Graph. Capturing a separate no-seed graph variant per batch size isn't worth it for this rare path, so it falls back to eager.
I have narrowed this PR to Part 1: PD transfer of the The MTP + context-parallel changes and the MQA metadata refresh have been |
kpham-sgl
left a comment
There was a problem hiding this comment.
One concern here is during PD Disagg, some recipes don't turn on speculative decoding for P workers but only D. In this settings, seems like no-one will do draft_extend_for_prefill (important for GLM 5.2 MTP)
Maybe cc @Fridge003 for more context on previous PD Disagg deployments
| if self.output_dsa_topk_indices is not None: | ||
| ptrs.insert(-1, self.output_dsa_topk_indices.data_ptr()) | ||
| data_lens.insert(-1, self.output_dsa_topk_indices.nbytes) | ||
| item_lens.insert(-1, self.output_dsa_topk_indices[0].nbytes) |
There was a problem hiding this comment.
Could this break when speculative decoding is enabled only on the decode node? Prefill would send 10 buffers while decode expects 11, and inserting DSA before bootstrap_room means the two sides interpret the same position differently.
…nput defaults Declare dsa_topk_indices / future_dsa_topk_indices_available / dsa_seed_topk_capture as class-level defaults on SpecInput (same pattern as ragged_verify_layout), so the scheduler, FutureMap relay, PD transfer, and MHA indexer read them uniformly on any SpecInput without hasattr/getattr fallbacks. Req.output_dsa_topk_indices is always initialized in Req.__init__, so those getattrs go too. Co-Authored-By: Claude Fable 5 <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
|
/rerun-test test/registered/models_e2e/test_dsa_glm52_dp_mtp.py test/registered/8-gpu-models/test_deepseek_v32_indexcache.py |
|
Results for 🚀 |
Resolve conflict in disaggregation/utils.py: keep both the PR's output_dsa_topk_indices metadata buffer (inserted before bootstrap_room) and main's sampling-mask buffers in the refactored get_buf_infos. Co-Authored-By: Claude Fable 5 <[email protected]>
Main's sgl-project#27408 added an unconditional req.return_sampling_mask read in MetadataBuffers.set_buf; the SimpleNamespace req stub predates it. Co-Authored-By: Claude Fable 5 <[email protected]>
…eplay Backport of #30839 to release/v0.5.15 (squashed). Co-Authored-By: Claude Fable 5 <[email protected]>
|
Internal nightly run #0e8ae04b has passed GSM8K. Accept length of PD Disagg also looks healthy > 5 |
|
@junliu-mde The padding issue should be fixed in cbc7fd5 |
|
Accept-length A/B ( Ran a same-config A/B to check acceptance length isn't hurt by this PR.
Accept length is flat within run-to-run noise on 4/5 datasets and slightly higher on gsm8k — no degradation from the PR. (mtbench was −0.205 at 3 reps but regresses to −0.049 at 6 reps, i.e. noise.) Notes: single-node (no PD), but the CUDA-graph-replay + overlap-schedule seed paths are exercised. This is not a reproduction of #29787's table (different reasoning effort → different out_len), and |
…oss PD and CUDA graph replay (#30839) (#31083) Co-authored-by: Claude Fable 5 <[email protected]>
Backport the rank-consistency half of sgl-project#32209 (follow-up to sgl-project#30839, issue sgl-project#29144) onto the deployed poc_glm5.2 baseline. Root cause (PD decode + DP attention + GLM-5.2 EAGLE MTP): on a seedless DSA IndexShare round, the DP rank holding the real long request runs the MTP draft eagerly while idle peers replay the draft CUDA graph. The ranks diverge into different collective phases, DeepEP low_latency dispatch/combine waits on a device-side handshake that never arrives, the scheduler loop blocks, the detokenizer heartbeat freezes, and /health_generate 503s -> the node is SIGTERM'd (crash at dp_attn all_gather_into_tensor / gloo "Connection closed by peer"). Fix: fold a rank-consistent draft-graph eligibility vote into the EXISTING MLP-sync all-gather (no new collective). A seedless draft rank sets force_disable_draft_cuda_graph; the all-gather min()-reduces the new can_draft_cuda_graph field so every DP/MoE rank in the cohort takes the same eager-vs-graph path for the draft phase only. Target verify and draft-extend keep replaying their own graphs (narrowed per dee050c). The vote is overlap-aware: when FutureMap will resolve inputs after this scheduler-side vote, it trusts future_dsa_topk_indices_available instead of the possibly stale dsa_topk_indices (per 93cc0fa). Upstream refs (combined form): d619cd9 + 93cc0fa + dee050c. The eager-output unpad / DP-padding halves (5af5267, 8765784) were already present in the baseline as a48549b / db92ab8. Files: - disaggregation/decode.py: set force_disable_draft_cuda_graph before MLP sync - speculative/eagle_worker_v2.py: requires_dp_attention_eager_forward (overlap-aware) - speculative/base_spec_worker.py: default returns False - managers/schedule_batch.py: can_run_dp_draft_cuda_graph + force_disable_draft_cuda_graph - managers/scheduler_components/dp_attn.py: 8th all-gather field can_draft_cuda_graph - model_executor/forward_batch_info.py: propagate can_run_dp_draft_cuda_graph - speculative/eagle_draft_cuda_graph_runner.py: AND draft-graph gate into can_run Co-authored-by: TRAE CLI <[email protected]>
…oss PD and CUDA graph replay (sgl-project#30839) (sgl-project#31083) Co-authored-by: Claude Fable 5 <[email protected]>
…eplay (sgl-project#30839) Co-authored-by: kpham-sgl <[email protected]> Co-authored-by: Claude Fable 5 <[email protected]>
Backport the rank-consistency half of sgl-project#32209 (follow-up to sgl-project#30839, issue sgl-project#29144) onto the deployed poc_glm5.2 baseline. Root cause (PD decode + DP attention + GLM-5.2 EAGLE MTP): on a seedless DSA IndexShare round, the DP rank holding the real long request runs the MTP draft eagerly while idle peers replay the draft CUDA graph. The ranks diverge into different collective phases, DeepEP low_latency dispatch/combine waits on a device-side handshake that never arrives, the scheduler loop blocks, the detokenizer heartbeat freezes, and /health_generate 503s -> the node is SIGTERM'd (crash at dp_attn all_gather_into_tensor / gloo "Connection closed by peer"). Fix: fold a rank-consistent draft-graph eligibility vote into the EXISTING MLP-sync all-gather (no new collective). A seedless draft rank sets force_disable_draft_cuda_graph; the all-gather min()-reduces the new can_draft_cuda_graph field so every DP/MoE rank in the cohort takes the same eager-vs-graph path for the draft phase only. Target verify and draft-extend keep replaying their own graphs (narrowed per dee050c). The vote is overlap-aware: when FutureMap will resolve inputs after this scheduler-side vote, it trusts future_dsa_topk_indices_available instead of the possibly stale dsa_topk_indices (per 93cc0fa). Upstream refs (combined form): d619cd9 + 93cc0fa + dee050c. The eager-output unpad / DP-padding halves (5af5267, 8765784) were already present in the baseline as a48549b / db92ab8. Files: - disaggregation/decode.py: set force_disable_draft_cuda_graph before MLP sync - speculative/eagle_worker_v2.py: requires_dp_attention_eager_forward (overlap-aware) - speculative/base_spec_worker.py: default returns False - managers/schedule_batch.py: can_run_dp_draft_cuda_graph + force_disable_draft_cuda_graph - managers/scheduler_components/dp_attn.py: 8th all-gather field can_draft_cuda_graph - model_executor/forward_batch_info.py: propagate can_run_dp_draft_cuda_graph - speculative/eagle_draft_cuda_graph_runner.py: AND draft-graph gate into can_run Co-authored-by: TRAE CLI <[email protected]>
Backport the rank-consistency half of sgl-project#32209 (follow-up to sgl-project#30839, issue sgl-project#29144) onto the deployed poc_glm5.2 baseline. Root cause (PD decode + DP attention + GLM-5.2 EAGLE MTP): on a seedless DSA IndexShare round, the DP rank holding the real long request runs the MTP draft eagerly while idle peers replay the draft CUDA graph. The ranks diverge into different collective phases, DeepEP low_latency dispatch/combine waits on a device-side handshake that never arrives, the scheduler loop blocks, the detokenizer heartbeat freezes, and /health_generate 503s -> the node is SIGTERM'd (crash at dp_attn all_gather_into_tensor / gloo "Connection closed by peer"). Fix: fold a rank-consistent draft-graph eligibility vote into the EXISTING MLP-sync all-gather (no new collective). A seedless draft rank sets force_disable_draft_cuda_graph; the all-gather min()-reduces the new can_draft_cuda_graph field so every DP/MoE rank in the cohort takes the same eager-vs-graph path for the draft phase only. Target verify and draft-extend keep replaying their own graphs (narrowed per dee050c). The vote is overlap-aware: when FutureMap will resolve inputs after this scheduler-side vote, it trusts future_dsa_topk_indices_available instead of the possibly stale dsa_topk_indices (per 93cc0fa). Upstream refs (combined form): d619cd9 + 93cc0fa + dee050c. The eager-output unpad / DP-padding halves (5af5267, 8765784) were already present in the baseline as a48549b / db92ab8. Files: - disaggregation/decode.py: set force_disable_draft_cuda_graph before MLP sync - speculative/eagle_worker_v2.py: requires_dp_attention_eager_forward (overlap-aware) - speculative/base_spec_worker.py: default returns False - managers/schedule_batch.py: can_run_dp_draft_cuda_graph + force_disable_draft_cuda_graph - managers/scheduler_components/dp_attn.py: 8th all-gather field can_draft_cuda_graph - model_executor/forward_batch_info.py: propagate can_run_dp_draft_cuda_graph - speculative/eagle_draft_cuda_graph_runner.py: AND draft-graph gate into can_run Co-authored-by: TRAE CLI <[email protected]>
…h 下稳定化 来源提交(1 个):1bee78dc11 原标题:[Cherry-pick to release/v0.5.15] Stabilize GLM-5.2 MTP IndexShare across PD and CUDA graph replay (sgl-project#30839) (sgl-project#31083) 作者:Khoa Pham,日期:2026-07-13 luno:- 开关:SGLANG_DSA_FUSE_TOPK 默认:开 改动规模:27 files changed, 638 insertions(+), 60 deletions(-) 主要目录:python/sglang/srt/speculative, python/sglang/srt/disaggregation, python/sglang/srt/managers, python/sglang/srt/layers
Motivation
This PR makes GLM-5.2 MTP IndexShare reliable across PD disaggregation, context parallelism, overlap scheduling, batch splitting, and CUDA graph replay. It preserves the correct draft-extend DSA seed across draft steps, avoiding redundant indexer computation without reusing stale or misaligned indices. This improves proposal consistency, acceptance length stability, and inference performance.
This is a follow-up to #29787. The optimization remains gated to EAGLE with
speculative_eagle_topk == 1,index_share_for_mtp_iteration=true, and a validindex_topk.Modifications
LogitsProcessorOutput, including correct last-token extraction after CP gather/reordering.FutureMapto prevent stale overlap/PD state, and fall back to eager recomputation when no valid seed is available.CI States
Latest PR Test (Base): ❌ Run #29295157846
Latest PR Test (Extra): ⏳ Run #29295157815