Repository navigation
Conversation
DeepSeek-R1 at EP4 dispatches topk=9 (8 routed + 1 shared), but the gfx1250 schedule tables only had topk=8 entries, so lookup() fell back to the block-64 single-shot default. At the ~3456-recv decode operating point that starves the 256-CU GPU. Add (4,7168,9) entries to both the dispatch and combine tables (lookup requires both halves) and retune the dispatch geometry to block 256. In-engine DSR1 1k4k conc6144 decode: mori dispatch 67.8 -> 38.8 us. Combine geometry unchanged (pure scheduling, no math).
jhchouuu
approved these changes
Oct 8, 2026
Comment on lines
179
to
186
| "gfx1250": { | ||
| (4, 7168, 8, None): ((None, 64, 8),), | ||
| # topk 9 = 8 routed + 1 shared (ATOM's actual dispatch key). Needed so the | ||
| # dispatch schedule has a combine half -- lookup() returns the block-64 | ||
| # single-shot default unless BOTH halves exist. Combine geometry mirrors | ||
| # topk 8 (unchanged); only the dispatch half is retuned to block 256. | ||
| (4, 7168, 9, None): ((None, 64, 8),), | ||
| (4, 7168, 6, None): ((None, 64, 8),), |
Collaborator
There was a problem hiding this comment.
have you tested on gfx1250?
zhangfei829
added a commit
that referenced
this pull request
Oct 11, 2026
Conflicts were all #726's selfFirst-follows-TOKOFF_EXT, which this branch already replaced with aggReserve on the same tokOffExt field; kept the branch side. #725's EP4 topk 8/9 dispatch rows are taken, and its topk 9 row is folded into the one (4, 7168, 9) key so #726's fp4 row no longer shadows it. #735 is taken: the gfx1250 dispatch still stores totalRecvTokenNum.
Merged
zhangfei829
added a commit
that referenced
this pull request
Oct 11, 2026
gfx1250 EPv2: one-RMW slot reservation, EP16 fp4 dispatch and push combine, fp8 push combine
## Summary
- Dispatch slot reservation: a rank's blocks add up their token counts and the last block reserves once per destination (one RMW on the slot word instead of one per block). Replaces selfFirst; `MORI_EP_TOKOFF_EXT=1` keeps the per-block protocol for a single-host EP.
- EP16 fp4 dispatch: 128x16 sends each destination's rows from a pinned set of warps.
- fp4 push combine: the landing offset rides the 64-bit dispatch signal, and the landing area is M x min(world, topk) rows instead of world x world x M, so EP16 push fits at 16384 tokens a rank.
- fp8 push combine (`fp8_blockwise`).
- EP16 64x16 bf16/fp8: a metadata warp holding exactly two runs loads both, then stores both. Built into those instances and chosen at run time, with no switch.
- Tuning tables: EP16 dispatch and fp4 push combine, EP4 fp8 push combine. Removed the `MORI_V2_EP_{DISP,COMB}_{BLOCKS,WARPS}` overrides.
- Merged main: #725 and #735 taken; #726's selfFirst change superseded. The duplicate `(4, 7168, 9)` dispatch key on main is folded into one, so #725's topk 9 row takes effect.
## Test
CHECK=1 passes on EP4 (topk 6 and 9), EP8 (2 hosts) and EP16 (4 hosts) at 1 / 64 / 512 / 4096 / 8192 / 8193 / 16384 tokens a rank, for fp4 push, fp4 pull, bf16 and fp8 push.
EP16 (4 hosts x 4 gfx1250), fp4 dispatch, topk 6, 96 experts/rank, HIP graph, ITERS=50, 3 alternating rounds, medians in us. The baseline has main's kernel and its untuned 64x16 geometry; main cannot allocate the fp4 push landing area at EP16 with 16384 tokens, so its combine is pull. The fp4 machine code is identical to this branch's head.
| tokens/rank | dispatch main → branch | combine main (pull) → branch (fp4 push) |
|---:|---:|---:|
| 64 | 27.39 → 26.56 | 17.95 → 16.02 |
| 512 | 38.83 → 31.66 | 50.57 → 28.33 |
| 4096 | 113.03 → 92.57 | 275.81 → 87.99 |
| 16384 | 378.46 → 292.98 | 1032.22 → 302.42 |
EP4 is about even with main: topk 9 fp4 push, same node, 3 alternating rounds, dispatch +0.1..+1.2 us, combine +0.2..+0.7 us (+2.5 at 1536).
jhchouuu
added a commit
to jhchouuu/mori
that referenced
this pull request
Oct 12, 2026
Conflicts in hip_tuning_configs.py, resolved to this branch's tables: - topk-9 fp4 dispatch: this branch's sweep (main kept ROCm#726's row under "fp4_disp_bf16_comb"; main also un-shadowed the ROCm#725 row, as this branch did). - topk-6 fp4 dispatch: same buckets, keyed "fp4" as on this branch. - the combine-table comment: main's (EP8 and EP16). Main's new EP16 dispatch row is re-keyed from "fp4_disp_bf16_comb" to "fp4", since lookup() now reads that spelling as "fp4"; under the old key the row would never match. Checked against main over every table key, dispatch dtype and quant type (112 lookups): every key but topk 9 returns what main returns for "bf16", "fp8" and "fp4_disp_bf16_comb". Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
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.
Summary
Add gfx1250 EP4 schedule-table entries for
(world=4, hidden=7168, topk=9)toboth the dispatch and combine tables, and retune the dispatch geometry to block
256. topk=9 is DeepSeek-R1's real dispatch width at EP4 (8 routed + 1 shared).
Motivation
DSR1 at EP4 dispatches topk=9, but the gfx1250 tables only had topk=8 entries.
lookup()returns the block-64 single-shot default unless both a dispatchand a combine entry exist for the key, so the engine silently fell back to the
block-64 path. At the ~3456-recv decode operating point that geometry starves
the 256-CU GPU. Block 256 saturates it. The combine half must be present too (it
mirrors topk=8 geometry, unchanged) purely so the dispatch schedule resolves.
Test Plan
tests/python/ops/dispatch_combine_v2/bench_ep.pywithDISP=fp4 HIDDEN=7168 TOPK=9 EPR=64across the decode token sweep, hip backend.mori dispatch 67.8 µs → 38.8 µs (−29 µs/step).
Accuracy
Pure scheduling/geometry change — no arithmetic is altered, output is
bit-identical. End-to-end GSM8K 5-shot (1319 q, FAKE_EPLB=0) unchanged at
0.958 (flexible-extract), matching the reference.