Skip to content

[Triton/Gluon] [Perf] [gfx1250] RMSNorm forward: 4 programs per CU - #7746

Draft
akao-amd wants to merge 8 commits into
ROCm:mainfrom
akao-amd:pr-gfx1250-rmsnorm-fwd-oversub
Draft

akao-amd wants to merge 8 commits into
ROCm:mainfrom
akao-amd:pr-gfx1250-rmsnorm-fwd-oversub

Conversation

@akao-amd

@akao-amd akao-amd commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

The generic Triton RMSNorm forward helper caps gfx1250 at one program per CU. This change reads PROGRAMS_PER_CU=4 and OVERSUB_MAX_BLOCK_SIZE=8192 from the gfx1250 and gfx1250-strict Triton configs. Eligible forward paths use min(M, 4 * CU_count) for blocks up to 8192 and retain min(M, CU_count) for larger blocks. gfx950 and other architectures retain their grids.

Upstream #7841 already handles eligible eager, aligned gfx1250 plain RMSNorm through a separate Gluon kernel/config: four programs/CU for blocks up to 4096, two above. This PR affects the remaining generic plain compile/layout fallback, gfx1250-strict, legacy fused-add, and smoothquant/dynamicquant with and without add. The separate normalization/fused_rmsnorm_add.py operation and large-M/small-N row-tiling path use their own grids.

On 96 CUs, affected paths cap at 384 programs for blocks<=8192; M<=96 keeps its grid, and M=97..383 uses M programs. Each kernel traverses rows with the program-count stride. Arithmetic, backward helpers and workspace allocation are unchanged; blocked backward cases may allocate M workspace rows.

This PR is independent of the unified-attention stack and merges main ecfa616d80a17b4030feccb18da47df59dbca720.

The base1130_v3 stack (MI450 gpt-oss measurements, December 1, 2026) carried an earlier version, 784ffa5e2, with hardcoded 4/8192. The shipped config preserves its grids; a CPU comparison found zero differences across 2,100 metadata cases. The stack's v1/v3 A/B contains the change in both arms and does not measure this PR alone. Upstream #7841 changes the current default plain wrapper's kernel relative to that older unit.

Earlier reports gave N2880/M7500 legacy fused-add on 96 CUs at 61.6 -> 31.6 us, serving +0.7% at 8k and +1.6% at 70k, and 8k TTFT about -2.5%. The original isolated measurement setup and wrapper provenance are unverified. Performance has not been re-measured on this head.

PR Self-Review

Reviewed revision

6b2368491c377086835c45d95bc527190c42bc63

Behavior and intent

Allow the remaining generic gfx1250/strict forward consumers to use up to four programs/CU for blocks<=8192, preserving the older unit's grid through per-architecture config. The separate upstream default Gluon path does not receive this scheduling change.

Validation and unverified scope

CPU command, with torch 2.12+ROCm 10.1 and Triton 3.8:

AITER_TRITON_ONLY=1 PYTHONPATH=. python3 op_tests/triton_tests/normalization/test_rmsnorm_config.py -v

Seven tests pass using real config loading and CPU launch recorders. Substituting main's actual helper causes 39 assertion failures. Black, Ruff and whitespace checks pass. These checks validate dispatch/grid behavior without GPU execution.

GPU setup: MI455X (gfx1250) 96-CU partition, image rocm/sgl-dev:v1.0.0-rocm101-mi45x-20261202, torch 2.12.0+rocm10.1.0, Triton 3.9.0. Main was compared with runtime revision 2cc019fc2092c56eb49ddeea4403025bcd085595; the reviewed head adds only the CPU test and has identical runtime/config files.

Public-wrapper parity passes 116/116 cases per arm: N2880/7168/8192/8193, M1000/7500/16000 and row boundaries, BF16/FP16, legacy fused-add/dynamicquant and fallback layouts. Actual eligible legacy grids change from 96 to 384, while small-M/large-block and upstream default controls retain their behavior.

pytest -q op_tests/triton_tests/normalization/test_rmsnorm.py op_tests/triton_tests/normalization/test_fused_rmsnorm_add.py

The initial full run passes 492 tests on head and 491 on main, with one main failure at test_rmsnorm_fused_add_dynamicquant[8192-65536-fp32-bf16]. Three alternating fresh-process repeats per arm all fail that node: 2,760–777,431 of 536,870,912 int8 elements differ, with maximum absolute differences 175–242 (allowed 1). All six launches use block32768 and grid96. This unchanged large-block path has a variable failure on both arms; the initial head pass does not establish a fix. Its nondeterminism mechanism remains unverified. Numerical parity for the affected block<=8192 matrix is supported; current performance remains unverified.

PR-specific question

The new keys are consumed only by num_programs_fwd for gfx1250/strict, through generic plain, legacy add and the four quant wrappers in normalization/rmsnorm.py. CPU tests pin M around 96/384, N around 8192, CU scaling, strict and other-architecture controls, upstream Gluon versus fallback, and backward/workspace behavior. The new config is separate from the Gluon table and the independent fused-add operation.

Changed op tests

test_rmsnorm_config.py checks real config resolution and public-wrapper dispatch with CPU launch recorders, including all five legacy add/quant consumers and the upstream default control. Numerical op tests can exercise upstream's default kernel without touching the changed helper; this test verifies the intended consumers and unrelated selections explicitly.

…n gfx950

num_programs_fwd capped the forward grid at one program per CU on every arch but
gfx950, so gpt-oss's prefill norms (N 2880, block 4096, 96-CU DPX partition) ran 96
programs for thousands of rows. 4 per CU (gfx950's factor; 8 and 16 are no better):

  rows   fused add + RMSNorm (us)   RMSNorm (us)
  1024        8.5 -> 5.3             7.0 -> 4.0
  4096       31.6 -> 15.8           22.1 -> 9.8
  7500       61.6 -> 31.6           43.6 -> 17.3
  16384     132.0 -> 69.1          106.6 -> 38.6

Rows below 96 are unchanged (grid = rows). Outputs bitwise equal (per-row math).
@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 7746 --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.

… comment.

The sibling normalization ops treat gfx1250 and gfx1250-strict as one target. The measurements now live in the PR description.
@akao-amd
akao-amd marked this pull request as ready for review November 11, 2026 09:07
@akao-amd
akao-amd requested a review from a team November 11, 2026 09:07
@github-actions github-actions Bot changed the title [Perf] [gfx1250] RMSNorm forward: 4 programs per CU [Triton/Gluon] [Perf] [gfx1250] RMSNorm forward: 4 programs per CU Nov 11, 2026
@aiter-bot

aiter-bot commented Nov 11, 2026 •

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision ca4308917cd7 · 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 — missing ### Reviewed revision in the PR description
  • FAIL — missing ### Behavior and intent in the PR description
  • FAIL — missing ### Validation and unverified scope in the PR description
  • FAIL — missing ### PR-specific question in the PR description
  • FAIL — missing ### Changed op tests in the PR description
  • FAIL — Reviewed revision must contain at least the first 7 characters of the current head SHA
  • FAIL — Behavior and intent has no substantive answer
  • FAIL — Validation and unverified scope has no substantive answer
  • FAIL — PR-specific question has no substantive answer

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

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.

🔵 Needs a closer look

The gfx1250 scheduling change needs GPU correctness and base-versus-head performance validation across all affected forward paths and block sizes up to 8192, but the review environment cannot run these checks and supplied timings cover only fused-add N=2880.

No open issues 🎉

What changed in this PR

Extends RMSNorm’s forward-grid optimization to gfx1250 and gfx1250-strict, matching the existing gfx950 behavior to improve utilization for large row counts.

Changes:

  • Allows up to four forward programs per CU for blocks up to 8192 on gfx1250 variants.
  • Leaves backward execution, workspace sizing, and other architectures unchanged.
File Description
aiter/​ops/​triton/​normalization/​rmsnorm.py Adds gfx1250 variants to the forward-grid oversubscription condition and updates its comment.

Review effort: Balanced

@zufayu
zufayu requested review from a team and Boss2002n November 12, 2026 01:12

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

Must fix before merge

  1. The grid size is a tuning value in Python (rmsnorm.py:58-65): the PR turns on fwd_program_oversub = 4 and the 8192 block cap for gfx1250, but tuning values belong in the JSON configs. The gfx1250 Gluon RMSNorm in the same file already reads PROGRAMS_PER_CU from its config. Fix: read both values from configs/gfx1250/triton/normalization/rmsnorm/DEFAULT.json (and a gfx1250-strict file) with get_normalization_config.

Nice to fix

  • Measure one N above 4096 (for example 7168) and one quant wrapper. Only N 2880 was measured, and the Gluon table for the same arch uses 2 per CU above 4096 (rmsnorm.py:58-65).
  • Remove the Co-Authored-By: Claude line from commit 17292da5 before merge.

or I am also okay to merge if we get the CI passing too

…ch config

Move PROGRAMS_PER_CU and OVERSUB_MAX_BLOCK_SIZE for gfx1250 and gfx1250-strict
out of num_programs_fwd into configs/<arch>/triton/normalization/rmsnorm.
gfx950 keeps its existing constants, so its grid is unchanged.
@akao-amd

Copy link
Copy Markdown
Contributor Author

Thanks for the review. The blocker is fixed in d8680089e:

  • num_programs_fwd now reads PROGRAMS_PER_CU and OVERSUB_MAX_BLOCK_SIZE from configs/gfx1250/triton/normalization/rmsnorm/DEFAULT.json, and from the matching gfx1250-strict file, through get_normalization_config.
  • gfx950 keeps its existing constants, so the MI355 grid does not change.
  • I compared the new grid with the previous code for gfx950, gfx1250, gfx1250-strict, gfx942 and gfx1100 across 700 shape and CU cases. There are no differences. That was a CPU check with stubbed torch and triton, so CI is the real test.

Still open:

  • The N=7168 and quant-wrapper measurements. These need a gfx1250 run.
  • The Co-Authored-By: Claude trailer on 17292da5 is still there. Removing it means rewriting that commit, which I haven't done.

@akao-amd
akao-amd force-pushed the pr-gfx1250-rmsnorm-fwd-oversub branch 2 times, most recently from 4ec298c to 25f9e43 Compare November 30, 2026 09:26
@akao-amd

Copy link
Copy Markdown
Contributor Author

@Boss2002n following up on the review:

  • The Co-Authored-By: Claude line is removed from the commit that carried it. The branch is force-pushed to 25f9e43fa. The tree is byte-identical to the previous head, so the diff under review has not changed.
  • I also removed two internal references from that commit message (a plan label and a cherry-pick line). This is the only commit message I edited.
  • My earlier comment on this PR said the trailer was still there. That is no longer true.

Still open from your review: measuring N=7168 and one quant wrapper on gfx1250. That needs a GPU run, and it is not done yet. The grid-constant fix from the blocker is in d8680089e and carried forward unchanged.

Boss2002n
Boss2002n previously approved these changes Dec 2, 2026
@akao-amd
akao-amd marked this pull request as draft December 3, 2026 02:38

This branch has not been deployed

No deployments
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.

4 participants