Repository navigation
[Triton/Gluon] [Config] Add gemm_a8w8 Triton config for gfx1101 - #5960
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
|
@carlushuang, as offered, this adds the gfx1101 table for review. Measurements and the test method are in the description. |
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The table is hardware-specific, and its reported correctness and performance need final review on gfx1101.
Review effort: Balanced
Findings: None
What changed in this PR
Adds a gfx1101 tuning table so the Triton gemm_a8w8 config loader can find a default configuration on that GPU.
Changes:
- Adds configurations for four M-size bands, plus an
anyfallback. - Reuses the gfx1151 entry for the smallest band and fallback.
| File | Description |
|---|---|
aiter/ops/triton/configs/gfx1101/triton/gemm/gemm_a8w8/DEFAULT.json |
Supplies gfx1101 A8W8 GEMM tuning entries. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Signed-off-by: Martin Domanský <[email protected]>
72d94ee to
dd23ada
Compare
Address review on ROCm#5960: - Drop M_GEQ_1024 and move its entry to "any", so "any" is reachable and every M > 1024 is served the same entry as before. - Replace the gfx1151 entries (M_LEQ_128 and "any") with entries tuned on gfx1101: M_LEQ_64 and M_LEQ_128. - M_LEQ_512 and M_LEQ_1024 are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Martin Domanský <[email protected]>
…8216) The gfx1101 entries from #5960 and #5961 were tuned with Triton 3.8 and run slower with Triton 3.9. Five entries retuned with Triton 3.9 pass a check on shapes the search did not use (10 fresh processes, decision rule written before the run): - gemm_a8w8/DEFAULT.json: M_LEQ_512, any - gemm_a16w16 N=12288-K=3072: M_LEQ_4096 - gemm_a16w16 N=21504-K=3072: M_LEQ_8192 - gemm_a16w16 N=3072-K=12288: M_LEQ_4096 No other entry, file, kernel or loader changes.
Motivation
gemm_a8w8cannot run on gfx1101 (RDNA3, RX 7800 XT):configs/gfx1101/triton/gemm/gemm_a8w8/DEFAULT.jsondoes not exist, soget_gemm_configraisesAssertionError: Required config file doesn't exist(aiter/ops/triton/utils/gemm_config_utils.py:64-67). This PR adds that file, tuned on the card. Data only; no kernel, loader or test code is changed.Technical Details
One new file,
aiter/ops/triton/configs/gfx1101/triton/gemm/gemm_a8w8/DEFAULT.json, in the nested layout, with the same keys per entry as gfx1151's table. Every entry is tuned on gfx1101, and the bins form anM_LEQ_*ladder that ends inany:M_LEQ_64,M_LEQ_128M_LEQ_512M_LEQ_1024anyThe small-M bins are needed because the loader walks
M_LEQ_*upward (gemm_config_utils.py:99-104): without them, M ≤ 128 is served theM_LEQ_512entry (BLOCK_SIZE_M 128). That entry was slower on 29 of 31 small-M shapes, by 1.08× to 3.29×, and faster on two with M = 128 and N ≥ 3072. Against gfx1151'sanyentry, which the first version of this PR carried inM_LEQ_128, the small-M bins are faster on 26 of 31 small-M shapes and slower on 5 with M ≤ 64, by up to 1.38× with a warm cache. Both comparisons are GPU time over 10 fresh processes, as described below.For gfx1100, #4778 proposes an A8W8 table as
configs/gemm/gfx1100-GEMM-A8W8.json.Test Plan
Correctness uses the body of
test_gemm_int8(op_tests/triton_tests/gemm/basic/test_gemm_a8w8.py) withimpl="triton", layout TN, bf16 and fp16 output: upstream's inputs,run_torchreference andassert_close(atol=0.03, rtol=1e-2)(line 266). Shapes:get_x_vals()and the 14 shapes of the timing table below;any: 8192 × 8192 × 8192, 16384 × 16384 × 8192, 32768 × 8192 × 16384, 65536 × 4096 × 4096, and three whose N and K no BLOCK_SIZE divides: 1025 × 1000 × 1000, 3001 × 4097 × 1031 and 5000 × 129 × 72, where K = 72 is below every BLOCK_SIZE_K.pytest cannot run on this Windows host, so the test module was loaded with its
aiter.ops.shuffleimport stubbed, which is used only by the gfx950 preshuffle path and needs the CK build, and the body was called directly. The table was served throughget_gemm_config, and the served entry was checked for every shape.Test Result
132/132 correctness rows (66 shapes, bf16 and fp16) pass under this file, with no launch failure and no out-of-memory.
Timing through the loader, against gfx1151's table copied to gfx1101 (main has no gfx1101 table to compare with), GPU time only. Ten fresh processes, ten rounds each, arm order rotated from round to round.
ratiois gfx1151-table time over this PR's time, taken from each process's median; the table gives min, median and max over the processes after dropping the best and the worst.vs torchis the median over processes of torch bf16F.lineartime over this PR's time.anyanyanyanyanyanyanyanyM_LEQ_1024M_LEQ_1024M_LEQ_1024M_LEQ_512M_LEQ_512M_LEQ_128Every row has a minimum above 1.00 and a median − 1 above half the min–max range. A control with a flushed cache (256 MiB read before a one-call window, five further processes) keeps every win over gfx1151's table; 77 × 1280 × 2048 is below the timing floor with one call. Against torch bf16 the int8 kernel is 0.95–1.78× (median over processes); torch is ahead on four rows (0.95–1.00×) with a warm cache, and on two with a flushed cache. No claim over bf16 is made.
The first version of this description timed one call between two events. That window also held about 0.15 ms of host time in the Python wrapper, which compressed the ratios on short kernels and put the torch column below 1.00 there. The numbers above replace it.
Stack: gfx1101, Windows 11 native ROCm, display driver 32.0.32015.2008, torch
2.15.0a0+rocm10.2.0a20260926, HIP 7.17.26384, triton 3.8.0, AITERdd23adadwith the table under test; only this file differs from93b26ac0. The loader, kernel and test are byte-identical betweenf32a197dandmainat4eecc650.Measurement protocol
gemm_a8w8(..., config=None); every loader cache is cleared on a table switch, and the served entry is compared with the expected one.torch.cuda._sleep) queued before the window so the host finishes enqueuing before the GPU reaches it; this was checked for every window. Time per call is the window over ten. Hot cache, median per process and shape.Shared Usageat start 0.09 GiB.M_LEQ_512,M_LEQ_1024andanyentries come from a 288-candidate sweep overBLOCK_SIZE_M/N/K,GROUP_SIZE_M,num_warpsandwaves_per_euon AITER12620102with torch2.15.0a0+rocm10.1.0a20260909, screened on four shapes and verified on all 14. The small-M entries come from a sweep over the same parameters plusnum_stages1–2 andNUM_KSPLIT1–16 on the 20 small-M shapes at 1280 × 2048 and 10240 × 8192, followed by the fresh-process timing above. For M > 1024 the entry is64×128×128,GROUP_SIZE_M 1, 4 warps,waves_per_eu 2.