Repository navigation
[FlyDSL] FlyDSL MoE RMSNorm Support - #6987
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
|
Took a moment and considered portability. Separate FlyDSL kernel is likely required. Adding and pushing separate kernel |
|
please free the conflicts. thx |
WAITING ON AUTHORPR Self-ReviewRevision Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision. Questions to answer in the PR description
Edit the Missing or invalid answers
Shadow mode reports what would block but keeps the status successful. Set |
…sl-moe-kernel # Conflicts: # aiter/aot/flydsl/grouped_moe.py # aiter/fused_moe.py # aiter/ops/flydsl/grouped_gemm_mxfp4.py # aiter/ops/flydsl/grouped_moe_gfx1250.py # aiter/ops/flydsl/kernels/mega_moe_gfx1250/combine.py # aiter/ops/flydsl/kernels/mega_moe_gfx1250/mega_moe.py # aiter/ops/flydsl/kernels/mxfp4_preshuffle_gfx1250_tdm.py # op_tests/flydsl_tests/test_flydsl_grouped_gemm.py
9195557 to
8f56e47
Compare
…sl-moe-kernel # Conflicts: # aiter/fused_moe.py
Reviewed revision
a b 3 9 7 8 a 6 133544dc26e3b16366aff2bcc4745df0
Behavior and intent
Requested addition of RMSNorm to MoE kernel, to enable support for workflow of GEMM2 → RMSNorm → weighted reduction.
RMSNorm is applied to each route before being multiplied by the route's weight. Also added a zero-centred flag to support various types of weights. This norm must be available in MegaMoE and fused MoE. Later ask is for MXFP4 and MXFP8 support, not included in this PR.
Validation and unverified scope
Kernel tests (op_tests/test_flydsl_moe_aux.py)
test_rmsnorm_routed_rows
Compares against a torch reference using the same formula, bf16(x * g)
then x / sqrt(mean(x^2) + eps), within 2e-2.
Runs with zero_centered off and on.
Checks that padding rows, dropped routes (-1) and tokens past num_valid_tokens are left untouched.
Times eager and CUDA graph runs.
test_mega_combine_post_rmsnorm
Runs the MegaMoE combine with the norm on each slot followed by the route weighted reduce, against a torch reference, within 3e-2.
End to end (op_tests/flydsl_tests/test_flydsl_grouped_gemm.py)
test_grouped_a4w4_post_gemm2_rmsnorm_matches_torch_ref
Runs fused_moe a4w4 with the norm enabled against the torch MoE reference.
CLI flags --post-gemm2-rmsnorm none|normal|zero_centered and
--post-gemm2-rms-eps run the full sweep.
Model reference
The kernel output matched the Muse Spark row10 reference norm.
Performance
At 1 token the routed row norm adds about 2 us over norm off, versus about
30 us for normalizing the whole grouped buffer.
Unverified:
PR-specific question
This is a new feature for applying input-scale normalization for fused MoE and megamoe, with a zero-centred weight and normal weight.
Changed op tests
op_tests/flydsl_tests/test_flydsl_grouped_gemm.py: addstest_grouped_a4w4_post_gemm2_rmsnorm_matches_torch_refand a--post-gemm2-rmsnormCLI flag. Runs the full groupedfused_moepath with the norm on and compares againsttorch_moe_stage2. It reuses the existing harness; no other test checks this end to end.op_tests/test_flydsl_moe_aux.py: adds two tests.test_rmsnorm_routed_rows: the norm touches only mapped rows and leaves padding rows, dropped routes (-1), and tokens pastnum_valid_tokensunchanged.test_mega_combine_post_rmsnorm: RMSNorm on padded, strided combine slots, then the combine reduce with route weights applied. Covers the newapply_route_weightpath, which the end-to-end test does not reach.