Repository navigation
[Triton/Gluon] [Config] gfx950: tune gemm_a16w16 for kimik3/glm5/qwen3.5 model shapes - #7513
Conversation
…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]>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
WAITING ON AUTHORPR Self-ReviewRevision 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
Edit the Missing or invalid answers
Shadow mode reports what would block but keeps the status successful. Set |
There was a problem hiding this comment.
🔵 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_euvalues in the new configs. - Retunes the existing
N=1280, K=8192config’sM_LEQ_8bucket, 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
Summary
Adds tuned gfx950
gemm_a16w16configs for the kimik3, glm5 and qwen3.5 GEMM shapes inbench_gemm_model_shapes.py, plus the M ≤ 8 bucket ofN=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 toDEFAULT.json. That file'sM_LEQ_32andM_LEQ_256buckets usenum_warps8 andwaves_per_eu6–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 mainf8cddb94(2026-11-05). The tuned configs don't spill at all, so they are fast on both the old and the new Triton.Changes
"DEFAULT_FALLBACK": trueand only the tuned bucket, so every other M keeps usingDEFAULT.json:M_LEQ_32:N=38720-K=6144,N=6144-K=3072,N=6144-K=4096,N=7168-K=4224,N=8192-K=4096M_LEQ_256:N=7168-K=1536,N=7168-K=3584GEMM-A16W16-N=1280-K=8192.json: onlyM_LEQ_8changes.num_warps4 (was 8) and a lowerwaves_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. Changingnum_warpsalone is not enough: it makes the M = 256 shapes slower.Performance
MI350X (gfx950), bf16,
bias=True(as the benches use), Triton mainf8cddb94,triton.testing.do_bench_cudagraph(median of 5), fresh Triton cache. "Before" is the config in use today (DEFAULT, or the oldM_LEQ_8).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_KSPLIT2), 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):Testing
Documentation
Config-only change.
Dependencies
Breaking Changes
None.
PR Self-Review
Reviewed revision
1d724d2
Behavior and intent
Only the gfx950 Triton
gemm_a16w16config selection changes, for the eight (N, K) pairs and the buckets listed in "Changes". The previous configs (DEFAULT.jsonnum_warps8,waves_per_eu6-8) spill 88-140 B of scratch per lane on these shapes. The tuned configs do not spill.Validation and unverified scope
f8cddb94and64ccfff9.get_gemm_config(), with the base configs (main95c9ab3) and with this PR's configs. 1,419 combinations were checked and 34 changed, all of them intended:M_LEQ_32files;M_LEQ_256files.test_gemm_a16_w16(bandwidth_bound and compute_bound) andtest_gemm_a16_w16_layout(TT/NN/NT) on all 25 retuned (M, N, K): 100 passed. 25 were skipped:kernel_typeonly applies to the gluon backend.anybucket: the second commit adds theanybucket (a copy of theDEFAULT.jsonany).DEFAULT_FALLBACKalready served the same entry, so the selection does not change.build_aiter_wheelsfailure on the first push was a Docker Hub429 Too Many Requestswhile it pulled the base image. It is not related to this change.PR-specific question
Workload keys that consume the changes:
GEMM-A16W16on gfx950 Triton withEvidence that unrelated shapes keep their selection: the selection check above (34 of 1,419 changed, all intended). The new files use
DEFAULT_FALLBACKwith one tuned bucket, so every other M bucket comes fromDEFAULT.json.Changed op tests
None.
🤖 Generated with Claude Code