Skip to content

[Triton/Gluon] [Config] gfx950: tune gemm_a16w16 for kimik3/glm5/qwen3.5 model shapes - #7513

Merged
yanxuer-999 merged 3 commits into
ROCm:mainfrom
yanxuer-999:triton-gfx950-a16w16-model-shapes-retune
Nov 10, 2026
Merged

yanxuer-999 merged 3 commits into
ROCm:mainfrom
yanxuer-999:triton-gfx950-a16w16-model-shapes-retune

Conversation

@yanxuer-999

@yanxuer-999 yanxuer-999 commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds tuned gfx950 gemm_a16w16 configs for the kimik3, glm5 and qwen3.5 GEMM shapes in bench_gemm_model_shapes.py, plus the M ≤ 8 bucket of N=1280-K=8192. On MI350X they are 1.6–3.9× faster than the configs in use today.

Motivation

None of these (N, K) pairs had a tuned file except N=1280-K=8192, so they fell back to DEFAULT.json. That file's M_LEQ_32 and M_LEQ_256 buckets use num_warps 8 and waves_per_eu 6–8. That leaves 64–80 registers per lane, so the kernels spill 88–140 B of scratch per lane.

The spilling made them sensitive to compiler changes. After triton-lang/triton#12236 (LLVM bump to 18f9e623, which marks these kernels "amdgpu-agpr-alloc"="0"), the perf-daily CI flagged them 12–28% below their earlier numbers. The regression is still present on Triton main f8cddb94 (2026-11-05). The tuned configs don't spill at all, so they are fast on both the old and the new Triton.

Changes

  • 7 new files, each with "DEFAULT_FALLBACK": true and only the tuned bucket, so every other M keeps using DEFAULT.json:
    • M_LEQ_32: N=38720-K=6144, N=6144-K=3072, N=6144-K=4096, N=7168-K=4224, N=8192-K=4096
    • M_LEQ_256: N=7168-K=1536, N=7168-K=3584
  • GEMM-A16W16-N=1280-K=8192.json: only M_LEQ_8 changes.
  • The pattern in the tuned configs: num_warps 4 (was 8) and a lower waves_per_eu (0–4, was 6–8). For M ≤ 32 they use BLOCK_K 256; for M = 256 they use BM128 / BN64 / BK128. Scratch drops to 0 B. Changing num_warps alone is not enough: it makes the M = 256 shapes slower.

Performance

MI350X (gfx950), bf16, bias=True (as the benches use), Triton main f8cddb94, triton.testing.do_bench_cudagraph (median of 5), fresh Triton cache. "Before" is the config in use today (DEFAULT, or the old M_LEQ_8).

Hardware Workload (M×N×K) Before (TFLOPS) After (TFLOPS) Change
MI350X kimik3 256×7168×3584 186.9 515.1 2.76×
MI350X kimik3 256×7168×1536 182.2 486.8 2.67×
MI350X glm5 32×38720×6144 44.6 162.0 3.63×
MI350X qwen3.5-397b 32×8192×4096 45.7 164.3 3.59×
MI350X kimik3 32×7168×4224 38.0 147.4 3.88×
MI350X glm5 32×6144×3072 35.1 128.2 3.65×
MI350X glm5 24×6144×4096 29.4 102.5 3.48×
MI350X 1×1280×8192 1.18 1.84 1.55×

Other M values in the same buckets also improve: M = 2/4/8 (1.56×), M = 17/24 (3.1–3.6×), M = 129/192 (1.95–2.25×).

The same configs give the same results without bias, and on Triton 64ccfff9 (before #12236). Against that older Triton with the old configs, they are 2.0–3.7× faster.

Split-K path at M <= 8 (N=1280-K=8192, NUM_KSPLIT 2), base vs head. Same harness, latest main, bias. Each result matches an fp32 reference (max relative error 1.6e-3 to 2.8e-3, the same as base):

M x N x K Base (TFLOPS) Head (TFLOPS) Change
1x1280x8192 1.18 1.84 1.55x
2x1280x8192 2.30 3.61 1.57x
4x1280x8192 4.60 7.18 1.56x
8x1280x8192 9.15 14.28 1.56x

Testing

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

Documentation

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

Config-only change.

Dependencies

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

Breaking Changes

None.

PR Self-Review

Reviewed revision

1d724d2

Behavior and intent

Only the gfx950 Triton gemm_a16w16 config selection changes, for the eight (N, K) pairs and the buckets listed in "Changes". The previous configs (DEFAULT.json num_warps 8, waves_per_eu 6-8) spill 88-140 B of scratch per lane on these shapes. The tuned configs do not spill.

Validation and unverified scope

  • Search: 288-384 candidate configs per shape. Each candidate was checked against an fp32 reference. The winners were re-measured in a fresh container with and without bias, on Triton f8cddb94 and 64ccfff9.
  • Selection check: I resolved every (M, N, K) for all 43 gfx950 a16w16 (N, K) files in either tree x 33 values of M (1 to 16384) through get_gemm_config(), with the base configs (main 95c9ab3) and with this PR's configs. 1,419 combinations were checked and 34 changed, all of them intended:
    • M 1-8 for N=1280 K=8192;
    • M 17-32 for the five M_LEQ_32 files;
    • M 129-256 for the two M_LEQ_256 files.
  • Unit tests: AITER test_gemm_a16_w16 (bandwidth_bound and compute_bound) and test_gemm_a16_w16_layout (TT/NN/NT) on all 25 retuned (M, N, K): 100 passed. 25 were skipped: kernel_type only applies to the gluon backend.
  • any bucket: the second commit adds the any bucket (a copy of the DEFAULT.json any). DEFAULT_FALLBACK already served the same entry, so the selection does not change.
  • CI: the build_aiter_wheels failure on the first push was a Docker Hub 429 Too Many Requests while it pulled the base image. It is not related to this change.
  • Not verified:
    • gfx942 (these are gfx950-only files);
    • the full Triton test suite.

PR-specific question

Workload keys that consume the changes: GEMM-A16W16 on gfx950 Triton with

  • (N=1280, K=8192) at M <= 8;
  • (6144, 4096), (6144, 3072), (7168, 4224), (8192, 4096) and (38720, 6144) at 16 < M <= 32;
  • (7168, 3584) and (7168, 1536) at 128 < M <= 256.

Evidence that unrelated shapes keep their selection: the selection check above (34 of 1,419 changed, all intended). The new files use DEFAULT_FALLBACK with one tuned bucket, so every other M bucket comes from DEFAULT.json.

Changed op tests

None.

🤖 Generated with Claude Code

…3.5 model shapes

These shapes fall back to DEFAULT.json (num_warps 8, waves_per_eu 6-8), which
spills 88-140 B of scratch per lane. Since triton-lang/triton#12236 they run
12-28% below the earlier numbers. The tuned configs (num_warps 4, lower
waves_per_eu) do not spill, and are 1.6-3.9x faster on MI350X.

New files use DEFAULT_FALLBACK and hold only the tuned bucket;
GEMM-A16W16-N=1280-K=8192.json changes only M_LEQ_8.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

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

Extended tests (opt-in via labels):

Label Tests
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 gfx1201 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 7513 --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.

@aiter-bot

aiter-bot commented Nov 5, 2026 •

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision 83083b623ed7 · 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 — Reviewed revision must contain at least the first 7 characters of the current head SHA
  • FAIL — validation answer must explicitly state what remains unverified (or say none with a reason)

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

@yanxuer-999
yanxuer-999 marked this pull request as draft November 5, 2026 15:10
@Boss2002n
Boss2002n requested a balanced review from Copilot November 5, 2026 18:50

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

GPU correctness checks and base-versus-head latency measurements are missing for the gfx950 configs, especially the new NUM_KSPLIT=2 path for M ≤ 8.

No open issues 🎉

What changed in this PR

This PR tunes gfx950 configurations for AITER’s existing Triton gemm_a16w16 kernel. It targets kimik3, glm5, and qwen3.5 model shapes to reduce register spilling and improve performance without changing kernel code.

Changes:

  • Adds seven shape-specific configs with one tuned M bucket each and default fallback for other buckets.
  • Uses four warps and lower waves_per_eu values in the new configs.
  • Retunes the existing N=1280, K=8192 config’s M_LEQ_8 bucket, including increasing split-K to 2.
File Description
aiter/​ops/​triton/​configs/​gfx950/​triton/​gemm/​gemm_a16w16/​GEMM-A16W16-N=8192-K=4096.json Adds an M_LEQ_32 config for qwen3.5.
aiter/​ops/​triton/​configs/​gfx950/​triton/​gemm/​gemm_a16w16/​GEMM-A16W16-N=7168-K=4224.json Adds an M_LEQ_32 config for kimik3.
aiter/​ops/​triton/​configs/​gfx950/​triton/​gemm/​gemm_a16w16/​GEMM-A16W16-N=7168-K=3584.json Adds an M_LEQ_256 config for kimik3.
aiter/​ops/​triton/​configs/​gfx950/​triton/​gemm/​gemm_a16w16/​GEMM-A16W16-N=7168-K=1536.json Adds an M_LEQ_256 config for kimik3.
aiter/​ops/​triton/​configs/​gfx950/​triton/​gemm/​gemm_a16w16/​GEMM-A16W16-N=6144-K=4096.json Adds an M_LEQ_32 config for glm5.
aiter/​ops/​triton/​configs/​gfx950/​triton/​gemm/​gemm_a16w16/​GEMM-A16W16-N=6144-K=3072.json Adds an M_LEQ_32 config for glm5.
aiter/​ops/​triton/​configs/​gfx950/​triton/​gemm/​gemm_a16w16/​GEMM-A16W16-N=38720-K=6144.json Adds an M_LEQ_32 config for glm5.
aiter/​ops/​triton/​configs/​gfx950/​triton/​gemm/​gemm_a16w16/​GEMM-A16W16-N=1280-K=8192.json Updates block M, occupancy, and split-K settings for M_LEQ_8.

Review effort: Balanced

@yanxuer-999
yanxuer-999 marked this pull request as ready for review November 10, 2026 05:13
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