Repository navigation
[FlyDSL] [MoE] MegaMoEV2: per-bucket small-input knobs for EP8 V4.1-Flash (48 experts a rank, on #8633) - #8758
Merged
yhl-amd merged 2 commits intoNov 28, 2026
Conversation
…xperts a rank) The EP8 DeepSeek-V4.1-Flash small-input kernel ran _tune_v41_flash_ep8_small alone. Add a per-bucket knob table on top of it, _V41_FLASH_EP8_SMALL_KNOBS, the default for the 48-expert layout (no switch): - en_order (FusedStage1Knobs, default 0): the GEMM1 (bit 1) and GEMM2 (bit 2) units of the run of one expert's m-tiles that lies wholly inside an XCD's slice go in (expert, n)-major order, so the run's m-tiles read each weight tile at about the same time and share it in the L2; bit 4 reads such grouped units' weights through the cache. The remap is a bijection on the slice's units that keeps every unit in its own expert's m-tiles and leaves the m-tiles cut by the slice ends in place: only the order changes. Its GEMM1 order runs on m-tile units, so it is refused together with pair_tiles (at 64 and 128 tokens it takes their place); it reads the experts from the local plan, so it needs plan_local. - The table: en_order, 256-wide GEMM1 tiles and cached W1 at 256 / 512 tokens, the lean GEMM1 / GEMM2 epilogues, dispatch CUs and waves per EU. None of them changes what ranks and launches exchange or what a tile computes. Other layouts keep en_order 0: their kernels and configs are unchanged (the pinned config digests take en_order only when set; the V4.1-Flash EP8 digest is re-pinned). Tests: - tests/test_mega_moe_v41_ep8_small_knobs.py: each bucket is the tune plus exactly its table entry, one launch protocol across buckets (the same as without the table), every en_order buildable, the other fused layouts unchanged. - op_tests/multigpu_tests/test_mega_moe_v2.py --suite routes --network v41_flash --compare-untuned (8 GPUs): every small-input case again with the configs selected without the table, bit for bit. Co-Authored-By: Claude Opus 5.5 <[email protected]>
yhl-amd
marked this pull request as draft
November 26, 2026 11:16
Contributor
Author
|
GPU validation on top of #8633 (head 6420f64), gfx950 / MI355X, 8 GPUs; details in the description's Tests and Performance sections.
No bucket is slower on #8633 in serving, so the table is unchanged. Marking ready; merge after #8633. |
yhl-amd
marked this pull request as ready for review
November 26, 2026 18:33
…64 knobs nearest_token_bucket sends 24..47 rows a rank to bucket 32. Its table entry (64 dispatch CUs, 2 waves per EU, b_nt 1, g2_epi_lean 1) was searched on c512 decode replays; in serving at c128 (4..7 requests a rank) it is slower than the bucket-64 entry, so 42 rows a rank ran slower than 48. Bucket 32 now takes the bucket-64 entry (128 dispatch CUs, one wave per EU, streamed W1 b_nt 3, full GEMM2 epilogue) and keeps its 256-wide GEMM2 blocks: its config is now equal to bucket 64's field for field. Only dispatch / occupancy / load-hint / epilogue knobs change, so the outputs are unchanged. No pinned digest case falls in bucket 32, so the digests stay. Tests (gfx950, 8 GPUs): - test_mega_moe_v2.py --suite routes --network v41_flash --compare-untuned: ALL PASS, 0 mismatched rows against the configs selected without the table. - The old and the new bucket-32 entry at 24/30/36/42 rows a rank (uniform and Zipf 0.4/0.8/1.2 routes): 0 mismatched rows. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
Author
|
Pushed 57fd7f4 on top of the table commit: bucket 32 (24..47 rows a rank) now runs the bucket-64 knobs.
The description has a new "Update" section with the data. |
yhl-amd
added a commit
that referenced
this pull request
Nov 28, 2026
[FlyDSL] [MoE] MegaMoEV2: EP8 V4.1-Flash DSpark draft MoE on the small-input route, BF16 return on every draft route (on #8758)
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
EP8 DeepSeek-V4.1-Flash (48 routed experts a rank, shared expert computed apart) gets a per-bucket small-input knob table on top of
_tune_v41_flash_ep8_small, as the default for that layout (no switch, no environment variable).FusedStage1Knobs.en_order(default 0): inside the run of one expert's m-tiles that lies wholly in an XCD's slice, GEMM1 (bit 1) / GEMM2 (bit 2) units go in (expert, n)-major order, so those m-tiles read each weight tile at about the same time; bit 4 reads such grouped units' weights through the cache. A bijection on the slice's units: only the order changes. Refused withpair_tiles(bit 1) and withoutplan_local._V41_FLASH_EP8_SMALL_KNOBS: en_order, 256-wide GEMM1 tiles and cached W1 at 256 / 512 tokens, lean GEMM1 / GEMM2 epilogues, dispatch CUs and waves per EU. At 64 / 128 tokens en_order's GEMM1 order takes the place ofpair_tiles. No knob changes what ranks exchange or what a tile computes.Dependencies / merge order
ghu/mega_small_m_speedup_20261125), so the diff is this change alone; it retargets to main once [FlyDSL] [MoE] MegaMoEV2: faster small-input route (bitwise identical), EP8 V4.1-Flash large-input route at every capacity #8633 merges.Tests
--suite routes --network v41_flash --compare-untuned: PASS. 48 cases, 2 runtimes carry the table, 0 mismatched rows against the configs selected without it; accuracy, alternation, epoch wrap and graph replay all pass. Same result on [FlyDSL] [MoE] MegaMoEV2: EP8 V4.1-Flash DSpark draft MoE on the small-input route, BF16 return on every draft route (on #8758) #8759's branch (this PR + the draft layout).Replay of real serving routes (DeepSeek-V4.1-Flash c512 decode MegaMoE inputs, 48-expert layout, 10 layers, CUDA graph, 7 interleaved rounds, median per layer), the table against [FlyDSL] [MoE] MegaMoEV2: faster small-input route (bitwise identical), EP8 V4.1-Flash large-input route at every capacity #8633's tune (the bucket's entry dropped). Every variant bit-identical to the other on every layer and rank, repeat-exact:
16 / 64 / 128 (where [FlyDSL] [MoE] MegaMoEV2: faster small-input route (bitwise identical), EP8 V4.1-Flash large-input route at every capacity #8633 differs from the stack the table was searched on: 256-wide tiles at 16, pair_tiles at 64 / 128) are faster or flat on every route; 8 and 32 depend on the route (both are under 3% of c512 decode time, see the per-bucket serving times below).
Update: bucket 32 runs the bucket-64 knobs (57fd7f4)
Root cause.
nearest_token_bucketsends 24..47 rows a rank to bucket 32 (at c128 that is 4..7 requests a rank, about half of the decode steps). Its entry (64 dispatch CUs, 2 waves per EU,b_nt1,g2_epi_lean1) came from the c512 replay search; in serving it is slower than the bucket-64 entry, so a rank with 42 rows ran its MegaMoE slower than one with 48.Change. One table entry: bucket 32 takes the bucket-64 knobs (128 dispatch CUs, one wave per EU, streamed W1
b_nt3, full GEMM2 epilogue) and keeps its 256-wide GEMM2 blocks, so its config is now equal to bucket 64's field for field. No tile shape, protocol or numerics knob changes. No pinned digest case falls in bucket 32, so the digests stay.Correctness (gfx950, 8 GPUs).
--suite routes --network v41_flash --compare-untuned: ALL PASS, 48 cases, 0 mismatched rows against the configs selected without the table (graph, alternation, epoch wrap pass too).Kernel time (MegaMoE call, CUDA graph of 50 calls, max over ranks, median of 7 interleaved rounds for uniform / Zipf 1.2 and 3 for Zipf 0.4 / 0.8):
The new entry is faster on balanced routes and slower on strongly skewed ones (Zipf >= 0.8, where the call itself is about half as long because few experts are hot). Serving with dynamic EPLB keeps the ranks' expert load balanced, and there the serving numbers below are what decides.
Serving. DeepSeek-V4.1-Flash, MI355X DEP8, InferenceX AgentX, 900 s per run, SA-compliant serving config (48 routed experts a rank / topk 6, FP8 shared expert computed apart, draft not fused, no draft lm_head FP8, dynamic EPLB); the arms differ only in this bucket-32 entry (measured on our serving stack's equivalent table, same knob values), run order A, B, B, A:
Performance
DeepSeek-V4.1-Flash, MI355X DEP8, InferenceX AgentX c512, 900 s per run, SA-compliant serving config (48 routed experts a rank / topk 6, FP8 shared expert computed apart, draft not fused, no draft lm_head FP8, dynamic EPLB), one machine. The arms differ only in aiter's MegaMoE files: #8633 head vs #8633 + this PR (+ #8759 as a third arm), run in the order #8633, this PR, #8759, #8759, this PR, #8633.
Both runs with the table are ahead of both #8633 runs in throughput and p90. Pure-decode step time by small-input bucket (max over ranks, matched by requests a rank, both runs of each arm): 64 -2.0%, 128 -2.8%, 256 -2.1%, 32 0.0% (these four are about 64% of the run's time); 8 / 16 together 0.5% of the time, within their run-to-run spread. Outputs are bit-identical to #8633's (above), so accuracy is #8633's; GSM8K of the #8759 arm (which includes this table) 0.9318 (5-shot, without golden acceptance length).
On the earlier stack the table was searched on (before #8633's small-input changes), the same c512 comparison gave +1.3% / p90 +4.6%.
🤖 Generated with Claude Code