Repository navigation
[Triton/Gluon] [Config] Tune the gfx1150 gemm_a16w16 DEFAULT.json - #7030
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
READY FOR HUMAN REVIEWPR Self-ReviewRevision Author self-review accepted. Readiness report: Author answers
Show the author's self-review answersBehavior and intentValidation and unverified scopePR-specific questionChanged op testsPR state
Copilot findings
Code and op-test hygiene
Required CI
Shadow mode reports what would block but keeps the status successful. Set |
There was a problem hiding this comment.
🔵 Needs a closer look
The shared gfx1150 defaults affect two unmeasured fused GEMM paths, requiring maintainer review of correctness and performance validation that cannot run in this environment.
No open issues 🎉
What changed in this PR
Replaces the gfx1150 gemm_a16w16 seed configuration with measured tuning values, without changing kernel code or public APIs. The reported benchmark shows a 1.56× geometric-mean throughput gain across 45 shapes, with two shape regressions.
Changes:
- Preserves the existing tile for M ≤ 64 and adds a retuned M ≤ 256 bucket.
- Lowers the middle bucket limit from 1024 to 512 and updates larger-M tiles.
- Removes the fallback
.cgcache modifier and reduceswaves_per_euto 1.
| File | Description |
|---|---|
aiter/ops/triton/configs/gfx1150/triton/gemm/gemm_a16w16/DEFAULT.json |
Retunes gfx1150 GEMM default tiles, bucket limits, and launch settings. |
Review effort: Balanced
…fx1150 The gfx1150 file has the values that #5997 copied from gfx1151. #6671 then replaced the gfx1151 values for M > 64, but not the gfx1150 values. This copies the current gfx1151 file to gfx1150. On gfx1150 (Radeon 890M), bf16 + bias, 37 shapes: geomean 1.59x faster than main; 36 of 37 shapes are the same or faster. Co-Authored-By: Claude <[email protected]>
…0 search A tile search on gfx1150 (Radeon 890M) replaced the copied gfx1151 values: - M_LEQ_256: 64x64x64, 2 warps (was 64x64x128, 4 warps). - Split M_LEQ_1024 at 512: M_LEQ_512 keeps 128x64x64; 512 < M <= 1024 uses the any tile, 128x128x64. Against main, 45 shapes: geomean 1.62x; 2 shapes are slower (768x1536x1536 0.88x, 640x3072x768 0.98x). Co-Authored-By: Claude <[email protected]>
52fc7a0 to
8acf207
Compare
There was a problem hiding this comment.
Note
Copilot was unable to run its full agentic suite in this review.
Copilot review overview
5 open issues
This config now relies on multiple size-threshold keys (M_LEQ_64/256/512). If the config selection… · New This config now relies on multiple size-threshold keys (M_LEQ_64/256/512). If the config selection… · New This config now relies on multiple size-threshold keys (M_LEQ_64/256/512). If the config selection… · New This config now relies on multiple size-threshold keys (M_LEQ_64/256/512). If the config selection… · New The default (“any”) bucket changes from using a cache modifier (previously \".cg\") to null and… · New
Review effort: Lite
|
No activity for 15 days, so this is now labelled |

Summary
The gfx1150
gemm_a16w16/DEFAULT.jsonis a seed. This PR replaces it with measured values. It changes one file. It changes no code.M_LEQ_64M_LEQ_256M_LEQ_512anyAll buckets use
GROUP_SIZE_M1,num_stages2,waves_per_eu1,matrix_instr_nonkdim16,cache_modifiernull andNUM_KSPLIT1. These are the keys of the family, asconfigs/AGENTS.mdrequires.Motivation
The gfx1150 file on
mainis a seed, and not a copy of a measured file. When 3da9a8d (#5997) added it,mainhad no gfx1151gemm_a16w16file. That commit says so: "Copy the gfx1151 table proposed in #4814 (head df9d0a8) byte-identical to gfx1150". #4814 never merged. The measured gfx1151 file arrived later, in #6671.configs/AGENTS.mdasks for measured values in place of a seed.The seed gives the same 32 x 16 x 256 tile to all M from 1 to 256. That tile is correct for M of 64 and below. Above 64 a larger tile is faster: the three M = 256 shapes give 2.34x, 2.41x and 2.67x. This PR does not establish the mechanism.
Relation to the gfx1151 file
Three of the four tiles have the values #6671 added to gfx1151:
M_LEQ_64M_LEQ_256M_LEQ_1024/M_LEQ_512anyThe search changed the tile in two M ranges only:
64 < M <= 256, and512 < M <= 1024through the new limit at 512. Elsewhere it confirmed the gfx1151 values. Of the 45 shapes below, 23 take the same tile from either file.Changes
gemm_a16w16/DEFAULT.json.M <= 256intoM_LEQ_64andM_LEQ_256.M_LEQ_1024bound to 512 and retune that bucket andany..cgcache modifier and setwaves_per_euto 1 inany.STANDARD_M_BOUNDScontains 64 and 512, soget_gemm_config()selects the new keys. The file sets noM_BOUNDS, and the kernel passes nobounds.Performance
gemm_a16w16, bf16, bias, no activation, layout TN, 45 shapesMeasured with this repository's own
bench_gemm_a16w16.py, on torch 2.14.0+rocm10.1.0 and Triton 3.8.0. One shape is one invocation of:Every TFLOPS number below is the output of that command. The benchmark computes it in
bench_gemm_fnat the base commit 66c8630:flops = 2.0 * M * N * K, thentflops = flops / ms * 1e-9, wheremsis the mean per-kernel latency fromdo_bench_aiter_triton— a rotating-buffer CUDA-graph benchmark, not a timing loop written for this PR. Its inputs come from the unit test's owngenerate_gemm_a16w16_inputs. Note thatmainhas since replaceddo_bench_aiter_tritonwithRotatingBufferBench.Per shape,
mainand this PR ran back to back withDEFAULT.jsonexchanged, over 3 runs; each number is the median of the 3. No shape was dropped for instability: the largest spread of a ratio across the 3 runs is 4.0%.One setting is not the default.
--graph-kernels-per-graphwas set per shape tomax(4, ceil(256 MB / per-set bytes)), and not to the default 1000. The default needs about 27 minutes for one measurement of the largest shape. In this tree that flag cannot shrink the rotating pool, because the pool size comes from--rot-bufs-target-mband the benchmark capturesmax(kernels_per_graph, pool_len)calls. The chosen value is exactlypool_len, so each graph makes one pass over the whole pool. Onmainthe flag does cap the pool, so this method does not carry over unchanged.A check against the default on 6 shapes gave a median difference of 0.8% and a largest of 5.6%. That check was one run against a median of 3, so it cannot separate the setting from run-to-run noise. The 5.6% shape is
600 x 1152 x 1152, which measures 2.76x here and 2.60x at the default.Bandwidth and roofline are not reported. This PR changes no kernel code, so there is no new kernel to put on a roofline.
--metric bandwidthgives bandwidth per shape for anyone who wants it.mainM_LEQ_64M_LEQ_256M_LEQ_512anyany512 is the largest
M_LEQ_key in the file, soanyserves every M above 512. The last two rows together are 28 shapes at geomean 1.61x. The table splits them at 1024 to show that the gain falls at the largest M.The 7 shapes with M of 64 and below resolve to an identical config from both files, so their true ratio is 1.00x. They measure 0.98x-1.01x, geomean 1.000x. That is the control. It bounds the error of a median of 3 runs at about 2%, and single runs are wider: the raw control ratios span 0.966x to 1.025x. One control shape,
16 x 4096 x 14336, is low in all 3 runs (0.98x), which looks like a small systematic bias rather than noise.Two shapes whose tile changed are slower than
mainin all 3 runs:mainBoth have a small K of 1536.
DEFAULT.jsonselects by M only, so one tile serves every N and K in a bucket; aGEMM-A16W16-N=...-K=...jsonfile can fix them.All 45 shapes. The two TFLOPS columns are the median of the 3 per-run values; `ratio` is the median of the 3 per-run ratios, so it does not always divide out of the two columns; `spread` is (max - min) / min of the 3 per-run ratios.
mainmainTesting
Test plan
On a gfx1150 host, first on
main, then with this PR:pytest op_tests/triton_tests/gemm/basic/test_gemm_a16w16.py \ -k "triton and not persistent and not atomic"Test result
Radeon 880M (gfx1150, 12 CU), torch 2.14.0+rocm10.1.0, Triton 3.8.0:
main(66c8630)Of the 541 skips, 361 are Gluon, which gfx1150 does not support. The other 180 are triton-backend cases that skip because
kernel_typeapplies only to Gluon. The Gluon cases are selected at all because-kmatches the whole test id, and the pathop_tests/triton_tests/containstriton.Both trees fail the same 4 tests, all
test_gemm_a16_w16_layout[bandwidth_bound-triton-{NT,TT}-{256,4096}-106496-16384], withAssertionError: Tensor-likes are not close!(0.1% of elements, infinite relative difference) — not out of memory. They fail onmaintoo, so this PR neither causes nor repairs them.Documentation
Dependencies
Breaking Changes
None. Only the selected tile changes, and only on gfx1150.
Not in this PR
GEMM-A16W16-N=...-K=...jsonfiles for gfx1150, which can fix the 2 slower shapes.PR Self-Review
Reviewed revision
9c5c025
Behavior and intent
On gfx1150,
gemm_a16w16selects a different tile for every M above 64. At 64 and below it is unchanged, and no other arch is affected. The current file is an unmeasured seed. Of the 38 measured shapes above M 64, this PR is faster on 35, slower on 2, and within the 2% control band on 1 (32760 x 1536 x 1536, 1.02x). The largest gain is 3.73x.Validation and unverified scope
Validated. The diff is 1 file, +22/-10.
get_gemm_config()was called for all 45 shapes with each file. It resolved togfx1150and returned the tiles in the tables above, including the full config for the 7 control shapes, which is identical from both files. Performance is 3 runs with the repository's ownbench_gemm_a16w16.py. Correctness is the pytest results above.git logon this path gives one gfx1150 commit, 3da9a8d (#5997). At that commit no gfx1151gemm_a16w16file existed, and the commit message names #4814 as the source. By blob hash, this PR's first commit is byte identical to #6671's gfx1151 file. The head differs from it in one tile and one limit.Unverified:
gfx1150covers more than one SKU and CU count, and every one of them reads this single file, so another gfx1150 part can rank two tiles differently. The part the search ran on was not measured here.main, not the rejected tiles, so no tile is confirmed best in its bucket.mainseed, but the first commit is byte identical to the gfx1151 file, so a plain copy would already give part of it.any.BLOCK_SIZE_M/N/K,cache_modifierandwaves_per_euall change in that bucket. The measurement compares the bucket as one unit. It does not isolate the contribution of the cache modifier or ofwaves_per_eu.--graph-kernels-per-graphis per shape. Its effect was checked on 6 shapes only, in one run against a median of 3, so it is bounded but not isolated from noise.fused_gemm_a16w16_mul_add.pyandfused_gemm_a16w16_quant_x.pyreadGEMM-A16W16too, so their tiles change on gfx1150. Neither was measured.op_benchmarks/triton/bench_moe_gemm_a8w8_blockscale.pyalso reads it, but it is a benchmark and ships nothing.PR-specific question
Which exact workload keys consume these configuration changes, and what evidence shows that unrelated shapes keep their previous selection?
The keys are the four M buckets of this one file:
M_LEQ_64,M_LEQ_256,M_LEQ_512andanyinconfigs/gfx1150/triton/gemm/gemm_a16w16/DEFAULT.json. One caller consumes them in the shipped path,_triton_kernels/gemm/basic/gemm_a16w16.py:189, throughget_gemm_config("GEMM-A16W16", M, N, K, backend="triton"). The two fused ops named above read the same name and therefore the same keys. Selection is by M alone: the folder holds noGEMM-A16W16-N=...-K=...json, so no shape has a per-shape entry, andis_tunedisFalsefor every M.Three scopes bound the change. The file is below
configs/gfx1150/, andresolve_config_dir()keys ongcnArchName, so no other arch reads it. The Gluon path passesbackend="gluon"and reads a different tree. The persistent and atomic variants readGEMM-A16W16-PERSISTENTandGEMM-A16W16-ATOMIC, which this PR does not touch.Inside the one scope that does change, the evidence is a direct comparison.
get_gemm_config()was called for all 45 shapes against themainfile and against this file, and the two results were compared field by field. The 7 shapes with M of 64 and below return an identical config from both files, covering every key of the family and not only the tile, so their selection is unchanged; they then measure 1.00x, which is the control. Every shape above M 64 returns a different config, which is the intent of the PR. The bucket bounds 64, 256 and 512 all come fromSTANDARD_M_BOUNDS, and the file sets noM_BOUNDS, so the loader walks the same bounds as before and no bucket boundary moves for a shape outside the ranges listed in "Changes".Changed op tests
None. No file below
op_tests/changes.🤖 Generated with Claude Code