Repository navigation
[Triton/Gluon] [Config] [Perf] Add gfx942 a8w8 blockscale Triton configs for Qwen3 shapes - #6757
Conversation
Add per-M configs for the nine block-FP8 linear shapes of Qwen3-14B, Qwen3-32B and Qwen3-30B-A3B at TP1, which ran DEFAULT.json's `any` config at every M on gfx942. Through the public wrapper the tuned configs are 1.6-33.6x faster than `any` (geometric mean 5.0x), most of it at decode-sized M, where they split K. Co-authored-by: Cursor <[email protected]> Signed-off-by: siliangchen-amd <[email protected]>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
There was a problem hiding this comment.
🔵 Needs a closer look
No confirmed defects remain, but the reported gfx942 correctness and performance results need human verification.
No open issues 🎉
What changed in this PR
Adds gfx942 tuning tables for nine Qwen3 shapes used by the existing Triton block-FP8 GEMM.
Changes:
- Adds shape-specific tile, warp, and split-K settings for M buckets through 8192.
- Preserves the default
anysettings for larger M values. - Changes configuration data only; no kernel or API changes.
All files are under aiter/ops/triton/configs/gfx942/triton/gemm/gemm_a8w8_blockscale/.
| File | Description |
|---|---|
GEMM-A8W8_BLOCKSCALE-N=7168-K=5120.json |
Tunes Qwen3-14B QKV. |
GEMM-A8W8_BLOCKSCALE-N=51200-K=5120.json |
Tunes Qwen3-32B gate/up projection. |
GEMM-A8W8_BLOCKSCALE-N=5120-K=8192.json |
Tunes Qwen3-32B output projection. |
GEMM-A8W8_BLOCKSCALE-N=5120-K=25600.json |
Tunes Qwen3-32B down projection. |
GEMM-A8W8_BLOCKSCALE-N=5120-K=2048.json |
Tunes Qwen3-30B-A3B QKV. |
GEMM-A8W8_BLOCKSCALE-N=5120-K=17408.json |
Tunes Qwen3-14B down projection. |
GEMM-A8W8_BLOCKSCALE-N=34816-K=5120.json |
Tunes Qwen3-14B gate/up projection. |
GEMM-A8W8_BLOCKSCALE-N=2048-K=4096.json |
Tunes Qwen3-30B-A3B output projection. |
GEMM-A8W8_BLOCKSCALE-N=10240-K=5120.json |
Tunes Qwen3-32B QKV. |
Review effort: Balanced
azaidy
left a comment
There was a problem hiding this comment.
@siliangchen-amd which triton was used for this?
|
Triton 3.6.0, the wheel in the ROCm 7.2 PyTorch image, not the 3.8.0+amd.rocm7.2.0 build that |
…on 3.8 The configs were swept with Triton 3.6.0. With 3.8.0+amd.rocm7.2.0, which install_triton.sh installs, 256x128 tiles at 8 warps run about half as fast, and several M >= 128 buckets were up to 2.1x slower than another of their sweep's ten finalists. Re-time each bucket's finalists under both Tritons on one GPU. Where the installed config is more than 5% slower than the fastest under either, take the finalist whose worse slowdown across the two is smallest. 38 of the 117 buckets change, and every bucket is now within 8.6% of the fastest finalist under both. Co-authored-by: Cursor <[email protected]> Signed-off-by: siliangchen-amd <[email protected]> Co-authored-by: Cursor <[email protected]>
|
Re-checked with 3.8.0+amd.rocm7.2.0. The M ≤ 64 buckets were still at or near the fastest of each sweep's ten finalists, but 3.8.0 runs 256×128 tiles at 8 warps about half as fast, so several M ≥ 128 buckets were up to 2.1× off. I re-timed every bucket's finalists under both 3.6.0 and 3.8.0 and switched 38 of the 117 buckets in 1a5bcb8 to the finalist with the smallest worst-case slowdown across the two; each bucket is now within 8.6% of the fastest finalist under either Triton. The description has the speedups for both. |
Summary
On gfx942 the Triton
gemm_a8w8_blockscalehas no configs for the block-FP8 linear shapes of Qwen3-14B, Qwen3-32B and Qwen3-30B-A3B at TP1, so every M runsDEFAULT.json'sanyconfig (128×128×128 tiles, 4 warps, no split-K). This PR adds configs for those 9 (N, K) shapes, one per M bucket fromM_LEQ_1toM_LEQ_8192. They are 1.6–23.6× faster thananywith Triton 3.6.0 (geometric mean 4.5×) and 2.6–35.5× with 3.8.0 (7.5×), and SGLang's decode throughput on the three models goes up 2.4–7.3×.Qwen3-14B's o_proj, (5120, 5120), already has a config, and the 30B-A3B experts run in fused MoE.
How the configs were made
With the scripts in
aiter/ops/triton/utils/_triton/tuning/:sweep_configs.py gemm_a8w8_blockscale --N N --K Kover the gfx942DEFAULT.jsonkeys, sharded over 7 GPUs, thenwrite_best_configs.py. M ≤ 64 used the default timing; M 128–512 used--calls 12 --replays 10and M ≥ 1024--calls 4 --replays 5, to fit each shape in a few hours. Each sweep re-timed its 10 fastest configs and the installed baseline on one GPU before installing. The files are the installer'sDEFAULT_FALLBACKtables, so M > 8192 keepsDEFAULT.json'sany.The sweeps ran with Triton 3.6.0, from the ROCm 7.2 PyTorch image. With 3.8.0+amd.rocm7.2.0, which
install_triton.shinstalls, 256×128 tiles at 8 warps run about half as fast, so I re-timed each bucket's 10 finalists andanyunder both Tritons on one GPU (median of three rounds, five where the three disagreed by more than 10%). Where the installed config was more than 5% slower than the fastest finalist under either Triton, it was replaced by the finalist whose worse slowdown across the two is smallest: 38 of the 117 buckets, mostly M ≥ 128. Every bucket is now within 8.6% of the fastest finalist under both (median 1.4%); before, the worst was 2.1× under 3.8.0.Results (MI325X, gfx942, ROCm 7.2.2)
Speedup over
DEFAULT.json'sanywith Triton 3.6.0 / 3.8.0, both throughgemm_a8w8_blockscale(config=Nonefor this PR). Each point is the sweep harness's CUDA graph over at least 1 GB of cold copies, median of three to five rounds on one GPU:For example, (5120, 17408) at M=4 drops from 525 µs to 24.3 µs with 3.6.0, and from 761 µs to 23.1 µs with 3.8.0.
End to end in SGLang main (8683f8a), TP1,
SGLANG_USE_AITER=1, where gfx942 block-FP8 linears run this Triton GEMM by default. Both servers use aiter at SGLang's pinned e7d2453 with Triton 3.6.0, one with the 9 files added (before the re-pick above, which leaves the M ≤ 4 buckets this decode workload runs unchanged or up to 4% faster on 3.6.0), side by side on two GPUs:GSM8K is 8-shot over 1319 questions. Decode is 64 random prompts, 1024 in / 512 out, concurrency 4. Prefill-heavy is 384 prompts, 8192 in / 1024 out, concurrency 128. Its 16384-token prefill chunks run
anywith or without this PR, so its TTFT is mostly queueing: −31% on 32B, +3% and +8% on 14B and 30B-A3B. Single Qwen3-30B-A3B GSM8K runs range from 0.63 to 0.83 on this setup with or without this PR (0.834 / 0.635 / 0.650 without, 0.805 / 0.659 / 0.646 with), so it is reported as a mean.Test plan
gemm_a8w8_blockscale(config=None)againstrun_torch(atol=0.01, rtol=1e-2), at M = 1, 2, 3, 5, 6, 12, 24, 48, 96, 192, 384, 768, 1536, 3072, 6144: 135/135 pass with Triton 3.6.0 and with 3.8.0, and_get_configreportsis_tunedfor each.x_scale: max error 3.5e-3 of the output range against a dequantized fp32 reference, with both Tritons.op_tests/triton_tests/gemm/basic/test_gemm_a8w8_blockscale.py: 233 passed, 248 skipped, with both Tritons.Powered by Hyperloom, with human review, writing and testing.