Repository navigation
[Triton/Gluon] gfx942 a16w4 MoE: tune gpt-oss decode tiles for Triton 3.8 - #6688
Conversation
…ton 3.8 gpt-oss-20b and -120b on MI300X reach moe_gemm_a16w4 with bm16/bm32 x N=6144/3072 x K=3072 (vLLM pads 2880 to 3072). None of these keys is in the gfx942 table, so they use the fallback heuristic. Since Triton 3.8.0 (triton-lang/triton #9646, common gfx942 scaled-dot emulation) the fallback tiles are 26-32% slower at decode, which costs gpt-oss-20b about 10% output throughput at conc 1 between the vLLM v0.30.0 and v0.31.0 ROCm images. It is still present in v0.32.0 and the 2026-10-19 nightly. Add four entries: bm16 -> BN64 BK256 nw4 ns2 kpack2, bm32 -> BN128 BK256 nw4 ns1 kpack2. On Triton 3.8.0 (MI300X), w1+w2 per call goes from 66.8 to 42.6 us at M=1 (3.7.1 with the fallback: 50.5 us) and is 14-36% faster than the fallback at every M in both buckets. Add op_tests cases that hit the four keys. Co-Authored-By: Claude <[email protected]>
9a2d241 to
c8df1a7
Compare
🏷️ 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
Human confirmation of gfx942 correctness and performance evidence is needed for the tile and accumulation-order changes.
No open issues 🎉
What changed in this PR
This PR tunes gfx942 Triton A16W4 MoE configurations to recover gpt-oss decode performance on Triton 3.8.
Changes:
- Adds four shape-specific configurations for block sizes 16 and 32.
- Adds four test cases for padded gpt-oss dimensions.
| File | Description |
|---|---|
op_tests/triton_tests/moe/test_moe_gemm_a16w4.py |
Adds cases covering the four tuned configurations. |
aiter/ops/triton/configs/gfx942/triton/moe/a16w4/DEFAULT.json |
Adds gfx942 decode tiles with kpack=2. |
Review effort: Balanced
Purpose
On MI300X (gfx942), gpt-oss-20b loses about 10% output throughput at conc 1 between
vllm/vllm-openai-rocm:v0.30.0(Triton 3.7.1) andv0.31.0(Triton 3.8.0). It is still present inv0.32.0and the 2026-10-19 nightly, which all ship Triton3.8.0+git669b31ac.The cause is aiter's
moe_gemm_a16w4(_moe_gemm_a16w4, 48 calls per decode step). It gets 26–32% slower at decode on Triton 3.8.0. The regression bisects to triton-lang/triton #9646 ("[AMD] Use common path for gfx942 scaled dot emulation"). That change gives the bf16 × MXFP4dot_scaledemulation an LDS scale broadcast and narrower operand loads, and it is still on Tritonmain.vLLM pads gpt-oss's 2880 dims to 3072 on ROCm and passes
unpadded_*=None, so the kernel looks upbm{16,32,64,128}_n6144_k3072(w1) andbm{16,32,64,128}_n3072_k3072(w2). None of these keys is inconfigs/gfx942/triton/moe/a16w4/DEFAULT.json, so they use the fallback heuristic inget_kernel_config_triton. At decode, that heuristic halvesblock_nuntil the grid has ≥ 256 programs.This PR adds four entries for the decode buckets (block_m 16 and 32):
bm16_n6144_k3072,bm16_n3072_k3072bm32_n6144_k3072,bm32_n3072_k3072These configs don't remove the Triton 3.8 codegen cost. With the same config and warp layout, 3.8.0 is still 9–24% slower than 3.7.1. They pick tiles that are faster on both Triton versions, which more than recovers the regression at small M. The Triton-side issue will be filed separately.
It also adds four
op_testscases (gpt-oss-20b shapes, 32 experts, top-4) that hit the four keys.Test results
Kernel, gpt-oss-20b shapes (32 experts, top-4, padded N/K), w1 (gather + SwiGLU) + w2 (scatter) µs per call,
do_bench_cudagraph, median of 3 runs, MI300X:How the configs were picked: I swept
BLOCK_SIZE_N,num_warps,BLOCK_SIZE_K,num_stages,waves_per_euandkpack. For each bucket I kept the config that is never more than 3% slower than the fallback at any M in the bucket and has the best geomean. One entry per bucket is the same for w1 and w2.kpack=2alone is worth 10–15% on top of the tile change.Serving, gpt-oss-20b TP1,
vllm bench serverandom 1024/1024, MI300X. Output tok/s; all arms ran at the same time on separate GPUs:The same entries, backported into the aiter of
v0.31.0andv0.32.0, restore conc 1 there too: 306 → 339 and 305 → 340 tok/s. Those runs were withoutkpack.Numerics:
kpack=2changes the accumulation order, so outputs are not bit-identical to the fallback. The max difference is ≤ 3e-3 relative to the output max, which is bf16 rounding. Withoutkpackthe same tiles are bit-identical. gsm8k (lm-eval 0.4.13, 5-shot, all 1319 questions, gpt-oss-20b served through/v1/completions): flexible-extract 0.3662 → 0.3707 (±0.0133) and strict-match 0.2472 → 0.2472. The scores are low in absolute terms because no chat template is applied. The A/B is what matters.Unit tests:
op_tests/triton_tests/moe/test_moe_gemm_a16w4.pywith this table, MI300X, Triton 3.8.0: 1056 passed, 625 skipped. The four new cases give 192 passed.Who else reads these entries
get_kernel_config_tritonlooks upbm{block_m}_n{N}_k{K}only on an exact match, only on gfx942 and only on the Triton path. Only those four keys change. The Gluon path and other archs are not affected.Case(32, 6144, 3072, 128, 4)already hitbm16_n6144_k3072, and it passes.kpack. The keys don't overlap, and its fallback change does not affect tuned entries. The two PRs may need a trivial rebase because the hunks are next to each other.AI assistance (Claude) was used to triage, measure and draft this change.
🤖 Generated with Claude Code