Repository navigation
[Triton/Gluon] Muse fused kernel for rmsnorm + add + rmsnorm - #6343
Conversation
Keep the first norm, residual addition, and residual output in FP32. Round only the final pre-norm output to BF16. Register the callable for torch.compile and test BF16/FP32 residual inputs on gfx950.
Restrict the supported residual input to BF16, retain only the requested x shape and dtype assertions, and multiply both RMS sums by the host-computed inverse width. Gfx950 measurements show equivalent accuracy and eliminate two FP32 division sequences.
Keep the FP32 intermediate computation, write the residual sum to a caller-provided BF16 buffer, and return only the final BF16 norm. Test the output mutation under torch.compile.
Use a caller-provided BF16 final norm buffer when present and allocate one otherwise. Keep residual_out caller-owned and register the buffer-writing kernel as a torch custom op for safe compilation.
Remove the private custom op and fake implementation. The public wrapper handles optional output allocation and launches Triton directly; tests cover both output modes and compile-time launch branches.
Register a mutation-only inner custom op so framework fake tracing works without returning an aliased mutable input. Keep optional output allocation and return in the public wrapper.
Register the public AITER fusion directly with a fake implementation. Allocate the BF16 pre-norm return internally while retaining the caller-owned residual sum buffer.
This reverts commit 5c292ac.
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
|
There was a problem hiding this comment.
🟡 Changes recommended
Input validation, config-based tuning, kernel representation, and the required benchmark need to be addressed.
4 open findings
What changed in this PR
Adds a fused BF16 Muse-style RMSNorm → residual-add → RMSNorm Triton operation.
Changes:
- Adds the fused Triton kernel and public wrapper.
- Supports
torch.compilewith mutated residual output. - Adds correctness and compilation tests.
| File | Description |
|---|---|
aiter/ops/triton/normalization/fused_rmsnorm_add_rmsnorm.py |
Adds the public launcher and compile integration. |
aiter/ops/triton/_triton_kernels/normalization/fused_rmsnorm_add_rmsnorm.py |
Implements the fused kernel. |
op_tests/triton_tests/normalization/test_fused_rmsnorm_add_rmsnorm.py |
Tests numerical correctness and compilation. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
@aiter-bot review |
[ROCm/aiter] PR #6343 — [Triton/Gluon] Muse fused kernel for rmsnorm + add + rmsnormAdds a Muse-style fused Triton op that applies the post-attention RMSNorm, adds the residual into a caller-owned buffer, and applies the pre-FFN RMSNorm in one kernel launch, and lifts the rmsnorm math duplicated across the two existing fused-normalization kernels into a shared helper. Review (advisory):
|
|
Where that review came from — I ran the bot on your PR to show what it does. It is not an automatic hook; nothing reviews your PR unless somebody asks. Any reviewer on the aiter allowlist can ask for one, on any PR including their own. The trigger is a comment containing the words below — shown quoted here, because quoted lines deliberately do not trigger it:
Feedback on the review itself is welcome; it is how the rules get better. |



Add support for muse's fused rmsnorm + add + rmsnorm kernel. This brings the total kernel time to ~3us for con1 vs having two separate kernel calls of 3us each.