Skip to content

[Triton/Gluon] [Config] [Perf] Add gfx942 a8w8 blockscale Triton configs for Qwen3 shapes - #6757

Merged
azaidy merged 2 commits into
ROCm:mainfrom
siliangchen-amd:gfx942-blockscale-qwen3-configs
Oct 22, 2026
Merged

azaidy merged 2 commits into
ROCm:mainfrom
siliangchen-amd:gfx942-blockscale-qwen3-configs

Conversation

@siliangchen-amd

@siliangchen-amd siliangchen-amd commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

On gfx942 the Triton gemm_a8w8_blockscale has no configs for the block-FP8 linear shapes of Qwen3-14B, Qwen3-32B and Qwen3-30B-A3B at TP1, so every M runs DEFAULT.json's any config (128×128×128 tiles, 4 warps, no split-K). This PR adds configs for those 9 (N, K) shapes, one per M bucket from M_LEQ_1 to M_LEQ_8192. They are 1.6–23.6× faster than any with 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×.

model layers (N, K)
Qwen3-14B qkv, gate_up, down (7168, 5120), (34816, 5120), (5120, 17408)
Qwen3-32B qkv, o, gate_up, down (10240, 5120), (5120, 8192), (51200, 5120), (5120, 25600)
Qwen3-30B-A3B qkv, o (5120, 2048), (2048, 4096)

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 K over the gfx942 DEFAULT.json keys, sharded over 7 GPUs, then write_best_configs.py. M ≤ 64 used the default timing; M 128–512 used --calls 12 --replays 10 and 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's DEFAULT_FALLBACK tables, so M > 8192 keeps DEFAULT.json's any.

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.sh installs, 256×128 tiles at 8 warps run about half as fast, so I re-timed each bucket's 10 finalists and any under 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's any with Triton 3.6.0 / 3.8.0, both through gemm_a8w8_blockscale (config=None for 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:

(N, K) M=1 M=4 M=16 M=64 M=256 M=1024 M=4096
(7168, 5120) 6.9× / 12.9× 12.7× / 18.3× 12.3× / 17.2× 7.8× / 10.8× 3.5× / 5.0× 2.0× / 3.4× 1.8× / 4.0×
(34816, 5120) 2.5× / 4.4× 4.2× / 6.9× 4.1× / 6.1× 2.7× / 4.6× 1.6× / 3.2× 1.7× / 3.6× 1.8× / 3.9×
(5120, 17408) 11.6× / 23.1× 21.6× / 33.0× 21.6× / 31.4× 13.3× / 18.5× 5.2× / 7.9× 2.5× / 3.8× 1.9× / 4.3×
(10240, 5120) 5.4× / 10.5× 9.8× / 14.6× 9.5× / 13.6× 5.8× / 8.0× 2.6× / 3.8× 2.2× / 4.0× 1.9× / 4.2×
(5120, 8192) 9.9× / 19.0× 17.0× / 26.3× 15.7× / 22.5× 9.8× / 13.4× 4.0× / 6.2× 2.1× / 3.1× 2.0× / 3.9×
(51200, 5120) 2.4× / 4.1× 3.9× / 6.8× 3.6× / 6.2× 2.9× / 4.8× 1.9× / 3.9× 1.8× / 3.8× 1.8× / 3.8×
(5120, 25600) 12.3× / 24.6× 23.6× / 35.5× 22.5× / 31.7× 14.6× / 20.1× 5.4× / 8.3× 2.3× / 4.2× 1.9× / 4.3×
(5120, 2048) 5.3× / 9.5× 8.7× / 12.3× 9.0× / 12.5× 5.9× / 7.8× 3.3× / 5.0× 1.9× / 2.9× 1.9× / 3.4×
(2048, 4096) 9.7× / 18.4× 15.2× / 25.1× 15.9× / 25.8× 11.9× / 16.2× 5.9× / 8.2× 3.1× / 5.0× 1.8× / 3.6×

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:

model GSM8K decode: out tok/s, TPOT prefill-heavy: out tok/s, TPOT
Qwen3-14B 0.919 → 0.922 103 → 527, 38.0 → 7.0 ms 647 → 812, 113 → 83 ms
Qwen3-32B 0.919 → 0.916 42 → 306, 93.5 → 12.0 ms 228 → 371, 189 → 98 ms
Qwen3-30B-A3B 0.706 → 0.703 (3 runs) 274 → 664, 14.4 → 5.8 ms 1703 → 1925, 61 → 51 ms

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 any with 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

  • Every bucket of the 9 files through gemm_a8w8_blockscale(config=None) against run_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_config reports is_tuned for each.
  • The two 30B-A3B shapes at every M from 1 to 64 and at 18 larger M up to 8192, with row- and column-major 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.

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]>
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter op tests (gfx942 + gfx950)
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs (added automatically when gfx942 configs change); main branch always runs both MI35X and MI300X
ci:triton-355 Run the full Triton test suite on MI35X, not only the tests the change affects
ci:windows Windows JIT op smoke test on the gfx1201 ROCm runner
ci:multi-gpu Aiter multi-GPU tests on the 8-GPU runner
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: DeepSeek-V4-Pro, MiniMax-M3-MXFP4
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 6757 --add-label <label>

One backend per PR:
A PR changes one kernel backend: [Triton/Gluon] (Triton and Gluon count as one), [HIP], [ASM], [CK], [OPUS] or [FlyDSL]. If the title ends up with two backend tags, split the PR -- as stacked pull requests when one part cannot merge without the other.

PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to stop the title rewrites; labels stay in sync either way.

@github-actions github-actions Bot changed the title [Perf] Add gfx942 a8w8 blockscale Triton configs for Qwen3 shapes [Triton/Gluon] [Config] [Perf] Add gfx942 a8w8 blockscale Triton configs for Qwen3 shapes Oct 21, 2026
@siliangchen-amd

Copy link
Copy Markdown
Contributor Author

@azaidy @omuhamma could you review this when you have a moment? It adds gfx942 Triton configs for 9 Qwen3 blockscale shapes (5.0× faster than DEFAULT on average, SGLang decode 2.4–7.3× faster). Thanks!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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 any settings 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 azaidy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@siliangchen-amd which triton was used for this?

@azaidy azaidy self-assigned this Oct 21, 2026
@zufayu
zufayu requested review from a team and k50112113 October 22, 2026 01:17
@siliangchen-amd

Copy link
Copy Markdown
Contributor Author

Triton 3.6.0, the wheel in the ROCm 7.2 PyTorch image, not the 3.8.0+amd.rocm7.2.0 build that install_triton.sh installs. I'll re-check these configs with 3.8.0 against the defaults, re-tune any shape where they no longer win, and update the PR.

…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]>
@siliangchen-amd

Copy link
Copy Markdown
Contributor Author

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.

@azaidy azaidy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants