Repository navigation
[Triton/Gluon] [Config] gfx1150: add gemm_a8w8_preshuffled configs (int8) - #7282
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 |
0c533e8 to
b7b57e1
Compare
gfx1150 had no gemm_a8w8_preshuffled config, so the wrapper failed. Add DEFAULT.json and the N=2112 K=7168 specialized file (as on gfx950), from a search on gfx1150 (Radeon 890M). int8 W8A8; 1.35x faster than the gfx1151 value used on gfx1150, 1.47x-4.03x faster than bf16. Co-Authored-By: Claude <[email protected]> Signed-off-by: Lin, KuanTing <[email protected]>
… = 32 after #5505 #5505 changed the tile remap of _gemm_a8w8_preshuffle_kernel from a hardcoded NUM_XCDS=8 to the device's XCD count (1 on gfx1150). The first values all had GROUP_SIZE_M 1 and became 1.15x-2.1x slower at M = 256 and M >= 1024. The re-search adds GROUP_SIZE_M 8; M_LEQ_8/16/32 keep the first values (re-search within 1%). Co-Authored-By: Claude <[email protected]> Signed-off-by: Lin, KuanTing <[email protected]>
b7b57e1 to
72df8c6
Compare
Summary
This PR adds the two gfx1150 configuration files of
gemm_a8w8_preshuffle, the A8W8 GEMM with a preshuffled weight (#6850). It changes no code.Motivation
gemm_a8w8_preshufflecannot run on gfx1150.get_gemm_configreads the file withrequired=False, then asserts on theNone:Every preshuffled test fails. A copy of the gfx1151 file would run, but its single
anyvalue is 2.61x slower.Changes
.../gemm_a8w8_preshuffled/DEFAULT.json: new. BucketsM_LEQ_8toM_LEQ_2048andany, the gfx950 bucket set..../GEMM-A8W8_PRESHUFFLED-N=2112-K=7168.json: new. Same buckets, for the shape that also has its own gfx950 file. It differs fromDEFAULT.jsonatM_LEQ_32,M_LEQ_64andM_LEQ_512only.The values are for int8: gfx1150 has no fp8 WMMA, so fp8 e4m3 compiles to
v_wmma_f32_16x16x16_f16instead of int8'sv_wmma_i32_16x16x16_iu8, and runs at 0.17x bf16F.linear(36 pairs, 0.052x to 0.440x).Performance (if applicable)
gemm_a8w8_preshuffle, int8 in, bf16 out, 9 (N, K) shapes x 11 M values = 99 pairsanyvalue, 2.31x bf16F.linear(geomean)With no gfx1150 "before" latency, two references replace it: the gfx1151
anyvalue (16 x 64 x 128, 4 warps) throughconfig=, and bf16F.linearthrough hipBLASLt. The 9 shapes are Llama-3-8B / Mistral-7B and Qwen2.5-7B linear layers plus 2112x7168 (second table); each row below is the 9 shapes at that M.F.linear(geomean)Over the 99 pairs: 2.61x the gfx1151 value (geomean), 1.14x minimum, 4.41x maximum, none below 1.00x. int8 beats bf16 at every pair, 2.31x geomean. Per shape:
F.linearWhat the second commit changes
It replaces the values above M = 32. The table divides the final value's speed by the first commit's.
M_LEQ_64M_LEQ_128M_LEQ_256M_LEQ_512M_LEQ_1024M_LEQ_2048anyM_LEQ_512is the one open point: the final value (32 x 64 x 256,GROUP_SIZE_M8) is 4% to 13% slower than the first commit's (128 x 64 x 128,GROUP_SIZE_M1) on all 9 shapes, in three measurements. The grid holds M = 512 alone here, so these 9 shapes are the whole bucket. The bucket still gains 3.60x againstmain. Consider a return to the first commit's value.Testing
op_tests/triton_tests/gemm/basic/test_gemm_a8w8.py, 1845 tests, on gfx1150 (Radeon 880M, 12 CU):892e5d003d)b7b57e1fa0)triton_shufflepreshuffle=Truepreshuffle=FalseNothing goes from passed to failed. Of the 712 base failures, 706 are the missing file; the other 6 are
torch.OutOfMemoryErrorat N = 106496, K = 16384, which needs a 6.5 GiB fp32 tensor. Those 6 move with run order (all fail alone on base, 5 of 6 alone on head, all pass inside the full head run), so they are this part's memory limit, not a property of this PR. No test file changes; the suite covers the new values through the same loader. MI250X and MI300X cannot read these files.Documentation
Tuning data only.
Dependencies
Breaking Changes
None.
PR Self-Review
Reviewed revision
5d89c18
Behavior and intent
The operation cannot run on gfx1150 today. After this PR it runs with a tuned value per M bucket, 2.61x faster than the nearest alternative, a copy of the gfx1151 file.
Validation and unverified scope
Hardware: gfx1150, Radeon 880M, 12 CU. Software: ROCm 10.1, torch 2.14.0, Triton 3.8.0, flydsl 0.5.0, performance level
high, one exclusive GPU lock per run. Trees: this branch atb7b57e1fa0against its parent892e5d003d, whichdiff -rshows differ by the two new files only; the branch now holds #5505, so kernel and values agree.Method:
pytest .../test_gemm_a8w8.py --junitxml=...per tree, plus-k "106496 and triton_shuffle"alone. Timing usesRotatingBufferBench, thebench_gemm_a8w8.pyharness, over a 256 MB pool, 7 alternating rounds per pair, median reported. Alternation leaves a 3.5% two-cycle oscillation on the short variant against 0.4% on the longer ones, so the ratios read slightly low. Two sweeps agree: median spread 0.53%, geomeans 2.609x and 2.600x, both 0 of 99 below 1.00x. Every shape passed an fp32 check first, maximum error 0.0032.Unverified:
M_LEQ_512is measured on one gfx1150 part only, and the regression above is open; no end-to-end workload; fp8 timed at four M values only; gfx1151 is #7270; Gluon needs gfx950.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 10 M buckets of
GEMM-A8W8_PRESHUFFLEDunderconfigs/gfx1150/, read only by_get_config(..., shuffle=True)forgemm_a8w8_preshufflewithbackend="triton". Both gfx1150 parts read this plain tree; agfx1150/<N>cu/tree would take priority, asgfx1250/96cushows, but none exists._get_configover the 9 shapes at the 11 M values above plus M = 8192 gives 108 pairs, and all 108 return the exact file values. No gfx1150 shape had a previous selection, because the lookup asserted for every one, so nothing can regress. Elsewhere the test table is the evidence: 582 split-Kpreshuffle=Falseand 171 other tests are unchanged.resolve_config_dirkeys ongcnArchName, so no other architecture reaches these files.Changed op tests
None.