[Bugfix][DCP] Handle sparse MLA metadata after DCP Manager refactor - #52377
Conversation
|
Also cc @GirasoleY in case this PR may not befit the DCP Manager refactor. |
|
Production validation from the GLM-5.2 / DCP pipeline this PR fixes. ContextWe run GLM-5.2-NVFP4 in production (TP8, DCP4, MTP spec decode x5, Before (with #46514, without this PR)
After (this PR cherry-picked on top of #46514)
Notes
Thanks for the fix — this unblocks GLM-5.2 + DCP + MTP production serving. |
Crash in lse_reduce: "token count exceeds symmetric buffer capacity" under forced-MQA prefillFound this while testing GLM-5.2-NVFP4 in production (TP8, RuntimeError: Worker failed with error 'direct_dcp_a2a_lse_reduce, .../dcp_direct_a2a_lse_reduce.cu:254, token count exceeds symmetric buffer capacity' Root cause
tokens_per_seq = 1 + 2*5 = 11 # MTP-5, parallel drafting However, on the forced-MQA path (the one this PR already fixes on the query-gather side), The q_gather fallback added in this PR covers Suggested fixes
Workaround used in production
Happy to test a patch or provide further details. |
Thank you for pointing it out! I just have added the corresponding fallback to A2A attention combine branch, I had slipped it out when testing the PR as the default dcp comm backend is "ag_rs" which does not hit the direct workspace a2a code branch. I haven't tested the code change yet, will do in this workday but it would be grateful if you can test it as well. I have taken the fallback approach, so the overall latency drop for the problematic queries are the same as |
… refactor (vllm-project#52377) GLM-5.2 + DCP4 + MTP spec decode produced garbled output (repetition, acceptance collapsing to ~100%) after the vllm-project#50484 DCP Manager refactor, which only handled dense MLA. Per vllm-project#46514, per-token seq_lens must be localized AFTER the MTP expansion; the old path under-counted local KV on (W-1)/W ranks, the indexer picked a wrong sparse top-k, and decode degenerated into repetition. Squashed from the production bugfix chain: - 9a63d1e6: restore main MLADCPManager in mla_attention.decode (sparse-MLA DCP startup crash) - d5f5ca13: guard mask_dcp_empty_shards_ against empty local decode shard (num_decodes=0 -> index out of bounds) - 1e008a8a: expose FP8 sparse decode metadata via FlashMLASparseMetadata.decode - 3492ca7a: skip LSE empty-shard mask on sparse DCP decode (superseded by the official vllm-project#52377 fix below) - a05834a6 (vllm-project#52377 upstream): getattr(attn_metadata, "decode", None) guard, _direct_workspace_query_gather fallback for forced-MQA, use_forced_mqa flag (full seq_lens/query_start_loc for sparse) - c912d820: drop VLLM_DEBUG_DCP instrumentation Verified in production: 8+2 -> 10, 3+4 x3 identical, counting 1-174 consecutive, acceptance 0.90/0.78/0.63/0.56/0.47 (healthy reject curve). Co-authored-by: Sisyphus <sisyphus@openci.dev>
|
@cjackal Follow-up on the fallback choice: for the formula side, I've been running the The memory cost is negligible, worth quantifying for the record: with heads_per_rank=8 (64 heads / TP8), head_dim=512 (kv_lora_rank), the symmetric buffer scales linearly with max_num_tokens — going 1408 → 8192 adds ~446 MB/GPU for the A2A lse_reduce workspace (output 2×4×8×512×2B × ΔT), plus ~70-280 MB for q_gather (padded heads), so ~0.5-0.7 GB/GPU total ≈ 0.4% of H200 memory. Not proposing to change your fix (the fallback is correct and strictly better latency-wise for the common case) — just documenting that taking |
|
This pull request has merge conflicts that must be resolved before it can be |
Signed-off-by: cjackal <44624812+cjackal@users.noreply.github.com>
Signed-off-by: cjackal <44624812+cjackal@users.noreply.github.com>
Signed-off-by: cjackal <44624812+cjackal@users.noreply.github.com>
Signed-off-by: cjackal <44624812+cjackal@users.noreply.github.com>
Signed-off-by: cjackal <44624812+cjackal@users.noreply.github.com>
3965d6d to
e2b37d3
Compare
LucasWilkinson
left a comment
There was a problem hiding this comment.
Thanks for the contribution, overall looks good, one nit
Signed-off-by: cjackal <44624812+cjackal@users.noreply.github.com>
|
/ci run |
|
✅ Triggered Buildkite CI #85249 for commit |
|
✅ @cjackal, CI is now available for this PR.
|
|
/ci run |
|
✅ Triggered Buildkite CI #85251 for commit |
Tighten the pure-DCP comments and document the planned switch to the centralized query-gather path after vllm-project#52377 lands. Assisted-by: OpenAI Codex Signed-off-by: 云挚 <ningyunxiao.nyx@antgroup.com>
|
/ci retry |
|
✅ Queued 1 failed job(s) for retry in Buildkite CI #85251. |
Route the NVIDIA GLM sparse-attention query gather through MLADCPManager now that vllm-project#52377 provides a shape-aware fallback for oversized mixed batches. Signed-off-by: 云挚 <ningyunxiao.nyx@antgroup.com>
Purpose
DCP Manager refactoring #50484 is focused on DCP for dense MLA, which does not handle sparse MLA properly.
MLASparseMetadatadoes not inheritMLACommonMetadata, thusattn_metadata.decodeattribute access should be guarded by getattrNote that the two sparse MLA backend (flashinfer_mla_sparse, flashmla_sparse) shares the same codepath and thus this PR covers both.
Test Plan
Cherry-pick #46514 atop of this PR and run GLM-5.2 with DCP.
Test Result
vllm bench serve --dataset-name random --random-input-len 4096 --random-output-len 512 --random-range-ratio 0 --num-prompts 1Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.