Repository navigation
fix(minimax-m3): mono rows independent of the step's other rows; pad rows join no expert - #2485
Merged
Merged
Conversation
…rows join no expert A row's MoE output depended on which other rows shared its step. The wide down stage dealt each expert's 6 chunks to 4 waves by the expert's rank in the step's expert union (j = wave + 4 i), and the 4 waves' partials are summed apart: a row whose experts the other rows did not touch still had its sums regrouped whenever another row brought an expert in. CUDA-graph pad rows did the same, and also widened the union. Down: wave q of a row group takes chunks q and q + 4 of every expert, unit i being expert i // 2 for all 4 waves. Which wave adds a chunk, and in what order, now follows from the expert alone. Pad rows: the decode publishes batch_id_per_q_token (-1 on the graph's pad tail) through publish_batch_ids, and K4 takes it. A pad row sets no bit in the expert -> token mask (row_live in the mono framework), so its experts are neither read nor computed. The dispatch takes a step only with the ids published. 4 x MI355X, TP4, one sparse layer (fused K1 + K4), probe rows fixed, the other rows changed (other requests, pad rows, long contexts): bit-identical at every width 1-16; main differed at 11 and 16 rows. Graph replay, us a layer: 16 rows with 9 real and 7 pads 118.1 -> 110.5; all rows real 5 / 8 / 12 / 16: +2.4 / +1.4 / 0 / 0 to +1.3 (the busiest wave does 2 units an expert, not 1.5). GSM8K chat 8-shot, 12 concurrent, two runs a tree: main 0.9393 / 0.9371 with 25.9% of answers identical between runs, this 0.9386 / 0.9416 with 79.6%.
Contributor
🏷️ CI GuideRuns automatically on every eligible PR before approval:
Heavy model tests:
|
This was referenced Oct 8, 2026
omirosh
added a commit
to omirosh/sglang
that referenced
this pull request
Oct 12, 2026
The test keeps one probe row and changes only the other rows of the step. The probe outputs must be bit-identical at widths 1 to 8, and equal to the probe alone. ROCm/ATOM#2485 found this fault in the MiniMax-M3 K4. Co-authored-by: Cursor <cursoragent@cursor.com>
omirosh
added a commit
to omirosh/sglang
that referenced
this pull request
Oct 12, 2026
The test keeps one probe row and changes only the other rows of the step. The probe outputs must be bit-identical at widths 1 to 8, and equal to the probe alone. ROCm/ATOM#2485 found this fault in the MiniMax-M3 K4. Co-authored-by: Cursor <cursoragent@cursor.com>
omirosh
added a commit
to omirosh/sglang
that referenced
this pull request
Oct 15, 2026
The test keeps one probe row and changes only the other rows of the step. The probe outputs must be bit-identical at widths 1 to 8, and equal to the probe alone. ROCm/ATOM#2485 found this fault in the MiniMax-M3 K4. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Why
#2452 found two MiniMax-M3 mono issues. The first, stores not drained before their done flags, is fixed on main (every flag goes through the framework's
publish,s_waitcnt vmcnt(0)first). The second, a CUDA-graph pad row changing real rows' MoE results, is still open. #2452 keeps a pad row out of the expert set by itsseq_len.Testing that fix showed the issue is wider than pad rows. With the same probe rows and only the step's other rows changed, the probes' MoE output (
ar_out) differs when the others are other requests, pad rows, or long-context requests. On main this happens at 11 and 16 rows. The cause is the wide down stage. It deals each expert's 6 k-chunks to the row group's 4 waves by the expert's rank in the step's expert union (j = wave + 4 i), and the 4 waves' partials are summed apart. Another row bringing in an expert shifts the ranks, which regroups this row's sums. In serving this shows up as answers that change with the batch: two GSM8K runs of the same server agree on 26% of the answers.What
qtakes chunksqandq + 4of every expert, and unitiis experti // 2for all 4 waves (lockstep, so they read one expert at a time). Which wave adds a chunk, and in what order, follows from the expert alone.batch_id_per_q_token, not by itsseq_len.publish_batch_ids, with-1on the graph's pad tail; the capture metadata points at the same buffer.row_live(batch_ids, k)(atom/mono/device/ops.py) lets a pad row set no bit in the expert -> token mask, so its experts are neither read nor computed.Tried, and slower
Test
4 x MI355X, TP4.
max-num-seqs 16, 12 concurrent, two runsThe remaining ~20% that differ between runs come from the original-path parts (prefill, the 3 dense layers), which are not batch-invariant.
The probe test (
batch_invariance.py) and its V4.1 counterpart live in therun-m3-mono/run-v41-monoskills. V4.1's K2b is batch-invariant by construction: a pick's down runs its whole K on one wave, anddown_combinesums each token's top-k in its own order.tests/test_minimax_m3_mono_dispatch.pyadds three refusals: no batch ids, int64 ids, too few ids. All three fail with the dispatch check reverted.