Repository navigation
[Fix] attention: Keep fused RoPE KV writes off DCP layouts - #47261
Merged
Merged
Conversation
BBuf
approved these changes
Nov 2, 2026
BBuf
left a comment
Collaborator
There was a problem hiding this comment.
[BBuf Review Agent] LGTM. Please wait for the related CI to pass.
Collaborator
|
/tag-and-rerun-ci |
Yuxingwang-intel
pushed a commit
to Yuxingwang-intel/sglang
that referenced
this pull request
Nov 6, 2026
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
Qwen3-30B-A3B with TP8/DCP2, Triton attention and BF16 KV can write DCP logical slot IDs directly into a rank-local KV buffer through fused RoPE + KV storage. This causes incorrect output and can produce CUDA illegal memory accesses as the cache allocation advances.
Modifications
enable_fused_set_kv_buffer()checksforward_batch.dcp_kv_maskto avoid DCP, but eager batch construction only populates that mask on HIP. CUDA batches can therefore have DCP enabled with aNonemask.Qwen3 MoE then selects fused RoPE storage, whose
FusedSetKVBufferArg.cache_locis the unchangedout_cache_loc, and skips the attention backend's KV store. That bypasses the Triton DCP path's owner mask andloc // dcp_sizetranslation.get_parallel().dcp_enabledis true. The existing attention backend performs the DCP-aware store.Accuracy Tests
enable_thinking=False, temperature 0,top_p=1,max_tokens=1024, server seed 42.Results:
Speed Tests and Profiling
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): ❌ Run #40868084920
Latest PR Test (Extra): ❌ Run #40868084748
Latest PR Test (AMD ROCm 10): ✅ Run #40868084788
Tip
Base CI only covers the core cases, and its workload may not exercise your change. Use
/rerun-testto run the tests your change touches, or copy this prompt for an agent: