Repository navigation
[Config] [Perf] Tune gfx1250 grouped MoE for DeepSeek-V4.1 MegaMoE EP… - #7068
Conversation
…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
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
…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
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
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]>
#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
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]>
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