Skip to content

[Config] [Perf] Tune gfx1250 grouped MoE for DeepSeek-V4.1 MegaMoE EP… - #7068

Merged
yhl-amd merged 4 commits into
mainfrom
wjx/dsv41-megamoe-grouped-fmoe-tune
Oct 28, 2026
Merged

yhl-amd merged 4 commits into
mainfrom
wjx/dsv41-megamoe-grouped-fmoe-tune

Conversation

@lalala-sh

@lalala-sh lalala-sh commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Add model_configs/dsv41_tuned_grouped_fmoe.csv: a4w4 (fp4 x fp4) grouped GEMM tiles for DeepSeek-V4.1 (hidden 5120, inter 2304, 384 experts, topk 6) at EP4 (96 experts per rank, tokens 4..32768) and EP2 (192 per rank, tokens 2..32768). The shape had no rows, so every bucket fell back to the untuned tile_m=64.

Tuned inside the MegaMoE fused pipeline (bench_mega_moe.py --combine fused), gating every candidate on its fp32-reference accuracy check. 40-layer per_layer_us, untuned -> tuned:
EP4 tpr 1: 92.2 -> 76.7, 64: 202.7 -> 187.8, 4096: 739.7 -> 654.1
EP2 tpr 1: 92.4 -> 73.5, 64: 285.5 -> 261.4, 4096: 738.5 -> 652.4

Technical Details

Test Plan

Test Result

Submission Checklist

…4/EP2

Add model_configs/dsv41_tuned_grouped_fmoe.csv: a4w4 (fp4 x fp4) grouped GEMM
tiles for DeepSeek-V4.1 (hidden 5120, inter 2304, 384 experts, topk 6) at EP4
(96 experts per rank, tokens 4..32768) and EP2 (192 per rank, tokens 2..32768).
The shape had no rows, so every bucket fell back to the untuned tile_m=64.

Tuned inside the MegaMoE fused pipeline (bench_mega_moe.py --combine fused),
gating every candidate on its fp32-reference accuracy check. 40-layer
per_layer_us, untuned -> tuned:
  EP4 tpr 1: 92.2 -> 76.7, 64: 202.7 -> 187.8, 4096: 739.7 -> 654.1
  EP2 tpr 1: 92.4 -> 73.5, 64: 285.5 -> 261.4, 4096: 738.5 -> 652.4
@lalala-sh
lalala-sh requested a review from a team October 28, 2026 05:40
@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 7068 --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.

…P4/EP2

DeepSeek-V4.1 runs its routed experts with MXFP8 activations (a8w4), so the
a4w4 rows alone never match the model. Add a8w4 rows for EP4 (96 experts per
rank, tokens 4..32768) and EP2 (192 per rank, tokens 2..32768), tuned the
same way in the MegaMoE fused pipeline with the fp32-reference accuracy gate,
and add the a_preshuffle column (0, as tuned) to match tuned_grouped_fmoe.csv.

40-layer per_layer_us on this branch, a8w4, untuned -> tuned:
  EP4 tpr 1: 93.9 -> 77.2, 256: 226.6 -> 211.9, 4096: 838.4 -> 735.0
  EP2 tpr 1: 91.8 -> 73.2, 256: 342.2 -> 302.6, 4096: 838.4 -> 766.3
coderfeli
coderfeli previously approved these changes Oct 28, 2026
Add a8w4 rows for EP8 (48 experts per rank, tokens 8..32768), tuned in the
MegaMoE fused pipeline with the fp32-reference accuracy gate. The rows were
measured on a 4-GPU node by emulating an EP8 rank: 192 global experts over 4
ranks keep 48 experts per rank, and the same tokens per rank keep the rows per
expert and the rows per rank of a real EP8 rank, so the grouped GEMM shapes
match; only the gemm2 scatter fans out to 4 peers instead of 8.

Best gemm1+gemm2+quant per layer against the untuned tile_m=64 default:
  token 8192: 195.7 -> 174.1 us, 16384: 310.9 -> 269.1, 32768: 540.5 -> 450.3
@yhl-amd
yhl-amd merged commit 11a9b4f into main Oct 28, 2026
54 checks passed
@yhl-amd
yhl-amd deleted the wjx/dsv41-megamoe-grouped-fmoe-tune branch October 28, 2026 13:59
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
#7068)

* [Config] [Perf] Tune gfx1250 grouped MoE for DeepSeek-V4.1 MegaMoE EP4/EP2

Add model_configs/dsv41_tuned_grouped_fmoe.csv: a4w4 (fp4 x fp4) grouped GEMM
tiles for DeepSeek-V4.1 (hidden 5120, inter 2304, 384 experts, topk 6) at EP4
(96 experts per rank, tokens 4..32768) and EP2 (192 per rank, tokens 2..32768).
The shape had no rows, so every bucket fell back to the untuned tile_m=64.

Tuned inside the MegaMoE fused pipeline (bench_mega_moe.py --combine fused),
gating every candidate on its fp32-reference accuracy check. 40-layer
per_layer_us, untuned -> tuned:
  EP4 tpr 1: 92.2 -> 76.7, 64: 202.7 -> 187.8, 4096: 739.7 -> 654.1
  EP2 tpr 1: 92.4 -> 73.5, 64: 285.5 -> 261.4, 4096: 738.5 -> 652.4

* [Config] [Perf] Add DeepSeek-V4.1 a8w4 grouped MoE rows for MegaMoE EP4/EP2

DeepSeek-V4.1 runs its routed experts with MXFP8 activations (a8w4), so the
a4w4 rows alone never match the model. Add a8w4 rows for EP4 (96 experts per
rank, tokens 4..32768) and EP2 (192 per rank, tokens 2..32768), tuned the
same way in the MegaMoE fused pipeline with the fp32-reference accuracy gate,
and add the a_preshuffle column (0, as tuned) to match tuned_grouped_fmoe.csv.

40-layer per_layer_us on this branch, a8w4, untuned -> tuned:
  EP4 tpr 1: 93.9 -> 77.2, 256: 226.6 -> 211.9, 4096: 838.4 -> 735.0
  EP2 tpr 1: 91.8 -> 73.2, 256: 342.2 -> 302.6, 4096: 838.4 -> 766.3

* [Config] [Perf] Add DeepSeek-V4.1 a8w4 grouped MoE rows for MegaMoE EP8

Add a8w4 rows for EP8 (48 experts per rank, tokens 8..32768), tuned in the
MegaMoE fused pipeline with the fp32-reference accuracy gate. The rows were
measured on a 4-GPU node by emulating an EP8 rank: 192 global experts over 4
ranks keep 48 experts per rank, and the same tokens per rank keep the rows per
expert and the rows per rank of a real EP8 rank, so the grouped GEMM shapes
match; only the gemm2 scatter fans out to 4 peers instead of 8.

Best gemm1+gemm2+quant per layer against the untuned tile_m=64 default:
  token 8192: 195.7 -> 174.1 us, 16384: 310.9 -> 269.1, 32768: 540.5 -> 450.3
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.

3 participants