Skip to content

[Config] [Perf] Use waves_per_eu=2 a8w8 preshuffle GEMM kernels on ten gfx950 rows - #8423

Merged
yifehuan merged 1 commit into
mainfrom
perf/a8w8-bpreshuffle-waves2
Nov 23, 2026
Merged

yifehuan merged 1 commit into
mainfrom
perf/a8w8-bpreshuffle-waves2

Conversation

@jhinpan

@jhinpan jhinpan commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Ten tuned gfx950 rows of the a8w8 preshuffle GEMM tables switch from the 128x256x128 FlyDSL kernel with waves_per_eu 0 or 1 to the same kernel with waves_per_eu=2. With the pinned flydsl 0.5.0 these rows run 6 % to 33 % faster on MI355X.

Motivation

With flydsl 0.5.0, the kernels these rows name compile to 260 or 264 vector registers: LLVM's register allocator places one MFMA operand in AGPRs instead of using a free VGPR allocation. VGPRs and AGPRs share one 512-register file on gfx950, so above 256 the kernel runs one wave per SIMD instead of two. Nothing reports it: there is no spill and no warning.

8 of the ten rows now run 16 % to 46 % slower than the us their tuning run recorded. The M=32768, N=5120, K=1536 row records 253.5 us and runs at 359.7 us today. With waves_per_eu=2 LLVM keeps the kernel within 256 registers and it runs at 247.1 us.

That occupancy, and not the instructions, makes the difference is measured in ROCm/FlyDSL#1457, which fixes the cause in the compiler. This PR is the table-side change that takes effect with the flydsl version AITER pins today; the two do not depend on each other.

Changes

  • aiter/configs/a8w8_bpreshuffle_tuned_gemm.csv: 3 rows (N=5120, K=3200; M=8192, 16384, 32768).
  • aiter/configs/model_configs/a8w8_bpreshuffle_tuned_gemm_glm47.csv: 3 rows.
  • aiter/configs/model_configs/dsv3_a8w8_bpreshuffle_tuned_gemm.csv: 4 rows.
  • In each row only kernelName (the waves_per_eu token becomes 2) and kernelId (the id the new name already has in the same table, or in the tables of the same family) change. us, tflops and bw keep the values of the original tuning run.

Impact: the ten (M, N, K) rows below dispatch to a different specialization of the same kernel. No other row changes.

Performance (if applicable)

Hardware Workload/configuration Before After Change
MI355X (gfx950) a8w8 preshuffle GEMM, M=32768, N=7168, K=2048; 1x1x4x1 -> 1x2x4x1; registers 260 -> 254 627.3 us 420.2 us x0.670
MI355X (gfx950) a8w8 preshuffle GEMM, M=32768, N=3072, K=5120; 1x0x4x1 -> 1x2x4x1; registers 260 -> 254 624.4 us 420.5 us x0.673
MI355X (gfx950) a8w8 preshuffle GEMM, M=16384, N=5120, K=1536; 1x1x4x1 -> 1x2x4x1; registers 260 -> 254 180.4 us 122.1 us x0.677
MI355X (gfx950) a8w8 preshuffle GEMM, M=32768, N=3072, K=1536; 1x0x4x1 -> 1x2x4x1; registers 260 -> 254 215.8 us 147.0 us x0.678
MI355X (gfx950) a8w8 preshuffle GEMM, M=32768, N=5120, K=1536; 1x1x4x1 -> 1x2x4x1; registers 260 -> 254 359.7 us 247.1 us x0.687
MI355X (gfx950) a8w8 preshuffle GEMM, M=20480, N=3072, K=1536; 0x0x4x1 -> 0x2x4x1; registers 260 -> 254 124.2 us 95.3 us x0.767
MI355X (gfx950) a8w8 preshuffle GEMM, M=16384, N=6144, K=1536; 0x0x4x1 -> 0x2x4x1; registers 260 -> 254 188.3 us 147.2 us x0.784
MI355X (gfx950) a8w8 preshuffle GEMM, M=32768, N=5120, K=3200; 1x1x0x2 -> 1x2x0x2; registers 264 -> 256 568.2 us 499.8 us x0.879
MI355X (gfx950) a8w8 preshuffle GEMM, M=16384, N=5120, K=3200; 1x0x0x2 -> 1x2x0x2; registers 264 -> 256 235.4 us 219.1 us x0.932
MI355X (gfx950) a8w8 preshuffle GEMM, M=8192, N=5120, K=3200; 1x0x0x2 -> 1x2x0x2; registers 264 -> 256 117.7 us 111.2 us x0.944

One GPU verified idle and locked, flydsl 0.5.0, AITER 9569fb31a, one process per row, 21 rounds of batched launches interleaved with the old kernel and with an A/A control (A/A within 0.4 % on every row). Times are kernel times of the launch AITER dispatches to.

Testing

  • Unit tests added or updated
  • Performance benchmarks run
  • Tested on MI250X
  • Tested on MI300X

No test is added: the change is tuned-table rows only. MI250X and MI300X are not affected; every changed row is a gfx950 row.

Documentation

  • Docstrings updated
  • User guide updated
  • Performance guide updated
  • No documentation change is needed, with the reason stated below

Tuned-table rows only.

Dependencies

  • No new third-party dependencies added
  • New dependencies are listed and justified below

Breaking Changes

None.

PR Self-Review

Reviewed revision

2fa0635

Behavior and intent

Ten gfx950 rows name the waves_per_eu=2 specialization of the kernel they already use. The specialization they name today lost a wave per SIMD since it was tuned, which costs 6 % to 33 % on these rows.

Validation and unverified scope

  • Each row on MI355X as described under Performance: 10 of 10 rows match an fp32 reference (relative Frobenius error below 5e-3, output buffer pre-filled with a sentinel) and 10 of 10 are bitwise equal to the output of the old kernel.
  • Table lookup under AITER's dry run (aiter.aot.flydsl.gemm, compile-only): with the edited tables the ten (M, N, K) resolve to the new kernel names, with the original tables to the old ones.
  • Measured at 9569fb31a. The commits on main since then do not touch aiter/ops/flydsl/kernels/preshuffle_gemm.py, aiter/ops/flydsl/gemm_kernels.py, the three tables, or the flydsl pin.
  • Unverified: the rows were not re-tuned with the tuning script, so other candidates were not compared and us was not refreshed.
  • Unverified: end-to-end model timing, and whether gfx942 rows have the same problem.

PR-specific question

The keys are (gfx950, cu_num 256, M, N, K, torch.float8_e4m3fn) of the ten rows listed under Performance. get_GEMM_config_with_quant_type also answers an untuned M with the row of its padded M, so the rows are consumed by these M as well: N=3072, K=1536: M 16385 to 32768; N=3072, K=5120: M 16385 to 32768; N=5120, K=1536: M 16257 to 16384 and 32641 to 32768; N=5120, K=3200: M 4097 to 65536; N=6144, K=1536: M 16257 to 16384; N=7168, K=2048: M 32641 to 32768.

Unrelated shapes keep their selection: the diff changes kernelName and kernelId on ten lines and no key column. Resolving all 2,735 tuned gfx950 keys of the a8w8 preshuffle tables through get_GEMM_config_with_quant_type, once with the original and once with the edited tables, gives a different selection for exactly these 10 keys. Sweeping M from 1 to 65536 at the six (N, K) changes the selection only in the ranges above. At the lowest M of each range the new kernel takes x0.667 to x0.993 of the old kernel's time (10 points, each matching the fp32 reference and bitwise equal to the old output).

Changed op tests

None.

…n gfx950 rows

The 128x256x128 kernels these rows name compile to 260 or 264 registers
with flydsl 0.5.0: LLVM places one MFMA operand in AGPRs, and the kernel
runs one wave per SIMD instead of two. With waves_per_eu=2 the same kernel
stays within 256 registers.

Only kernelName and kernelId change. The us, tflops and bw columns keep
the values of the original tuning run.
@jhinpan
jhinpan requested a review from a team November 21, 2026 08:25
@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 8423 --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 21, 2026 •

Copy link
Copy Markdown

READY FOR HUMAN REVIEW

PR Self-Review

Revision 2fa0635502bb · 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

Ten gfx950 rows name the `waves_per_eu=2` specialization of the kernel they already use. The specialization they name today lost a wave per SIMD since it was tuned, which costs 6 % to 33 % on these rows.

Validation and unverified scope

- Each row on MI355X as described under Performance: 10 of 10 rows match an fp32 reference (relative Frobenius error below 5e-3, output buffer pre-filled with a sentinel) and 10 of 10 are bitwise equal to the output of the old kernel.
- Table lookup under AITER's dry run (`aiter.aot.flydsl.gemm`, compile-only): with the edited tables the ten (M, N, K) resolve to the new kernel names, with the original tables to the old ones.
- Measured at `9569fb31a`. The commits on main since then do not touch `aiter/ops/flydsl/kernels/preshuffle_gemm.py`, `aiter/ops/flydsl/gemm_kernels.py`, the three tables, or the flydsl pin.
- Unverified: the rows were not re-tuned with the tuning script, so other candidates were not compared and `us` was not refreshed.
- Unverified: end-to-end model timing, and whether gfx942 rows have the same problem.

PR-specific question

The keys are (gfx950, cu_num 256, M, N, K, `torch.float8_e4m3fn`) of the ten rows listed under Performance. `get_GEMM_config_with_quant_type` also answers an untuned M with the row of its padded M, so the rows are consumed by these M as well: N=3072, K=1536: M 16385 to 32768; N=3072, K=5120: M 16385 to 32768; N=5120, K=1536: M 16257 to 16384 and 32641 to 32768; N=5120, K=3200: M 4097 to 65536; N=6144, K=1536: M 16257 to 16384; N=7168, K=2048: M 32641 to 32768.

Unrelated shapes keep their selection: the diff changes `kernelName` and `kernelId` on ten lines and no key column. Resolving all 2,735 tuned gfx950 keys of the a8w8 preshuffle tables through `get_GEMM_config_with_quant_type`, once with the original and once with the edited tables, gives a different selection for exactly these 10 keys. Sweeping M from 1 to 65536 at the six (N, K) changes the selection only in the ranges above. At the lowest M of each range the new kernel takes x0.667 to x0.993 of the old kernel's time (10 points, each matching the fp32 reference and bitwise equal to the old output).

Changed op tests

None.

PR state

  • PASS — pull request is marked ready for review

Copilot findings

  • PASS — no active Copilot finding lacks a substantive author reply
  • 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.

@yifehuan yifehuan 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

@yifehuan
yifehuan merged commit 53f66b1 into main Nov 23, 2026
58 checks passed
@yifehuan
yifehuan deleted the perf/a8w8-bpreshuffle-waves2 branch November 23, 2026 10:00
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