Repository navigation
[HIP] [MoE] Qwen3.8 TP=8 MXFP4 MoE aux kernel codegen - #6468
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
Resolve the MXFP4 MoE aux shape list conflicts in aiter/ops/moe_mxfp4_aux.py and csrc/kernels/mxfp4_moe/moe_aux/codegen/gen_instances.py by keeping the union: main's Qwen3.8 TP=8 (513, 8192, 256, 11) from #6468 and the GLM-5.3-Flash TP=2/4/8 shapes from #6435, plus this PR's Qwen3.8-Flash-Next TP=1 (513, 2560, 768, 11). Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
Add the shape (NE=513, H=8192, D_INTER=256, TOPK=11) to the MXFP4 MoE aux kernel codegen list and the Python supported-shape set, so Qwen3.8 2.4T at TP8 has codegen'd aux instances.
Motivation
Target model: Qwen3.8 2.4T, TP8 (512 routed + 1 shared expert, hidden 8192, topk 11, D_INTER 256 per rank).
Online fmoeTuner logged:
aux_findusesAITER_CHECK, so a missing key aborts the process. 8 of 376 tuning tasks failed. All 8 are layout-v2 stage2 scatter candidates (flydsl_moe2_layout_afp4_wfp4_bf16_t128x{128,256}x{128,256}_scatter[_nt]_sbm128, blockM=128), which callaiter.mxfp4_moe_scatter_reduce(..., MB=128)after GEMM2. The link between the missing key and these 8 failures is inferred from the call path; it has not been confirmed by rerunning the tuner.Changes
csrc/kernels/mxfp4_moe/moe_aux/codegen/gen_instances.py: add(513, 8192, 256, 11)toSHAPES.aiter/ops/moe_mxfp4_aux.py: add(513, 8192, 256, 11)toMXFP4_MOE_SUPPORTED_SHAPES.The two lists must stay synchronized.
Testing
Run on gfx950 with
ENABLE_CK=0andAITER_REBUILD=1(a stale module.sois otherwise reused).aux_scatterandaux_scatterqH8192_TOPK11_NT{0,1}all resolve, and a direct MB=128 call returns normally.mxfp4_moe_scatter_reduceverified against a torch reference at NE=513, H=8192, TOPK=11 for MB in {64, 128}, M in {1, 64, 1024, 8192}, with and without 25% EP-remote (-1) slots: 16/16 pass. Max abs error is 0 to 0.031 on outputs of magnitude ~10 (bf16 rounding and summation order). No LDS or launch failure. Thescatter_reduce_qvariant was not tested.op_tests/test_moe_2stage.pywithAITER_SITUV2_A4W4=1,-dim 8192,256 -e 513 -k 11 -t 64 1024 8192: exit 0, no abort or NaN, logits_diff 1.3e-4 to 1.4e-4 (warn threshold 1e-3). These configs use atomic/reduce stage2 epilogues, so they exercise sort/quant/sort_scales but not scatter.Test Results
Correctness tests pass.
Submission Checklist