Skip to content

[Triton/Gluon] gfx942 a16w4 MoE: tune gpt-oss decode tiles for Triton 3.8 - #6688

Merged
azaidy merged 1 commit into
ROCm:mainfrom
afriedri-amd:gfx942-a16w4-gptoss-decode
Oct 21, 2026
Merged

azaidy merged 1 commit into
ROCm:mainfrom
afriedri-amd:gfx942-a16w4-gptoss-decode

Conversation

@afriedri-amd

Copy link
Copy Markdown
Contributor

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) and v0.31.0 (Triton 3.8.0). It is still present in v0.32.0 and the 2026-10-19 nightly, which all ship Triton 3.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 × MXFP4 dot_scaled emulation an LDS scale broadcast and narrower operand loads, and it is still on Triton main.

vLLM pads gpt-oss's 2880 dims to 3072 on ROCm and passes unpadded_*=None, so the kernel looks up bm{16,32,64,128}_n6144_k3072 (w1) and bm{16,32,64,128}_n3072_k3072 (w2). None of these keys is in configs/gfx942/triton/moe/a16w4/DEFAULT.json, so they use the fallback heuristic in get_kernel_config_triton. At decode, that heuristic halves block_n until the grid has ≥ 256 programs.

This PR adds four entries for the decode buckets (block_m 16 and 32):

key BLOCK_SIZE_N BLOCK_SIZE_K num_warps num_stages waves_per_eu kpack
bm16_n6144_k3072, bm16_n3072_k3072 64 256 4 2 0 2
bm32_n6144_k3072, bm32_n3072_k3072 128 256 4 1 0 2

These 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_tests cases (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:

M block_m Triton 3.7.1, fallback Triton 3.8.0, fallback Triton 3.8.0, this PR vs 3.8.0 fallback vs 3.7.1
1 16 50.5 66.8 42.6 −36% −16%
2 16 75.0 98.1 69.0 −30% −8%
4 16 127.5 164.7 117.4 −29% −8%
8 16 160.0 206.2 167.4 −19% +5%
16 16 212.5 269.4 224.1 −17% +5%
32 16 230.4 292.9 243.2 −17% +6%
64 16 233.7 294.1 244.3 −17% +5%
128 16 294.0 381.7 329.9 −14% +12%
160 32 391.0 420.8 283.0 −33% −28%
192 32 395.7 425.3 287.1 −33% −27%
256 32 431.2 455.2 385.1 −15% −11%

How the configs were picked: I swept BLOCK_SIZE_N, num_warps, BLOCK_SIZE_K, num_stages, waves_per_eu and kpack. 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=2 alone is worth 10–15% on top of the tile change.

Serving, gpt-oss-20b TP1, vllm bench serve random 1024/1024, MI300X. Output tok/s; all arms ran at the same time on separate GPUs:

arm conc 1 conc 1 TPOT (ms) conc 32 conc 128
v0.30.0 (Triton 3.7.1) 343.3 2.81 3116 6269
nightly 2026-10-19 (aiter 0.1.25, Triton 3.8.0) 310.2 3.15 2967 6881
nightly + this PR's table 354.2 2.75 3321 7539

The same entries, backported into the aiter of v0.31.0 and v0.32.0, restore conc 1 there too: 306 → 339 and 305 → 340 tok/s. Those runs were without kpack.

Numerics: kpack=2 changes 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. Without kpack the 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.py with this table, MI300X, Triton 3.8.0: 1056 passed, 625 skipped. The four new cases give 192 passed.

Who else reads these entries

  • Lookup: get_kernel_config_triton looks up bm{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.
  • Models: the keys are gpt-oss-20b and gpt-oss-120b at TP1, which have the same hidden and intermediate sizes. For gpt-oss-120b (128 experts, top-4) I measured the kernel only; it is not on this box end to end. It is 5–36% faster than the fallback at every M from 1 to 1024: −36% at M=1, −5% at M=64–256, −17% to −20% at M=768–1024. The existing case Case(32, 6144, 3072, 128, 4) already hit bm16_n6144_k3072, and it passes.
  • [Triton/Gluon] Retune gfx942 a16w4 DSv4.1 tiles for Triton 3.8 #6286 (draft) edits the DSv4.1 entries in the same file and changes the fallback 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

@afriedri-amd
afriedri-amd requested a review from a team October 19, 2026 22:28
…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]>
@afriedri-amd
afriedri-amd force-pushed the gfx942-a16w4-gptoss-decode branch from 9a2d241 to c8df1a7 Compare October 19, 2026 22:28
@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 6688 --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 [Triton] [Config] gfx942 a16w4 MoE: tune gpt-oss decode tiles for Triton 3.8 [Triton/Gluon] gfx942 a16w4 MoE: tune gpt-oss decode tiles for Triton 3.8 Oct 19, 2026
@zufayu
zufayu requested review from a team and Dewei-Wang-sh October 20, 2026 00:12
@Boss2002n
Boss2002n requested a balanced review from Copilot October 20, 2026 01:33

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

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

@azaidy
azaidy self-requested a review October 20, 2026 22:27

@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.

4 participants