Skip to content

[FlyDSL] FlyDSL MoE RMSNorm Support - #6987

Merged
amirumoAMD merged 19 commits into
mainfrom
amemoore/rmsnorm-flydsl-moe-kernel
Dec 1, 2026
Merged

amirumoAMD merged 19 commits into
mainfrom
amemoore/rmsnorm-flydsl-moe-kernel

Conversation

@amirumoAMD

@amirumoAMD amirumoAMD commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

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:

  • Non-gfx1250 hardware. Not applicable; the feature is gfx1250-only.

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: adds test_grouped_a4w4_post_gemm2_rmsnorm_matches_torch_ref and a --post-gemm2-rmsnorm CLI flag. Runs the full grouped fused_moe path with the norm on and compares against torch_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 past num_valid_tokens unchanged.
    • test_mega_combine_post_rmsnorm: RMSNorm on padded, strided combine slots, then the combine reduce with route weights applied. Covers the new apply_route_weight path, which the end-to-end test does not reach.
    • op_tests/test_fhmoe.py ` new parameters were added that preexisting tests did not have, so CI failed. Modified to add new parameters so CI passes

@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 6987 --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.

@amirumoAMD
amirumoAMD marked this pull request as ready for review October 27, 2026 13:53
@amirumoAMD
amirumoAMD requested review from a team and scxiao October 27, 2026 13:53
@github-actions github-actions Bot changed the title FlyDSL MoE RMSNorm Support [FlyDSL] FlyDSL MoE RMSNorm Support Oct 27, 2026
@amirumoAMD

Copy link
Copy Markdown
Contributor Author

Took a moment and considered portability. Separate FlyDSL kernel is likely required. Adding and pushing separate kernel

Comment thread aiter/ops/flydsl/grouped_gemm_mxfp4.py Resolved
@lalala-sh

Copy link
Copy Markdown
Contributor

please free the conflicts. thx

@aiter-bot

aiter-bot commented Nov 7, 2026 •

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision 1f2529007ba6 · mode shadow

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

  1. What behavior does this PR change, and why is the existing behavior insufficient?
  2. What did you validate, and what remains unverified? Include commands, hardware/configuration and results.
  3. Which exact workload keys consume these configuration changes, and what evidence shows that unrelated shapes keep their previous selection?
  4. For every changed op_tests/ file, what behavior does it cover and why is it not redundant? Write None if no op test changed.

Edit the PR Self-Review section in the PR description. Include the current revision SHA; this comment refreshes automatically.

Missing or invalid answers

  • FAIL — Reviewed revision must contain at least the first 7 characters of the current head SHA

Shadow mode reports what would block but keeps the status successful. Set AITER_PR_SELF_REVIEW_MODE=enforce only after reviewing real false positives.

…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
@amirumoAMD
amirumoAMD requested a review from lalala-sh November 16, 2026 19:14
lalala-sh
lalala-sh approved these changes Nov 17, 2026 •

@lalala-sh lalala-sh 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.

please add AOT compile, refer to megamoe

lalala-sh
lalala-sh previously approved these changes Nov 17, 2026
@zufayu
zufayu requested review from coderfeli and yadaish November 17, 2026 13:26
lalala-sh
lalala-sh previously approved these changes Nov 18, 2026
@amirumoAMD
amirumoAMD requested a review from lalala-sh November 18, 2026 22:03
@amirumoAMD
amirumoAMD requested a review from yadaish November 24, 2026 03:25
Moore and others added 3 commits November 25, 2026 18:52

@lalala-sh lalala-sh 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

@amirumoAMD
amirumoAMD merged commit bafa492 into main Dec 1, 2026
91 of 100 checks passed
@amirumoAMD
amirumoAMD deleted the amemoore/rmsnorm-flydsl-moe-kernel branch December 1, 2026 03:40
@zufayu zufayu mentioned this pull request Dec 1, 2026
5 of 10 tasks
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