Repository navigation
[Perf] [NVIDIA] minimax-sparse: Run the decode indexer CP on Hopper at TP4 and TP8 - #46597
Open
ischencheng wants to merge 6 commits into
Open
ischencheng wants to merge 6 commits into
ischencheng wants to merge 6 commits into
Conversation
ischencheng
requested review from
Fridge003,
HaiShaw,
Qiaolin-Yu,
hebiao064,
ispobock and
merrymercy
as code owners
October 26, 2026 13:29
…ndexer-cp # Conflicts: # python/sglang/srt/environ.py
BBuf
approved these changes
Nov 5, 2026
BBuf
left a comment
Collaborator
There was a problem hiding this comment.
[BBuf Review Agent] LGTM. Please wait for the related CPU and Hopper kernel CI.
Collaborator
|
/tag-and-rerun-ci |
Collaborator
|
/rerun-failed-ci |
This branch has not been deployed
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
On Hopper every attention-TP rank keeps the whole MiniMax index K (one head) and every sparse layer scores all of it on each decode step. Index top-k sharing only runs on gfx95, so on CUDA every layer scans. At 128K context that is 33.5 MB per request per layer on each rank, and it grows with concurrency.
The opt-in indexer CP from #41488 and #42614 splits that scan across the ranks, but it only turns on for gfx950 at TP4. This PR turns it on for SM90 at TP4 and TP8. The three kernels are unchanged. MiniMax-M3 and M3.1 both take this path on Hopper. With DSPARK the gate keeps CP off, so this applies to runs without speculation or with EAGLE top-k 1.
Modifications
unsupported_reasontakes ansm90flag. On SM90 it allows attention TP4 or TP8 with attention CP/DP size 1. The gfx950 gate stays TP4.MiniMaxIndexerCPsizes its gather buffers from the group (4 or 8 ranks). At TP8 two ranks serve each index head, so 8 query rows are gathered. K is still read once per block, and each rank reads 1/8 of the blocks.SGLANG_MINIMAX_M3_INDEXER_CP=1. At batch 1 the two all-gathers per layer cost more than the scan they save, see the tables below.Accuracy Tests
test_minimax_indexer_cp.py(SM90): the merged CP selection for every rank equals the native page-128 selector at W=4 and W=8, BF16 and FP8, plus chain verify rows across a block boundary. Passes on 1x H200. Gate cases added totest_minimax_indexer_cp_gate.py.Speed Tests and Profiling
Measured on 10-26, before merging the latest main, and not re-run since.
Per layer per rank, 8x H200, real TP8, BF16 index K, 128K context, us. CUDA graph with 8 calls per replay on disjoint requests, max over ranks, median of 20 replays. CP includes both all-gathers. "% of floor" is index K bytes over 4.8 TB/s.
The two all-gathers alone take 42-48 us at TP8 and 30-42 us at TP4, so most of the CP time is communication. TP4: batch 16 133.2 -> 85.7, batch 32 252.5 -> 112.8. FP8 index K at TP8: batch 32 137.0 -> 87.0, batch 8 45.5 -> 64.1.
End to end on a 16-layer MiniMax-M3 dummy-weight model with the M3.1 layer layout (every layer sparse, first 3 FFNs dense), TP8 on 8x H200, BF16 KV and index K, page 128, 131K input, 160 greedy output tokens, decode CUDA graph. CP off and on alternated twice in the same container. Decode step in ms, median of 14 log windows of 10 steps each:
That is 69 us per layer at batch 16 and 121 us at batch 24, so the full 60-layer model should save roughly 4 ms per step with 16 concurrent 128K requests. It's worth turning on for long-context serving with more than a few requests in flight.
Checklist
CI States
Latest PR Test (Base): ✅ Run #41689509933
Latest PR Test (Extra): ❌ Run #41689509883
Latest PR Test (AMD ROCm 10): ❌ Run #41689509869
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: