Skip to content

[FlyDSL] [Perf] MiniMax-M3 MoE on gfx1250: fused route psum and tuned grouped A8W4 tiles - #6668

Merged
lirui927 merged 2 commits into
mainfrom
lirui/m3-moe-gfx1250-decode
Oct 28, 2026
Merged

lirui927 merged 2 commits into
mainfrom
lirui/m3-moe-gfx1250-decode

Conversation

@lirui927

@lirui927 lirui927 commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Speeds up the MiniMax-M3 MoE layer on gfx1250 (MI455, TP4; per rank H=6144, I=768, E=129 with the shared expert, top_k=5, MXFP4).

Changes

  • Tuned tiles. aiter/configs/model_configs/minimax_m3_gfx1250_tuned_grouped_fmoe.csv adds a row for every padded token from 1 to 32768 except 1024; main has no grouped row for this shape, so every call ran the default 64x256x256 tile. At 1024 no candidate beat the default.
  • Fused route. In aiter/ops/flydsl/grouped_moe_gfx1250.py, TP calls with no compact layout, EP or stage-2 scatter call the existing fused_route_psum_remap, one launch in place of the counter zero-fill, moe_route and moe_contiguous_psum_remap, when T * top_k <= _FUSED_ROUTE_PSUM_MAX_NUMEL and E <= 512. The limit counts routes, not tokens, so it holds for any top_k; for M3 (top_k=5) it means T <= 409. The limit, unused on main, drops from 4096 to 2048 routes: past about 2.5K the one-workgroup kernel is slower than the split launches.

Results

fused_moe us/layer, main 567ff81 vs this branch, one GPU, CUDA graph, 8 weight copies so weights are not L2-resident. "Tune only" is the branch with the fused route off.

Tuned tiles (main vs tune only)

T 1 4 16 32 128 512 1024 2048 4096 8192 16384 32768
main 32.2 34.0 52.9 70.0 91.6 100.3 110.6 154.7 236.1 401 718 1341
tune only 18.8 23.0 47.1 63.1 81.1 94.1 110.5 140.5 206.4 336 602 1114
change -42% -33% -11% -10% -12% -6% no row -9% -13% -16% -16% -17%

Fused route (tune only vs branch)

T (routes = 5T) 1 4 16 32 64 256 400 512 and up
tune only 18.8 23.0 47.1 63.1 78.4 88.1 91.9 not fused
branch 16.7 20.8 44.8 60.3 70.9 86.4 90.4
change -11% -9% -5% -4% -10% -2% -2%

Outputs are bitwise identical to main at every T measured.

Testing

On gfx1250: test_config_shape_collision.py 27 passed; test_flydsl_grouped_gemm.py -k m3_tp_decode 2 passed; test_flydsl_moe_aux.py all route rows err 0; test_moe_ep.py -t g1u1_a8w4_mxfp4 g1u1_a4w4_mxfp4 logits_diff 0.001066 and 0.000025, equal to main.

End-to-end

MiniMax-M3-MXFP4 on 4 x MI455, TP4, BF16 KV cache, 8K/1K at concurrency 4, base and branch servers alternating on one node: TPOT 10.66 to 10.04 ms (-5.8%), output 347.6 to 368.5 tok/s (+6.0%), TTFT unchanged. GSM8K 5-shot: 0.9356 to 0.9386 (flexible).

@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter op tests (gfx942 + gfx950)
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs (added automatically when gfx942 configs change); main branch always runs both MI35X and MI300X
ci:triton-355 Run the full Triton test suite on MI35X, not only the tests the change affects
ci:windows Windows JIT op smoke test on the gfx1201 ROCm runner
ci:multi-gpu Aiter multi-GPU tests on the 8-GPU runner
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: DeepSeek-V4-Pro, MiniMax-M3-MXFP4
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 6668 --add-label <label>

One backend per PR:
A PR changes one kernel backend: [Triton/Gluon] (Triton and Gluon count as one), [HIP], [ASM], [CK], [OPUS] or [FlyDSL]. If the title ends up with two backend tags, split the PR -- as stacked pull requests when one part cannot merge without the other.

PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to stop the title rewrites; labels stay in sync either way.

@lirui927
lirui927 marked this pull request as ready for review October 20, 2026 09:48
@lirui927
lirui927 requested a review from a team October 20, 2026 09:48
@lirui927
lirui927 marked this pull request as draft October 27, 2026 03:27
@lirui927
lirui927 force-pushed the lirui/m3-moe-gfx1250-decode branch 2 times, most recently from cbe6fce to 1f16642 Compare October 27, 2026 04:36
lirui927 and others added 2 commits October 27, 2026 04:58
Adds aiter/configs/model_configs/minimax_m3_gfx1250_tuned_grouped_fmoe.csv
for MiniMax-M3 at TP4 (model_dim 6144, inter_dim 768, expert 129, topk 5),
one row per padded token from 1 to 32768 except 1024, where no candidate
beat the default tiles. Up to 512 tokens the rows use tile_m 16 or 32 with
narrow N tiles; from 2048 both GEMMs use tile_m 128 with 256x256 tiles.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
TP calls with no compact layout, EP or stage-2 scatter and at most
_FUSED_ROUTE_PSUM_MAX_NUMEL routes take the one-workgroup
moe_route_psum_fused kernel in place of the route counter zero-fill,
moe_route and moe_contiguous_psum_remap launches. The limit drops from 4096
to 2048 routes: the split launches catch up at about 2.5K on gfx1250. Adds
decode-shaped cases to test_route_psum_fused and an M3 TP decode case to
test_flydsl_grouped_gemm.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@lirui927
lirui927 force-pushed the lirui/m3-moe-gfx1250-decode branch from 1f16642 to 22471d2 Compare October 27, 2026 05:00
@lirui927
lirui927 marked this pull request as ready for review October 27, 2026 06:06

@yadaish yadaish left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lirui927
lirui927 merged commit dbaffe2 into main Oct 28, 2026
98 checks passed
@lirui927
lirui927 deleted the lirui/m3-moe-gfx1250-decode branch October 28, 2026 04:48
vpietila-amd pushed a commit that referenced this pull request Oct 28, 2026
… grouped A8W4 tiles (#6668)

* Tune M3 grouped A8W4 MoE GEMM tiles on gfx1250

Adds aiter/configs/model_configs/minimax_m3_gfx1250_tuned_grouped_fmoe.csv
for MiniMax-M3 at TP4 (model_dim 6144, inter_dim 768, expert 129, topk 5),
one row per padded token from 1 to 32768 except 1024, where no candidate
beat the default tiles. Up to 512 tokens the rows use tile_m 16 or 32 with
narrow N tiles; from 2048 both GEMMs use tile_m 128 with 256x256 tiles.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Use fused_route_psum_remap on the gfx1250 TP MoE path

TP calls with no compact layout, EP or stage-2 scatter and at most
_FUSED_ROUTE_PSUM_MAX_NUMEL routes take the one-workgroup
moe_route_psum_fused kernel in place of the route counter zero-fill,
moe_route and moe_contiguous_psum_remap launches. The limit drops from 4096
to 2048 routes: the split launches catch up at about 2.5K on gfx1250. Adds
decode-shaped cases to test_route_psum_fused and an M3 TP decode case to
test_flydsl_grouped_gemm.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: lirui927 <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
zhiding512 added a commit that referenced this pull request Oct 29, 2026
No conflicts, but main changed code the deployment replay runs through:

- #7020: the MXFP4 inline sort takes num_local_tokens and skips expert
  ids outside [0, E), as the sentinel ids of EP callers are.
- #7067: the a16w4 stage-2 reduce mode in fused_moe.py and Kimi-K3's
  a16w4 table.
- #7068, #6668: gfx1250 grouped tables for DeepSeek-V4.1 MegaMoE EP and
  MiniMax-M3.
- #7055: the OPUS CO tests read local kernel IDs; this branch's 1-GPU CI
  shards failed on the global ones.

Co-authored-by: Cursor <[email protected]>
solinzby1 pushed a commit that referenced this pull request Nov 2, 2026
… grouped A8W4 tiles (#6668)

* Tune M3 grouped A8W4 MoE GEMM tiles on gfx1250

Adds aiter/configs/model_configs/minimax_m3_gfx1250_tuned_grouped_fmoe.csv
for MiniMax-M3 at TP4 (model_dim 6144, inter_dim 768, expert 129, topk 5),
one row per padded token from 1 to 32768 except 1024, where no candidate
beat the default tiles. Up to 512 tokens the rows use tile_m 16 or 32 with
narrow N tiles; from 2048 both GEMMs use tile_m 128 with 256x256 tiles.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Use fused_route_psum_remap on the gfx1250 TP MoE path

TP calls with no compact layout, EP or stage-2 scatter and at most
_FUSED_ROUTE_PSUM_MAX_NUMEL routes take the one-workgroup
moe_route_psum_fused kernel in place of the route counter zero-fill,
moe_route and moe_contiguous_psum_remap launches. The limit drops from 4096
to 2048 routes: the split launches catch up at about 2.5K on gfx1250. Adds
decode-shaped cases to test_route_psum_fused and an M3 TP decode case to
test_flydsl_grouped_gemm.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: lirui927 <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
zhiding512 added a commit that referenced this pull request Nov 4, 2026
No conflicts, but main changed code the deployment replay runs through:

- #7020: the MXFP4 inline sort takes num_local_tokens and skips expert
  ids outside [0, E), as the sentinel ids of EP callers are.
- #7067: the a16w4 stage-2 reduce mode in fused_moe.py and Kimi-K3's
  a16w4 table.
- #7068, #6668: gfx1250 grouped tables for DeepSeek-V4.1 MegaMoE EP and
  MiniMax-M3.
- #7055: the OPUS CO tests read local kernel IDs; this branch's 1-GPU CI
  shards failed on the global ones.

Co-authored-by: Cursor <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants