Repository navigation
[Triton/Gluon] gfx950: recover three regressions from the LLVM 18f9e623 bump - #7905
yanxuer-999 wants to merge 1 commit into
Conversation
…VM 18f9e623 bump The LLVM 18f9e623 bump in Triton (triton-lang/triton#12236) slowed three gfx950 cases that the perf-daily CI still reports. Each one now has a tuned launch config: - quant_fp8_blockwise, axis=1, block 128: 16 warps instead of 4, from a new gfx950 entry in configs/.../quant/quant_fp8_blockwise/DEFAULT.json. The bump added about 6% VALU work to this path. The other entry points keep their launch parameters: 16 warps make act_grad, requant and segment_m 33-80% slower. - gemm_a16w16 M<=8, N=32, K=4096 (GLM-5.3 GDN in_proj_ba at decode): the DEFAULT M_LEQ_8 tile (8 warps, waves_per_eu 8) spills; the tuned tile does not. - gemm_a8w8_blockscale M 129-256, N=1280, K=8192: the DEFAULT M_LEQ_256 tile launches only 10 programs; the tuned tile uses split-K 4. 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: Reviews: |
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.
🟡 Changes recommended
The launch-config cache ignores USE_LRU_CACHE=False, preventing later JSON edits from taking effect, and the new tuning configurations lack targeted test coverage.
4 open issues
What changed in this PR
This PR targets three gfx950 performance regressions after the LLVM bump by tuning existing AITER Triton kernels without changing public APIs.
Changes:
- Adds shape-specific GEMM configs for small a16w16 workloads and blockscale split-K execution.
- Adds a pinned launch config for axis-1 FP8 blockwise quantization.
- Routes the quantization wrapper through the shared config loader, retaining existing settings when no entry matches.
| File | Description |
|---|---|
aiter/ops/triton/quant/quant_fp8_blockwise.py |
Loads quantization launch settings by axis and block size. |
aiter/ops/triton/configs/gfx950/triton/quant/quant_fp8_blockwise/DEFAULT.json |
Pins the axis-1, block-128 launch settings. |
aiter/ops/triton/configs/gfx950/triton/gemm/gemm_a8w8_blockscale/GEMM-A8W8_BLOCKSCALE-N=1280-K=8192.json |
Tunes the M≤256 bucket with four-way split-K. |
aiter/ops/triton/configs/gfx950/triton/gemm/gemm_a16w16/GEMM-A16W16-N=32-K=4096.json |
Tunes the M≤8 bucket with a smaller, two-warp tile. |
Review effort: Balanced
| ) | ||
|
|
||
|
|
||
| @functools.cache |
| "BLOCK_SIZE_N": 16, | ||
| "BLOCK_SIZE_K": 256, | ||
| "GROUP_SIZE_M": 1, | ||
| "num_warps": 2, |
| "waves_per_eu": 2, | ||
| "matrix_instr_nonkdim": 16, | ||
| "cache_modifier": ".cg", | ||
| "NUM_KSPLIT": 4 |
| # common shapes (4096/8192 × 7168/8192); larger values hurt weight kernel. | ||
| num_warps = min(16, max(1, block_size * block_size // 4096)) | ||
| return {"num_warps": num_warps, "waves_per_eu": 2, "num_stages": 2} | ||
| params = {"num_warps": num_warps, "waves_per_eu": 2, "num_stages": 2} |
There was a problem hiding this comment.
Must fix before merge
- Resolve the merge conflicts with main in
quant_fp8_blockwise.py(wrapper): #8093 changed the same imports, helpers and launch call. If the launch call keeps main's_fnuz_quant_launch_params(), the new gfx950 table is never read, because that helper calls_launch_params(block_size)without a key. Fix: rebase, and pass the table key through that helper. - Measure the quant entry again on top of #8093 (DEFAULT.json): the 16-warp numbers were taken without #8093, which fixes the same slowdown. Also,
float8_e4m3fncalls switch to 16 warps, and the PR has no numbers for them. Fix: measure fnuz and e4m3fn again, and keep the entry only where it is faster (or add the dtype to the key). Another option is to move the quant part to its own PR, so that the two GEMM files can merge now.
Nice to fix
- Reply to the four Copilot comments- they seem to be valid.


Summary
This PR adds tuned gfx950 launch configs for the three cases that the AITER perf-daily CI still reports as slower since the LLVM 18f9e623 bump in Triton (triton-lang/triton#12236, tracked in AMD-Triton/triton-tickets#2129). After the change, each case is faster than it was before the bump.
Motivation
The perf-daily CI on MI350X has three open alerts with culprit triton#12236 (gap against the night before the bump, latest night #70):
gemm_a16w16GLM-5.3 GDNin_proj_baat decode, M=4 N=32 K=4096quant_fp8_blockwiseaxis=1, 5 shapesgemm_a8w8_blockscale256x1280x8192Causes, from the compiled kernels:
DEFAULT.jsonM_LEQ_8tile (8 warps,waves_per_eu8) leaves 64 registers per lane and spills. The bump made it spill more (scratch 68 B -> 92 B).DEFAULT.jsonM_LEQ_256tile (BM256 x BN128) launches only 10 programs for M=256, N=1280. The kernel does not spill. It is latency-bound, so register-allocation changes in the bump moved its time.Changes
configs/gfx950/triton/gemm/gemm_a16w16/GEMM-A16W16-N=32-K=4096.json(new,DEFAULT_FALLBACK):M_LEQ_8= BM16 BN16 BK256, 2 warps, 3 stages,waves_per_eu0.anyis a copy of theDEFAULT.jsonany.configs/gfx950/triton/gemm/gemm_a8w8_blockscale/GEMM-A8W8_BLOCKSCALE-N=1280-K=8192.json(new,DEFAULT_FALLBACK):M_LEQ_256= BM128 BN64 BK128, 4 warps, 3 stages,waves_per_eu2,NUM_KSPLIT4.anyis a copy of theDEFAULT.jsonany.configs/gfx950/triton/quant/quant_fp8_blockwise/DEFAULT.json(new): one pinned entry,quant_fp8_blockwise_axis1_block128= 16 warps, 2 stages,waves_per_eu2.quant/quant_fp8_blockwise.py:quant_fp8_blockwise()reads its launch parameters throughget_tuned_kernel_config(), keyed by axis and block size. When no entry exists (other archs, axis 0, other block sizes), the fallback is the current Python values. The other four entry points (for_weight,for_act_grad,requant_row_to_col,segment_m) do not change. With 16 warps,act_grad,requantandsegment_mare 33-80% slower on gfx950.Performance
MI350X (gfx950), Triton main
4a7b73ca(2026-11-11). GPU kernel time per call fromrocprofv3 --kernel-trace: the median of 30 calls, including the split-K reduce kernel. Base ismain37da1db. Two runs; the table shows run 2.Against Triton
64ccfff9(the commit before the bump) with the old configs, the new configs are faster on all three cases. A2: 28.7 us -> 5.4 us. A13: 127.1 us -> 21.1 us. A4 8192x7168: 87.9 us -> about 80 us.Unchanged neighbours (head vs base, two runs): gemm_a16w16 M=16 +0.0%; gemm_a8w8_blockscale M=64 -0.9%/-0.4% and M=512 -0.2%/+0.2%; quant axis=0, weight, act_grad, requant and segment_m are within the run-to-run noise of this machine (mostly within 1%, up to about 10% on single shapes in one run; their launch parameters are identical).
Testing
Documentation
The change is config values and the config lookup of one wrapper.
Dependencies
Breaking Changes
None.
PR Self-Review
Reviewed revision
4c418cb
Behavior and intent
On gfx950, three cases get new launch configs:
gemm_a16w16with N=32 K=4096 for M <= 8,gemm_a8w8_blockscalewith N=1280 K=8192 for 128 < M <= 256, andquant_fp8_blockwise(axis=1, block_size=128). Every other shape, bucket, arch and quant entry point resolves to the same launch parameters as before. The previous configs spill (A2), leave the GPU mostly idle (A13), or do not hide extra VALU work from the LLVM bump (A4).Validation and unverified scope
Search: kernel-trace sweeps on Triton main
4a7b73ca. A2: 361 configs. A13: 577 configs (24 exceeded LDS). A4: 61 launch settings x 5 shapes, with output bit-identical to the current settings.Configs:
utils/_triton/tuning/verify_configs.py --expect-tunedserves the new files:gemm_a16w16M=1/2/4/8 N=32 K=4096,gemm_a8w8_blockscaleM=129/192/256 N=1280 K=8192.Unit tests (all pass):
op_tests/triton_tests/quant/test_quant_fp8_blockwise.py, plustest_gemm_a16_w16/test_gemm_a16_w16_layouton M=1/2/4/8 x32x4096 andtest_gemm(gemm_a8w8_blockscale, TN/TT/NN/NT, output True/False) on M=129/192/256 x1280x8192. 62 passed.Format:
black --checkandruff checkpass on the changed Python file.Not verified:
The test machine had sporadic multi-millisecond kernel stalls from another workload, so all timings use the median of kernel-trace durations. CUDA-event and CUDA-graph timing were not reliable on it.
PR-specific question
Workload keys that consume the changes:
GEMM-A16W16with N=32, K=4096, M <= 8 (bucketM_LEQ_8);GEMM-A8W8_BLOCKSCALEwith N=1280, K=8192, 128 < M <= 256 (bucketM_LEQ_256);QUANT_FP8_BLOCKWISEentryquant_fp8_blockwise_axis1_block128.Evidence that other selections keep their previous values:
DEFAULT_FALLBACKwith one tuned bucket. Theiranyis theDEFAULT.jsonany.axis1_block128have no JSON entry, soget_tuned_kernel_config()returns the fallback, which is the current Python value.Changed op tests
None.
🤖 Generated with Claude Code