Repository navigation
[ROCm][Perf][MiniMax-M3.1] Score DSpark 7 decode locally below 3 requests instead of via indexer CP - #65432
Merged
shen-shanshan merged 4 commits intoNov 4, 2026
Conversation
…ests instead of via indexer CP The context-parallel decode scorer (m3_nvfp4_index_score_push_cp) pays two cross-rank handshakes per layer, a fixed ~13 us that does not shrink with the batch. At 1-2 requests (8 rows each) the single-head scorer (m3_nvfp4_index_score_decode_r8h1, each rank scores its own head, no cross-rank traffic) takes 6-9 us per layer against 14-15 us for CP, and its scores are bit-identical. DSpark 7 steps with fewer than CP_MIN_REQS = 3 requests now take that path; larger steps and DSpark 3 are unchanged. Decode step p50 at 150K contexts, TP4 DSpark 7, DBO off: -4.2% at 1 request and -2.3% at 2 (random tokens), -3.1% at both (real text). Signed-off-by: Fangzhou Ai <fangzhou.ai@amd.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Fangzhou-Ai
requested review from
dllehr-amd,
hongxiayang and
tjtanaa
as code owners
November 3, 2026 16:11
Fangzhou-Ai
requested review from
AndreasKaratzas,
WoosukKwon,
mgoin,
tlrmchlsmth,
yewentao256 and
zyongye
as code owners
November 3, 2026 16:11
Collaborator
Author
|
/ci run |
|
✅ Triggered Buildkite CI #99596 for commit |
micah-wil
approved these changes
Nov 3, 2026
ChuanLi1101
approved these changes
Nov 4, 2026
ChuanLi1101
left a comment
Collaborator
There was a problem hiding this comment.
LGTM. Gating DSpark-7 indexer CP below 3 requests onto the single-head scorer matches the measured handshake cost, and the CP path stays for N>=3. Micah’s nits are non-blocking.
…er gate test cases Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Fangzhou Ai <fangzhou.ai@amd.com>
Collaborator
Author
|
Thanks for the review. Addressed in 975a922: shortened the |
Collaborator
Author
|
/ci run |
|
✅ Triggered Buildkite CI #99832 for commit ℹ️ This PR is 74 commits behind upstream |
Merged
6 tasks done
yeshihai
pushed a commit
to yeshihai/vllm
that referenced
this pull request
Nov 8, 2026
…ests instead of via indexer CP (vllm-project#65432) Signed-off-by: Fangzhou Ai <fangzhou.ai@amd.com> Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com> Co-authored-by: vllm-agent <claw@inferact.ai>
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.
Purpose
With
indexer_decode_cpat TP4 (#64448), every DSpark 7 decode step scores through the context-parallelpush kernel (
m3_nvfp4_index_score_push_cp), whatever the batch size. Its two cross-rank handshakes (index-qexchange, then score push plus a four-rank done barrier) cost a fixed ~13 us per layer that does not shrink with
the batch, so at 1-2 requests the kernel spends its time waiting, while the single-head scorer
(
m3_nvfp4_index_score_decode_r8h1, each rank scores its own head over the whole context, no cross-rank traffic)takes 6-9 us. This PR scores steps of fewer than
CP_MIN_REQS = 3requests (8 rows each) with the single-headscorer, which is the path the scorer already takes when CP is off. Steps of 3 or more requests, and DSpark 3 (4 rows
per request), are unchanged.
Not covered by an existing PR: #64448 (merged) enables CP for DSpark 7 at any batch size; #65087/#65267 only touch the top-k.
Root cause (kernel level)
Per-layer kernel durations from the torch profiler (rank 0, 120 decode steps per window, 150K-token real-text
contexts, DBO off,
VLLM_ROCM_USE_SKINNY_GEMM=0), before / after this change:m3_nvfp4_index_score_push_cp15.8 us avg (p50 13.0)m3_nvfp4_index_score_decode_r8h17.0 usm3_nvfp4_index_score_push_cp14.9 us avg (p50 13.3)m3_nvfp4_index_score_decode_r8h19.7 us(58 sparse layers per step: 0.92 -> 0.41 ms/step at N=1 and 0.87 -> 0.57 ms/step at N=2.)
Isolated, four ranks, CUDA-graph replay of 8 back-to-back calls with the L2 flushed before each replay,
max_seq_len1M as in the captured graph, 8 rows per request, context lengths uniform in [0.7, 1.3] x the stated mean; CP vs
single-head scorer, us per call. The scores of the two kernels are bit-identical in all 28 cells.
CP is a fixed ~14-15 us up to 4 requests; the single-head scorer grows with the pages it reads (one head, all
blocks) and loses once a step reads ~4-5K index pages in total (4 requests at 150K, 2-3 at 400K). The gate is on the
request count because under CUDA graphs
max_seq_lenis the model maximum, so the batch's context is not known whenthe graph is captured. 3 requests at 150K would also win (11.3 vs 14.5 us) but loses at 400K (17.6 vs 15.4 us) and
showed no end-to-end gain, so the gate stops at 2 requests.
End-to-end (decode step p50, ms; same server flags, only this change differs)
MI355X x4, TP4,
amd/MiniMax-M3.1-Flash-Quark-MXFP4, NVFP4 KV and NVFP4 indexer withindexer_decode_cp,DSpark 7 with synthetic acceptance 4.04, DBO off,
VLLM_ROCM_USE_SKINNY_GEMM=0, 150K-token prompts, N concurrentdecodes (
decode_bench.py <port> 150000 N: p50 of the gap between streamed chunks once all N streams aredecoding, 900 output tokens, 3 passes per server, median of the passes). "base" is the mean of two server instances
(range in brackets); the change was measured on a third instance. The change was run with
CP_MIN_REQS = 4(onerequest more than this PR gates), which only affects the N=3 row; at N=3 this PR keeps CP, i.e. is the base.
Steps of 4 or more requests take the same code path as base, so their rows are a measure of server-to-server
noise (within +-0.6%).
Random-token prompts:
Real-text prompts (python sources; the model's attention is not uniform):
Correctness
test_index_decode_cp_push_matches_single_headand the 28-cell sweep above), so the top-k ids and the attentionoutput are bit-identical to the CP path: this change only picks which of the two bit-identical scorers runs.
test_decode_cp_gate(8 cases, unit test of_decode_cp).pytest tests/kernels/attention/test_minimax_m3_nvfp4_index.py: 182 passed (174 existing + 8 new) on MI355X.split-count change; greedy; the synthetic-acceptance recipe garbles some of the surrounding text with or without them).
Limitations
CP at every batch size; the crossover for 4-row requests was not measured.
14.8 us, 16 requests 13.3 vs 15.8 us). A context-aware choice would need it inside the kernel or two graphs per batch size.
16.4 vs 14.9 us at 1 request, 23.7 vs 18.4 us at 2). Contexts that long are rare in the target agentic workload
(30K-500K, mean ~150K).
CP is used outside microbatches exactly as before; stacked with two other changes the step was 2-8% lower at N=1..16.
MoE kernel changes land between runs, so only runs from a frozen copy of the install (same state) are compared.
Related: #64448 (DSpark 7 CP), #57909 (indexer CP), #65087 (top-k, independent).
Test command and config (from /home/fai/profile_m31/run):
DBO=0 VLLM_ROCM_USE_SKINNY_GEMM=0 ./serve.sh 16 0,1,2,3 8000 20000=
vllm serve amd/MiniMax-M3.1-Flash-Quark-MXFP4 --tensor-parallel-size 4 --attention-config '{"indexer_kv_dtype":"nvfp4","indexer_decode_cp":true}' --block-size 128 --kv-cache-dtype nvfp4 --max-model-len 1048576 --max-num-batched-tokens 32768 --max-num-seqs 32 --moe-backend aiter --enable-prefix-caching --disable-hybrid-kv-cache-manager --gpu-memory-utilization 0.85 --speculative-config '{"method":"dspark", "num_speculative_tokens":7,"attention_backend":"TRITON_ATTN","kv_cache_dtype":"fp8","draft_sample_method":"probabilistic", "rejection_sample_method":"synthetic","synthetic_acceptance_length":4.04}'(+ the InferenceX recipe env:VLLM_USE_V2_MODEL_RUNNER=1 VLLM_ROCM_USE_AITER=1 VLLM_ROCM_USE_AITER_MOE=1 VLLM_ROCM_QUICK_REDUCE_QUANTIZATION=INT4),then
OUT_TOKENS=900 python decode_bench.py 8000 150000 1 2 3 4 5 6 8 12 16.🤖 Generated with Claude Code