Repository navigation
[Triton/Gluon] Retune gfx942 a16w4 DSv4.1 tiles for Triton 3.8 - #6286
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
|
|
Routing inferred from Caveat: Tested on MI300X with uniform synthetic routing. The PR measured MI325X with real traffic. Skip this report if the setup is invalid
|
|
The changes cause |
|
@anhminhnguyenhoang thanks for your review! Isolated w1 and w2 on one MI325X (gfx942), Triton 3.8.0, round-robin top-k. 384 experts top-6 and 385 top-7. Sizes from your table: w1 N=1536 K=5120, w2 N=5120 K=768. The baseline is
Inside the round spread: M=12 w2 (19% and 28% on #5667), 384 M=256 w1 (head 14%), 384 M=1536 w2 (14%), 385 M=1024 w2 (13%), 385 M=4096 w2 (10%). On MI300X, w2 at 384/16384, 385/1536, and 385/16384 was +9.7%, +6.0%, and +8.7%. Here those are −15.0%, −10.0%, and −11.9%, with smaller spreads.
HIP_VISIBLE_DEVICES=0,1,2,3 vllm serve deepseek-ai/DeepSeek-V4.1-Flash \
--tensor-parallel-size 4 \
--moe-backend aiter_triton_mxfp4_bf16 \
--profiler-config.profiler=torch \
--profiler-config.torch_profiler_dir=/tmp/trace
vllm bench serve --profile \
--dataset-name random \
--num-prompts 2 \
--input-len 262144 \
--output-len 1024 |
anhminhnguyenhoang
left a comment
There was a problem hiding this comment.
@frida-andersson thanks for the fix and the numbers. The Triton 3.6 crash is fixed. One tuned row is still slower on MI300X, and three smaller items remain.
| Result on MI300X | |
|---|---|
| Triton 3.6 and 3.7 crash | Fixed. On head, test_moe_gemm_a16w4.py gives 864 passed and 0 failed on Triton 3.6.0 and 3.8.0. |
w1, and the bm16 and bm64 rows |
Faster, by 1 to 15% |
w2, row bm128_n5120_k768 |
9 to 10% slower than base |
Row bm128_n5120_k768, w2, Triton 3.8.0, µs, best of 3 rounds, spread under 2%:
| Experts | M | Base | Head (nonkdim 16) | Head with nonkdim 32 |
|---|---|---|---|---|
| 384, top-6 | 16384 | 2796 | 3064 (+9.6%) | 2689 (−3.8%) |
| 385, top-7 | 4096 | 1303 | 1423 (+9.2%) | 1254 (−3.8%) |
| 385, top-7 | 16384 | 3909 | 4252 (+8.8%) | 3773 (−3.5%) |
Findings
| # | Where | Problem | Ask |
|---|---|---|---|
| To fix | |||
| 1 | DEFAULT.json:29 |
nonkdim 16 is slower on MI300X | Use nonkdim 32 |
| 2 | moe_op_gemm_a16w4.py:107-113 |
Slow on Triton 3.6 and 3.7 | Use the base values below 3.8 |
| 3 | test_moe_gemm_a16w4.py |
No test reaches this row | Add 2 test cases |
| Clean-up | |||
| 4 | moe_op_gemm_a16w4.py:172 |
kpack=2 is mixed on w2 |
Note it in the PR |
For item 3, test_moe_gemm_a16w4.py has no case with N=5120 and K=768. Could you add Case(256, 5120, 768, 2, 1) and Case(128, 5120, 768, 2, 1)? The first case reaches the gated row, and the second reaches bm64_n5120_k768.
Question
The serve result compares Triton 3.8.0 with a Triton 3.7.1 image, not base with head. Could you share the same serve run on base?
What I ran
- MI300X (gfx942), with Triton 3.6.0, 3.7.1 and 3.8.0. Base is
2b812e5, which has the same two files as #5667. - Correctness: the repo test, plus the N=5120, K=768 cases, on base and head.
- Kernel timing: base and head interleaved, 3 rounds, with the config that each case used logged.
- Routing: your round-robin top-k, and random routing. Both give the same result in all 36 base-and-head pairs.
- Timers:
do_bench, and your 3 × 20-iteration timer. Both give the same result.
CI has not run the op tests on ec6debc. Could you start them, and add the ci:triton-300x label?
|
Thanks @anhminhnguyenhoang! Added
Same serve, same Triton 3.8 image, graphs on, TP4, 2×262144→1024, no spec. Only the AITER files change. One run per arm.
The 236 µs figure was this head on Triton 3.8 against a Triton 3.7.1 image. The table replaces it. The launch count matches, and the gain is in the large launches.
I can't do this, can you approve the workflows and add |
There was a problem hiding this comment.
🟡 Changes recommended
The fallback retune affects other architectures, and version-specific tuning values bypass the required JSON configuration.
2 open issues
What changed in this PR
Retunes the existing gfx942 A16W4 MoE dispatch for DeepSeek-V4.1-Flash on Triton 3.8.
Changes:
- Adjusts three tuned tiles and the small-block fallback.
- Preserves the legacy bm128 w2 configuration below Triton 3.8.
- Adds coverage for two w2 dispatch shapes.
| File | Description |
|---|---|
| op_tests/triton_tests/moe/test_moe_gemm_a16w4.py | Adds bm64 and bm128 w2 cases. |
| aiter/ops/triton/moe/moe_op_gemm_a16w4.py | Updates fallback tuning and compiler-version handling. |
| aiter/ops/triton/configs/gfx942/triton/moe/a16w4/DEFAULT.json | Retunes three gfx942 dispatch entries. |
Review effort: Balanced
|
Do we need to maintain the config for triton<3.8? Can we just keep the config for triton 3.8 and remove the old one? |
3477f31 to
6baefcd
Compare
The ROCm#5667 gfx942 rows were selected on Triton 3.7. Under Triton 3.8 the Flash TP4 shapes want kpack=2 on the block_m<=32 fallback, a narrower matrix instruction on bm128_n5120_k768, and the 128x128 4-warp tile on the two bm64 Flash rows. Signed-off-by: Frida Andersson <[email protected]>
Triton 3.6 fails LLVM lowering of that tile when matrix_instr_nonkdim is 16. Triton 3.8 is faster with 16, so older versions stay on 32. Signed-off-by: Frida Andersson <[email protected]>
I've added it as a response to @anhminhnguyenhoang's review:
|
MI300X and MI325X share this row, and nonkdim 16 is slower on MI300X. Below Triton 3.8 restore the ROCm#5667 row, and cover the w2 shapes in the op test. Signed-off-by: Frida Andersson <[email protected]>
The <3.8 bm128_n5120_k768 values were hardcoded in Python. Store them as bm128_n5120_k768_lt38 and select that key below Triton 3.8. Limit the untuned block_m<=32 kpack=2 fallback to gfx942. Signed-off-by: Frida Andersson <[email protected]>
6baefcd to
1a80e2e
Compare
|
@frida-andersson yes let's keep only the config for the newest triton. |
gfx942 stays on the Triton 3.8 tile only. The lt38 JSON row and the version switch that selected it are no longer needed. Signed-off-by: Frida Andersson <[email protected]>
Thanks! I dropped |

Summary
Retune the gfx942 A16W4 MoE launches added by #5667 for Triton 3.8.
For the DeepSeek-V4.1-Flash TP4 shapes:
kpack=2for the dynamicblock_m <= 32fallback while preserving its existingblock_nshrink.bm128_n5120_k768to one stage, waves=0,matrix_instr_nonkdim=32, andkpack=2. Below Triton 3.8 that shape stays on the [Triton/Gluon] Add a16w4 MoE tuned dispatch and gfx942 DSv4.1 tables #5667 row (stages 2, waves 2, nonkdim 32,kpack=1).bm64rows to the 128x128, 4-warp, one-stage tile.bm128_n1536_k5120unchanged from [Triton/Gluon] Add a16w4 MoE tuned dispatch and gfx942 DSv4.1 tables #5667.Results
Measured on MI325X/gfx942 with Triton 3.8.0. Values are medians for the combined w1 and w2 A16W4 GEMMs:
On Triton 3.8,
kpack=2atblock_m=32is mixed. On MI300X, w2 is 1–3% slower and w1 is 9% faster. On this MI325X at M=1536, 384 top-6, w1 is 821→719 µs (−12.4%) and w2 is 491→443 µs (−9.8%).Same profiled serve on one Triton 3.8 MI325X image, graphs on, TP4, 2 prompts of 262144→1024. #5667, then this PR with
bm128_n5120_k768at nonkdim 32. Both arms launched_moe_gemm_a16w4337,920 times. Total kernel time 36.33 s → 25.31 s (−30.3%). Median TTFT 15709 → 14038 ms. Median TPOT 18.28 → 17.66 ms. One run per arm.Test configuration
aiter_triton_mxfp4_bf16