Skip to content

[Triton/Gluon] Add gfx1250 RMSNorm forward kernel using TDM + LDS - #7841

Merged
azaidy merged 7 commits into
mainfrom
gfx1250-rmsnorm-gluon-tdm
Nov 24, 2026
Merged

azaidy merged 7 commits into
mainfrom
gfx1250-rmsnorm-gluon-tdm

Conversation

@NimitPtl

@NimitPtl NimitPtl commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

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.

Model BS MI455 main (GB/s) MI455 branch (GB/s) MI455 speedup MI450-MC main (GB/s, 2 vGPU sum) MI450-MC branch (GB/s, 2 vGPU sum) MI450-MC speedup MC/455 (main) MC/455 (branch)
llama3-8B 1 9.3 9.1 0.979x 5.8 5.6 0.966x 0.623 0.614
llama3-8B 2 19.0 18.8 0.991x 11.6 11.3 0.974x 0.611 0.600
llama3-8B 4 32.8 31.5 0.961x 23.0 22.7 0.987x 0.702 0.721
llama3-8B 8 65.6 63.4 0.965x 45.5 45.2 0.993x 0.693 0.713
llama3-8B 16 124.3 122.4 0.985x 90.4 90.0 0.996x 0.727 0.735
llama3-8B 32 225.2 222.6 0.988x 176.7 178.2 1.008x 0.785 0.801
llama3-8B 64 443.6 440.0 0.992x 339.0 353.0 1.041x 0.764 0.802
llama3-8B 128 846.4 857.0 1.013x 655.9 685.4 1.045x 0.775 0.800
llama3-8B 256 1,614.5 1,652.7 1.024x 1,242.2 1,307.1 1.052x 0.769 0.791
llama3-8B 512 2,631.3 3,171.5 1.205x 2,132.1 2,341.1 1.098x 0.810 0.738
llama3-8B 1024 3,613.1 5,298.4 1.466x 3,419.7 4,160.2 1.217x 0.946 0.785
llama3-8B 2048 4,477.1 8,087.7 1.806x 4,798.7 6,863.1 1.430x 1.072 0.849
llama3-8B 4096 5,085.4 11,156.8 2.194x 6,044.5 9,968.1 1.649x 1.189 0.893
llama3-8B 8192 5,373.0 13,090.4 2.436x 6,736.2 12,311.8 1.828x 1.254 0.941
llama3-8B 16384 5,614.7 14,482.7 2.579x 4,941.3 13,022.7 2.635x 0.880 0.899
llama3-8B geomean       1.278x     1.203x 0.821 0.773
llama3-70B 1 18.8 18.4 0.980x 11.2 11.2 1.000x 0.597 0.610
llama3-70B 2 37.7 37.0 0.983x 22.3 22.3 1.000x 0.591 0.602
llama3-70B 4 72.3 71.5 0.990x 44.0 44.1 1.002x 0.609 0.617
llama3-70B 8 121.0 118.5 0.980x 87.7 88.0 1.003x 0.725 0.742
llama3-70B 16 223.2 217.3 0.974x 174.5 174.6 1.001x 0.782 0.803
llama3-70B 32 433.2 438.3 1.012x 348.2 343.7 0.987x 0.804 0.784
llama3-70B 64 843.0 834.4 0.990x 679.7 673.0 0.990x 0.806 0.807
llama3-70B 128 1,641.7 1,634.7 0.996x 1,218.3 1,286.4 1.056x 0.742 0.787
llama3-70B 256 3,164.4 3,071.8 0.971x 2,225.6 2,320.1 1.042x 0.703 0.755
llama3-70B 512 4,590.1 5,273.6 1.149x 3,595.6 4,152.6 1.155x 0.783 0.787
llama3-70B 1024 5,878.2 7,480.2 1.273x 5,358.1 6,871.2 1.282x 0.912 0.919
llama3-70B 2048 6,949.3 10,425.5 1.500x 6,931.8 9,812.6 1.416x 0.997 0.941
llama3-70B 4096 7,698.1 12,565.8 1.632x 8,050.4 11,773.5 1.462x 1.046 0.937
llama3-70B 8192 8,158.6 13,807.6 1.692x 6,596.5 12,046.4 1.826x 0.809 0.872
llama3-70B 16384 8,440.6 14,430.2 1.710x 6,866.0 12,846.8 1.871x 0.813 0.890
llama3-70B geomean       1.159x     1.176x 0.771 0.782
llama3-405B 1 33.6 31.0 0.924x 21.6 21.1 0.977x 0.643 0.680
llama3-405B 2 70.0 61.8 0.882x 42.7 42.2 0.988x 0.610 0.683
llama3-405B 4 102.1 98.3 0.962x 85.1 84.1 0.988x 0.833 0.856
llama3-405B 8 211.0 198.7 0.942x 170.2 167.1 0.982x 0.807 0.841
llama3-405B 16 415.2 388.5 0.936x 341.5 331.7 0.971x 0.823 0.854
llama3-405B 32 806.2 784.2 0.973x 673.2 651.7 0.968x 0.835 0.831
llama3-405B 64 1,546.8 1,522.0 0.984x 1,282.0 1,263.8 0.986x 0.829 0.830
llama3-405B 128 2,829.0 2,798.5 0.989x 2,225.5 2,300.6 1.034x 0.787 0.822
llama3-405B 256 5,157.8 5,025.3 0.974x 3,831.5 4,064.7 1.061x 0.743 0.809
llama3-405B 512 6,827.6 7,541.7 1.105x 5,604.1 6,975.5 1.245x 0.821 0.925
llama3-405B 1024 8,289.3 10,424.2 1.258x 7,695.7 10,761.0 1.398x 0.928 1.032
llama3-405B 2048 9,593.0 12,662.6 1.320x 9,124.6 13,089.4 1.435x 0.951 1.034
llama3-405B 4096 9,841.8 14,400.5 1.463x 8,219.2 13,218.1 1.608x 0.835 0.918
llama3-405B 8192 10,291.5 15,046.2 1.462x 8,412.3 14,368.0 1.708x 0.817 0.955
llama3-405B 16384 10,619.7 15,173.2 1.429x 8,422.3 14,466.5 1.718x 0.793 0.953
llama3-405B geomean       1.089x     1.175x 0.799 0.862

Testing

  • Unit tests added or updated
  • Performance benchmarks run
  • Tested on MI450 (gfx1250), single process and DPX.

Documentation

  • No documentation change is needed, with the reason stated below

Dependencies

  • No new third-party dependencies added

Breaking Changes

None

PR Self-Review

Reviewed revision

a548bc9

Behavior and intent

On gfx1250 (MI450), forward rms_norm now 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_n config for gfx1250 is added. It was missing, so those paths raised FileNotFoundError.

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 -q gives 460 passed. Before the config was added it gave 413 passed and 39 failed, which also happens on main.
  • ruff==0.16.0 check and black --check are clean on the changed Python files.
  • bench_rmsnorm.py --model all over 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.
  • DPX (two vGPUs of one physical GPU, one process each, kernels running at the same time): geomean 1.19x over main, up to 2.64x per vGPU. Results are in the Performance section.

Remains unverified:

  • MI250X, MI300X and other architectures. The Gluon path is gated on gfx1250.
  • gfx1250-strict, which falls back to Triton.
  • Fused-add and quant variants, which are unchanged.
  • 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.
  • The Gluon config is tuned on one process on the whole GPU, not under DPX load.
  • The benchmark tables are from before the 4-programs-per-CU removal. Re-running M=4096 for the llama3 models twice on the final head gave results within 1% of the table, and that change only affected the Triton path. The other M values were not re-run.
  • Numerics are checked only by the test tolerances (1e-2 for fp16 and bf16).

PR-specific question

Which exact workload keys consume the configuration changes?

  1. configs/gfx1250/gluon/normalization/rmsnorm/DEFAULT.json has the keys N_LEQ_4096 and any. It is read only by _rmsnorm_forward_gluon, using select_leq_config on next_pow2(N). It applies only when get_arch() is gfx1250, _use_gluon_rmsnorm is true and the call is not being compiled.
  2. configs/gfx1250/triton/normalization/rmsnorm_large_m_small_n/DEFAULT.json is read via get_normalization_config("rmsnorm_large_m_small_n", get_arch()). It applies when _should_use_large_m_small_n holds: M > 8192 with N ≤ 2048 for forward (rmsnorm_forward_inference and the with-add path), and M > 8192 with N ≤ 1024 for backward.

Evidence that unrelated shapes keep their previous selection:

  • Both config files sit under gfx1250/, and the lookup is keyed by get_arch(). Other architectures never read them.
  • Before this change, gfx1250 had no rmsnorm_large_m_small_n config, so those keys raised FileNotFoundError. There was no earlier selection to preserve.
  • _use_gluon_rmsnorm returns False on every other arch, including gfx1250-strict. There is no change to the Triton path on any arch.

Changed op tests

op_tests/triton_tests/normalization/test_rmsnorm.py: adds test_rmsnorm_non_default_layouts (fp16 and bf16). It runs the rms_norm wrapper on inputs with a padded row stride, an unaligned row stride, a misaligned x base pointer and a misaligned weight base pointer, and checks output, dx and dg against 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.

@NimitPtl
NimitPtl requested a review from a team November 11, 2026 23:09
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter standard tests on MI35X
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:mi300x Run Aiter standard tests on MI300X in PRs; main branch always runs them
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 Radeon R9700 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 7841 --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.

Reviews:
A reviewer is usually assigned within one working day after the PR is ready for review (see Code Review Process). If nobody has responded for about a week, mention the area contact listed in CONTACTS.md. Want to help review? See REVIEWERS.md.

@aiter-bot

aiter-bot commented Nov 11, 2026 •

Copy link
Copy Markdown

NOT READY FOR HUMAN REVIEW

PR Self-Review

Revision a548bc94570e · mode shadow

Author self-review accepted. Readiness report:

Author answers

  • PASS — current-SHA answers are present and structurally specific
Show the author's self-review answers

Behavior and intent

On gfx1250 (MI450), forward `rms_norm` now 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_n` config for gfx1250 is added. It was missing, so those paths raised `FileNotFoundError`.

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 -q` gives 460 passed. Before the config was added it gave 413 passed and 39 failed, which also happens on main.
- `ruff==0.16.0 check` and `black --check` are clean on the changed Python files.
- `bench_rmsnorm.py --model all` over 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.
- DPX (two vGPUs of one physical GPU, one process each, kernels running at the same time): geomean 1.19x over main, up to 2.64x per vGPU. Results are in the Performance section.

**Remains unverified:**
- MI250X, MI300X and other architectures. The Gluon path is gated on `gfx1250`.
- `gfx1250-strict`, which falls back to Triton.
- Fused-add and quant variants, which are unchanged.
- `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.
- The Gluon config is tuned on one process on the whole GPU, not under DPX load.
- The benchmark tables are from before the 4-programs-per-CU removal. Re-running M=4096 for the llama3 models twice on the final head gave results within 1% of the table, and that change only affected the Triton path. The other M values were not re-run.
- Numerics are checked only by the test tolerances (1e-2 for fp16 and bf16).

PR-specific question

**Which exact workload keys consume the configuration changes?**

1. `configs/gfx1250/gluon/normalization/rmsnorm/DEFAULT.json` has the keys `N_LEQ_4096` and `any`. It is read only by `_rmsnorm_forward_gluon`, using `select_leq_config` on `next_pow2(N)`. It applies only when `get_arch()` is `gfx1250`, `_use_gluon_rmsnorm` is true and the call is not being compiled.
2. `configs/gfx1250/triton/normalization/rmsnorm_large_m_small_n/DEFAULT.json` is read via `get_normalization_config("rmsnorm_large_m_small_n", get_arch())`. It applies when `_should_use_large_m_small_n` holds: M > 8192 with N ≤ 2048 for forward (`rmsnorm_forward_inference` and the with-add path), and M > 8192 with N ≤ 1024 for backward.

**Evidence that unrelated shapes keep their previous selection:**
- Both config files sit under `gfx1250/`, and the lookup is keyed by `get_arch()`. Other architectures never read them.
- Before this change, gfx1250 had no `rmsnorm_large_m_small_n` config, so those keys raised `FileNotFoundError`. There was no earlier selection to preserve.
- `_use_gluon_rmsnorm` returns False on every other arch, including `gfx1250-strict`. There is no change to the Triton path on any arch.

Changed op tests

`op_tests/triton_tests/normalization/test_rmsnorm.py`: adds `test_rmsnorm_non_default_layouts` (fp16 and bf16). It runs the `rms_norm` wrapper on inputs with a padded row stride, an unaligned row stride, a misaligned `x` base pointer and a misaligned weight base pointer, and checks output, `dx` and `dg` against 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.

PR state

  • PASS — pull request is marked ready for review

Copilot findings

  • FAIL — an active Copilot finding has no substantive reply from the PR author
  • ADVISORY — Copilot did not review the current head SHA

Code and op-test hygiene

  • PASS — no committed artifact or conflict marker detected

Required CI

  • PASS — Black: passed
  • PASS — Ruff: passed
  • PASS — Repository dependency: passed
  • PASS — Aiter Test Gate: passed

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

@NimitPtl
NimitPtl force-pushed the gfx1250-rmsnorm-gluon-tdm branch 3 times, most recently from e3ce92f to ba3e0e9 Compare November 11, 2026 23:24
@NimitPtl
NimitPtl requested review from azaidy and scxiao November 11, 2026 23:26
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.
@NimitPtl
NimitPtl force-pushed the gfx1250-rmsnorm-gluon-tdm branch from ba3e0e9 to 3636c54 Compare November 11, 2026 23:34

Copilot AI 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.

🟡 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

@NimitPtl
NimitPtl requested a review from scxiao November 24, 2026 17:09

@azaidy azaidy 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!

@azaidy
azaidy merged commit 5c90446 into main Nov 24, 2026
71 of 72 checks passed
@azaidy
azaidy deleted the gfx1250-rmsnorm-gluon-tdm branch November 24, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants