Repository navigation
[Triton/Gluon] Add gfx1250 RMSNorm forward kernel using TDM + LDS - #7841
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
NOT READY FOR HUMAN REVIEWPR Self-ReviewRevision Author self-review accepted. Readiness report: Author answers
Show the author's self-review answersBehavior and intentValidation and unverified scopePR-specific questionChanged op testsPR state
Copilot findings
Code and op-test hygiene
Required CI
Shadow mode reports what would block but keeps the status successful. Set |
e3ce92f to
ba3e0e9
Compare
Add a persistent, multi-buffered Gluon RMSNorm forward kernel that uses TDM async loads into LDS on gfx1250, dispatched from rms_norm. Launch 4 programs per CU on gfx1250 and add the missing rmsnorm_large_m_small_n config.
ba3e0e9 to
3636c54
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The new dispatch admits gfx1250-strict inputs that crash because the Gluon config is missing, while its pointer checks break torch.compile(fullgraph=True).
4 open issues
What changed in this PR
This PR adds a gfx1250 Gluon RMSNorm forward path that uses asynchronous TDM loads into shared memory to improve memory throughput.
Changes:
- Adds a persistent, multi-buffered kernel with alignment-based dispatch and Triton fallback.
- Adds Gluon tuning settings and the missing gfx1250 large-M/small-N Triton config.
- Increases gfx1250 Triton forward launch counts through a shared grid helper.
| File | Description |
|---|---|
aiter/ops/triton/normalization/rmsnorm.py |
Adds Gluon dispatch, config loading, and launch-grid changes. |
aiter/ops/triton/configs/gfx1250/triton/normalization/rmsnorm_large_m_small_n/DEFAULT.json |
Supplies missing large-M/small-N Triton settings. |
aiter/ops/triton/configs/gfx1250/gluon/normalization/rmsnorm/DEFAULT.json |
Defines width-based Gluon tuning settings. |
aiter/ops/triton/_gluon_kernels/gfx1250/normalization/rmsnorm.py |
Implements persistent RMSNorm with buffered TDM loads. |
Review effort: Balanced
…U change, compile-safe fallback, layout tests)



Summary
Add a Gluon RMSNorm forward kernel for gfx1250 (MI450) that uses TDM async loads into LDS. rms_norm now dispatches to it for all shapes that meet the TDM requirements. It also adds the missing gfx1250 config that was breaking 39 existing tests.
Motivation
On MI450 the Triton RMSNorm reaches only about 5–10 TB/s at large M and drops at large M and N, for example 8B at M=16384 gets 2.5 TB/s per vGPU in DPX. A persistent, multi-buffered kernel that streams rows through LDS with TDM keeps the memory system busy. Separately, test_rmsnorm.py had 39 failures on gfx1250 on main, because rmsnorm_large_m_small_n had no gfx1250 config.
Changes
Add _gluon_rms_norm_kernel in aiter/ops/triton/_gluon_kernels/gfx1250/normalization/rmsnorm.py:
persistent grid, with NUM_BUFFERS-deep TDM prefetch into LDS;
16-byte-per-lane coalesced layout;
writes rsigma per row.
Dispatch in _rmsnorm_forward (aiter/ops/triton/normalization/rmsnorm.py) to the Gluon kernel on gfx1250 only. gfx1250-strict stays on Triton because no strict Gluon config is shipped. It also falls back to Triton under torch.compile. It falls back to Triton when its requirements aren't met: unit stride on the last dim, 16B-aligned row pitch and base pointers, a contiguous weight, and a padded row of at most 64 KB.
Add the Gluon tuning config configs/gfx1250/gluon/normalization/rmsnorm/DEFAULT.json.
Add configs/gfx1250/triton/normalization/rmsnorm_large_m_small_n/DEFAULT.json (num_warps 8, num_stages 2). This fixes the 39 FileNotFoundError failures that were already on main.
Fused-add and quant variants are unchanged and still use Triton.
Add test_rmsnorm_non_default_layouts to test_rmsnorm.py (padded and unaligned row strides, misaligned x and weight base pointers).
Testing: test_rmsnorm.py gives 460 passed (413 before, with 39 failures on main). ruff==0.16.0 and black are clean.
Performance
bf16, bandwidth in GB/s, llama3 shapes. BS is M.
MI455: one process on the full GPU.
MI450-MC: DPX mode, with both vGPUs running the kernel at the same time. The values are the sum of the two vGPUs.
MC/455: MI450-MC divided by MI455.
Testing
Documentation
Dependencies
Breaking Changes
None
PR Self-Review
Reviewed revision
a548bc9
Behavior and intent
On gfx1250 (MI450), forward
rms_normnow runs a new Gluon kernel that streams rows through LDS with TDM async loads (persistent grid, multi-buffered prefetch, 16-byte-per-lane layout). It falls back to the existing Triton path when TDM requirements aren't met: unit inner stride, 16B-aligned row pitch and base pointers, a contiguous weight, and a padded row of at most 64 KB.The Triton kernel is not enough on MI450. It reaches about 5–10 TB/s at large M, and per-vGPU bandwidth drops at large M and N in DPX mode. For example, 8B at M=16384 gets about 2.5 TB/s per vGPU on main, against about 6.5 TB/s with this PR.
One supporting change: a
rmsnorm_large_m_small_nconfig for gfx1250 is added. It was missing, so those paths raisedFileNotFoundError.Nothing changes on other architectures, and the fused-add and quant variants still use Triton.
Validation and unverified scope
Validated on gfx1250 (MI450), restricted to one GPU:
HIP_VISIBLE_DEVICES=1 python -m pytest op_tests/triton_tests/normalization/test_rmsnorm.py -qgives 460 passed. Before the config was added it gave 413 passed and 39 failed, which also happens on main.ruff==0.16.0 checkandblack --checkare clean on the changed Python files.bench_rmsnorm.py --model allover llama3 shapes (N = 4096, 8192, 16384, M = 1 to 16384, bf16) on one process: geomean 1.17x over main, about 1.0x at M ≤ 256 and about 1.5x at M ≥ 512.Remains unverified:
gfx1250.gfx1250-strict, which falls back to Triton.torch.compile(fullgraph=True): the Gluon path is skipped under compile. The remaining fullgraph failure ("Only tuple grids are supported") comes from the existing Triton launch and also happens on main.PR-specific question
Which exact workload keys consume the configuration changes?
configs/gfx1250/gluon/normalization/rmsnorm/DEFAULT.jsonhas the keysN_LEQ_4096andany. It is read only by_rmsnorm_forward_gluon, usingselect_leq_configonnext_pow2(N). It applies only whenget_arch()isgfx1250,_use_gluon_rmsnormis true and the call is not being compiled.configs/gfx1250/triton/normalization/rmsnorm_large_m_small_n/DEFAULT.jsonis read viaget_normalization_config("rmsnorm_large_m_small_n", get_arch()). It applies when_should_use_large_m_small_nholds: M > 8192 with N ≤ 2048 for forward (rmsnorm_forward_inferenceand the with-add path), and M > 8192 with N ≤ 1024 for backward.Evidence that unrelated shapes keep their previous selection:
gfx1250/, and the lookup is keyed byget_arch(). Other architectures never read them.rmsnorm_large_m_small_nconfig, so those keys raisedFileNotFoundError. There was no earlier selection to preserve._use_gluon_rmsnormreturns False on every other arch, includinggfx1250-strict. There is no change to the Triton path on any arch.Changed op tests
op_tests/triton_tests/normalization/test_rmsnorm.py: addstest_rmsnorm_non_default_layouts(fp16 and bf16). It runs therms_normwrapper on inputs with a padded row stride, an unaligned row stride, a misalignedxbase pointer and a misaligned weight base pointer, and checks output,dxanddgagainst the torch reference. These are the layouts that decide between the Gluon path and the Triton fallback, and the existing tests only use contiguous aligned tensors, so they do not cover them.