Repository navigation
[Config] [Perf] Use waves_per_eu=2 a8w8 preshuffle GEMM kernels on ten gfx950 rows - #8423
Conversation
…n gfx950 rows The 128x256x128 kernels these rows name compile to 260 or 264 registers with flydsl 0.5.0: LLVM places one MFMA operand in AGPRs, and the kernel runs one wave per SIMD instead of two. With waves_per_eu=2 the same kernel stays within 256 registers. Only kernelName and kernelId change. The us, tflops and bw columns keep the values of the original tuning run.
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
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 |
Summary
Ten tuned gfx950 rows of the a8w8 preshuffle GEMM tables switch from the
128x256x128FlyDSL kernel withwaves_per_eu0 or 1 to the same kernel withwaves_per_eu=2. With the pinned flydsl 0.5.0 these rows run 6 % to 33 % faster on MI355X.Motivation
With flydsl 0.5.0, the kernels these rows name compile to 260 or 264 vector registers: LLVM's register allocator places one MFMA operand in AGPRs instead of using a free VGPR allocation. VGPRs and AGPRs share one 512-register file on gfx950, so above 256 the kernel runs one wave per SIMD instead of two. Nothing reports it: there is no spill and no warning.
8 of the ten rows now run 16 % to 46 % slower than the
ustheir tuning run recorded. The M=32768, N=5120, K=1536 row records 253.5 us and runs at 359.7 us today. Withwaves_per_eu=2LLVM keeps the kernel within 256 registers and it runs at 247.1 us.That occupancy, and not the instructions, makes the difference is measured in ROCm/FlyDSL#1457, which fixes the cause in the compiler. This PR is the table-side change that takes effect with the flydsl version AITER pins today; the two do not depend on each other.
Changes
aiter/configs/a8w8_bpreshuffle_tuned_gemm.csv: 3 rows (N=5120, K=3200; M=8192, 16384, 32768).aiter/configs/model_configs/a8w8_bpreshuffle_tuned_gemm_glm47.csv: 3 rows.aiter/configs/model_configs/dsv3_a8w8_bpreshuffle_tuned_gemm.csv: 4 rows.kernelName(thewaves_per_eutoken becomes 2) andkernelId(the id the new name already has in the same table, or in the tables of the same family) change.us,tflopsandbwkeep the values of the original tuning run.Impact: the ten (M, N, K) rows below dispatch to a different specialization of the same kernel. No other row changes.
Performance (if applicable)
1x1x4x1->1x2x4x1; registers 260 -> 2541x0x4x1->1x2x4x1; registers 260 -> 2541x1x4x1->1x2x4x1; registers 260 -> 2541x0x4x1->1x2x4x1; registers 260 -> 2541x1x4x1->1x2x4x1; registers 260 -> 2540x0x4x1->0x2x4x1; registers 260 -> 2540x0x4x1->0x2x4x1; registers 260 -> 2541x1x0x2->1x2x0x2; registers 264 -> 2561x0x0x2->1x2x0x2; registers 264 -> 2561x0x0x2->1x2x0x2; registers 264 -> 256One GPU verified idle and locked, flydsl 0.5.0, AITER
9569fb31a, one process per row, 21 rounds of batched launches interleaved with the old kernel and with an A/A control (A/A within 0.4 % on every row). Times are kernel times of the launch AITER dispatches to.Testing
No test is added: the change is tuned-table rows only. MI250X and MI300X are not affected; every changed row is a gfx950 row.
Documentation
Tuned-table rows only.
Dependencies
Breaking Changes
None.
PR Self-Review
Reviewed revision
2fa0635
Behavior and intent
Ten gfx950 rows name the
waves_per_eu=2specialization of the kernel they already use. The specialization they name today lost a wave per SIMD since it was tuned, which costs 6 % to 33 % on these rows.Validation and unverified scope
aiter.aot.flydsl.gemm, compile-only): with the edited tables the ten (M, N, K) resolve to the new kernel names, with the original tables to the old ones.9569fb31a. The commits on main since then do not touchaiter/ops/flydsl/kernels/preshuffle_gemm.py,aiter/ops/flydsl/gemm_kernels.py, the three tables, or the flydsl pin.uswas not refreshed.PR-specific question
The keys are (gfx950, cu_num 256, M, N, K,
torch.float8_e4m3fn) of the ten rows listed under Performance.get_GEMM_config_with_quant_typealso answers an untuned M with the row of its padded M, so the rows are consumed by these M as well: N=3072, K=1536: M 16385 to 32768; N=3072, K=5120: M 16385 to 32768; N=5120, K=1536: M 16257 to 16384 and 32641 to 32768; N=5120, K=3200: M 4097 to 65536; N=6144, K=1536: M 16257 to 16384; N=7168, K=2048: M 32641 to 32768.Unrelated shapes keep their selection: the diff changes
kernelNameandkernelIdon ten lines and no key column. Resolving all 2,735 tuned gfx950 keys of the a8w8 preshuffle tables throughget_GEMM_config_with_quant_type, once with the original and once with the edited tables, gives a different selection for exactly these 10 keys. Sweeping M from 1 to 65536 at the six (N, K) changes the selection only in the ranges above. At the lowest M of each range the new kernel takes x0.667 to x0.993 of the old kernel's time (10 points, each matching the fp32 reference and bitwise equal to the old output).Changed op tests
None.