Repository navigation
[DSA] Fix decode context parallelism for RoPE sparse attention on Blackwell - #42536
Closed
vincentzed wants to merge 17 commits into
Closed
vincentzed wants to merge 17 commits into
vincentzed wants to merge 17 commits into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Decode layers that share the previous layer's top-k consume the same global slots, so the owner-filtered table and counts are identical. Keep one entry on the forward metadata, valid only for the next shared layer; producers always remap. GLM-5.3 runs 21 remaps per decode step instead of 78. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Default --dcp-replicate-q-proj on with the a2a/fi_a2a backends so decode skips the per-layer Q all-gather, and reserve the gathered q_b_proj/w_kc copies in KV sizing. Rejected together with LoRA; quantized Q projections keep the gather. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vincentzed
requested review from
BBuf,
DarkSharpness,
Edwardf0t1,
Fridge003,
HaiShaw,
Qiaolin-Yu,
Ying1123,
alphabetc1,
celve,
ch-wan,
fzyzcjy,
hanming-lu,
hebiao064,
hnyls2002,
huangtingwei9988,
hzh0425,
ispobock,
merrymercy,
xiezhq-hermann and
yizhang2077
as code owners
October 4, 2026 23:04
19 of 39 tasks
- Move DCP sizing helpers to layers/attention/dsa/dsa_dcp.py - Reuse the rank-local page table through one helper - Rename the remap kernel to transform_index_page_table_dcp - Shorten launch validation; restore layers/dcp/layout.py - Trim tests; use the DSA MTP fixture for the registered test - Rewrite the dcp.mdx section; drop the GLM-5.3 cookbook note Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vincentzed
requested review from
1am9trash,
YAMY1234,
hubertlu-tw,
kkHuang-amd and
rainj-me
as code owners
October 5, 2026 00:47
|
Many thanks for this PR! I just deployed it on B300s (TP=8, DCP=2) and it seems to work really well within its scopes! |
# Conflicts: # python/sglang/srt/mem_cache/memory_pool.py
Contributor
Author
Collaborator
|
@vincentzed I can review this PR this week |
Contributor
Author
|
I merged main into this branch again. #42671 was merged and it conflicted with this PR. Two small changes came out of the merge:
I ran the tests again on 4x B300 after the merge:
|
4 tasks done
main passes the DSA pool class into _build_dsa_kv_pool (sgl-project#35594). The DCP pool sizing keeps its branch and uses that class, and the DCP pool test passes its CPU pool through the new argument.
Contributor
Author
|
I merged main into this branch again because
|
4 tasks done
Contributor
Author
|
I merged main into this branch again because
@kpham-sgl I saw #43735, thank you for carrying this forward. |
Contributor
Author
|
Done in #43735 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
--dcp-size > 1, GLM-5.3, GLM-5.2 and DeepSeek-V3.2 crash. These models use RoPE sparse attention (DSA) with thetrtllmbackend. There are three causes:forward_mla.pyexpects the attention backend to return(attn_output, lse), but the DSA backend only returns the output.multi_ctas_kv_counter_bufferis sized for the heads of one rank, but with DCP each rank runs the heads of the whole DCP group.page_size == 64, and DCP uses a larger page size.Modifications
return_lse=True. Rows that have no local KV are fixed up, and the partial results are merged with the existingag_rs/a2a/fi_a2acode. The fused top-k path stays on.a2a/fi_a2a, every rank keeps the full Q projection weights by default, so there is no Q all-gather per layer.--no-dcp-replicate-q-projturns this off.return_lsereturns wrong values for short-KV FP8 rows when there are more than 32 heads. To stay within 32, the heads are split into groups and each group runs as extra batch rows. I have a reproducer and will file the upstream issue.Not in this PR
Both raise an error at launch.
Follow-ups, most important first
--no-dcp-replicate-q-proj.flashmla_kv).These also raise an error at launch: sparse backends other than
trtllm, KV dtypes other than FP8 E4M3 or BF16, and DCP groups that span more than one attention-TP group. EAGLE needs the checkpoint's own draft, top-k 1, and draft tokens = steps + 1.Related work
Accuracy Tests
0f5bc4af4b: the same test suites give 146 passed. TP4 + DCP2 scores 198 of 200 on GSM8K, and TPOT at C1 with 32K input is 7.67 ms.e6072935bf: the same test suites give 148 passed. TP4 + DCP2 scores 198 of 200 on GSM8K, and TPOT at C1 with 32K input is 7.66 ms.nvidia/GLM-5.3-NVFP4, FP8 KV, temperature 0.ag_rs/ag_rs+ symm-mem /a2aag_rs/ag_rs+ symm-mem /a2azai-org/GLM-5.3(FP8 weights)Speed Tests and Profiling
·means the cell was not rerun. The number in parentheses is the earlier measurement.–means the load does not fit in the KV cache.Effect of the two decode-latency changes (32K, C1, 512 output tokens):
--no-dcp-replicate-q-projag_rsTime per DCP2 decode step, by component:
fi_a2a8.39 ms,ag_rs+ symm-mem 8.65 ms,ag_rs8.87 ms,a2a9.58 ms.Checklist
docs/docs/advanced_features/dcp.mdx.CI States
Latest PR Test (Base): ❌ Run #38232310139
Latest PR Test (Extra): ❌ Run #38232309598
Latest PR Test (AMD ROCm 10): ❌ Run #38232310077