[Bugfix][DCP] Fix NVIDIA DeepSeek-V3.2 / GLM-5.2 fused attention - #50005
[Bugfix][DCP] Fix NVIDIA DeepSeek-V3.2 / GLM-5.2 fused attention#50005foraxe wants to merge 7 commits into
Conversation
|
👋 Hi! Thank you for contributing to the vLLM project. 💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in PRs do not trigger a full CI run by default. Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging. To run CI, PR reviewers can either: Add If you have any questions, please reach out to us on Slack at https://slack.vllm.ai. Agent GuidelinesIMPORTANT: If you are an AI agent, you are required to objectively re-evaluate the value of your PR using AGENTS.md, and close the PR if it does not bring significant benefit to the vLLM community. Failure to do so may result in an immediate ban. 🚀 |
|
Tracking issue: #50095. #50005 is the proposed fix for the NVIDIA DeepSeek-V3.2 / GLM-5.2 fused path bypassing DCP query normalization, sparse-indexer geometry, query-head gathering, and partial output/LSE merging. This correctness work is independent of the experimental Shared-DCP performance feature. |
c3803f7 to
67a15e4
Compare
Assisted-by: OpenAI Codex Signed-off-by: 云挚 <ningyunxiao.nyx@antgroup.com>
Assisted-by: OpenAI Codex Signed-off-by: 云挚 <ningyunxiao.nyx@antgroup.com>
67a15e4 to
42b5b4e
Compare
|
This pull request has merge conflicts that must be resolved before it can be |
The fused DSA path moved out of vllm/models/deepseek_v32/nvidia/ into attention.py and common/kernels.py, which is what left this branch conflicting. Conflicts resolved in favour of the new layout with the fix carried over unchanged; the regression test merged cleanly. Signed-off-by: Mikhail Kostryukov <mike@triptrack.net>
|
@foraxe this fix is still needed. Both defects are live on The branch conflicts because the DSA path moved in August ( What we can add is validation on hardware, which this PR did not have: on 4xH200 with GLM-5.2-NVFP4 (TP4 + DCP4, If you would rather hand this off, say so and I will open a superseding PR with you as author. Otherwise it is yours, and I will leave it a week before doing anything else with it. AI assistance was used for the rebase and the runs. |
Bring this branch up to current main (DSA path moved out of nvidia/)
|
The forward-port from @drakosha has been reviewed and merged. Current head |
|
It seems the changes in I don't know model archs using sparse MLA other than DSV32/DSV4, so either change makes sense I guess, just want to mention it FYI. |
|
@cjackal we can settle the "either change" question with a run. On 4xH200 with GLM-5.2-NVFP4 (TP4 + DCP4, They are not interchangeable because of routing: since #52861 those two archs go through Your AI assistance was used for the runs. |
Thank you for the pointer! I missed the recent MRV2 forward override indeed, my |
LucasWilkinson
left a comment
There was a problem hiding this comment.
Thanks for the contribution! left a couple nits hopefully you can address before landing
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>
…ctness-upstream Signed-off-by: 云挚 <ningyunxiao.nyx@antgroup.com>
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>
[Bugfix][DCP] Fix NVIDIA DeepSeek-V3.2 / GLM-5.2 fused attention
Fixes #50095.
Purpose
Fix two DCP correctness defects in the fused DeepSeek-V3.2 / GLM-5.2
attention path:
owner-local KV-cache slot. KV ownership does not remove that rank's query
contribution.
and did not combine the resulting partial output/LSE across DCP ranks.
The sparse-indexer DCP rank, world-size, and interleave plumbing described in
the original version of this PR has since landed independently on
main; thisPR no longer changes that part.
Implementation
suppress MLA and indexer KV-cache writes.
MLADCPManagerbefore sparse MLAattention. The manager keeps the direct-workspace fast path when supported
and falls back safely for oversized mixed batches.
MLADCPManagerafterattention. For this NVIDIA pure-DCP mixed-batch path, pass no PCP-only decode
metadata; its sparse backend supplies neutral contributions for empty local
shards.
that checks valid query output, unchanged caches, and Top-K clearing.
Non-duplication
I re-audited related open work on August 23, 2026. Searching for issue #50095
finds only this PR.
fused DeepSeek-V3.2 attention or norm/RoPE path.
direct-workspace fallback handling after the DCP-manager refactor; this PR
now consumes that manager path but still supplies the NVIDIA fused override
and negative-slot query-normalization fixes.
None fixes both live defects in
vllm/models/deepseek_v32/{attention.py,common/kernels.py}.Validation
Current upstream base inspected:
b2dd9ce73dCurrent PR head:
22e9a19f8dThe branch was forward-ported across the August DeepSeek-V3.2 file moves by
@drakosha in foraxe#1. Against current
main, the PR contains only thethree intended files.
git diff --checkpasses.On one GB200 GPU at the exact PR head:
All applicable changed-file pre-commit hooks pass, including Ruff, formatting,
mypy, SPDX, forbidden-import, and accelerator-API checks.
Independent forward-port validation by @drakosha used 4xH200 with
GLM-5.2-NVFP4, TP4/DCP4,
fp8_ds_mla, and greedy decoding. On the testedprompt, patched DCP4 output was byte-identical to DCP1; unpatched
mainproduced repeated-token output. The focused kernel suite passed 67 tests with
the fix, while the new negative-slot regression was the only failure without
it.
AI assistance and human review
OpenAI Codex assisted with investigation, implementation, validation
orchestration, forward-port review, and drafting. @drakosha reports AI
assistance for the forward port and H200 validation.
local evidence, and can explain and defend the query-gather and output/LSE
merge protocol.