Skip to content

[Config] Re-tune 136 unparseable Qwen3.5-397B a8w8 bpreshuffle rows on gfx950 - #6393

Merged
amd-ruitang3 merged 1 commit into
ROCm:mainfrom
jiaqiang-dot-liu:fix/flydsl-bpreshuffle-qwen35-inert-rows
Oct 13, 2026
Merged

amd-ruitang3 merged 1 commit into
ROCm:mainfrom
jiaqiang-dot-liu:fix/flydsl-bpreshuffle-qwen35-inert-rows

Conversation

@jiaqiang-dot-liu

@jiaqiang-dot-liu jiaqiang-dot-liu commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

136 of the 190 FlyDSL rows in aiter/configs/model_configs/a8w8_bpreshuffle_tuned_gemm_qwen3_5_397b_a17b_mxfp4_attnfp8.csv (Qwen3.5-397B-A17B MXFP4-AttnFP8, gfx950) never take effect. This PR re-tunes those 136 shapes on MI355X. It changes only that CSV.

Measured on MI355X against main, the 136 shapes are 1.85x faster under CUDA-graph replay and 1.67x faster eagerly (geomean), with a maximum relative error of 2.0e-5 against the fp32 reference.

The bug

The 136 rows, added in #4396, carry a five-token knob field (e.g. ..._B16_2x0x1x3x0_default). The aiter tuner emits four tokens (use_async_copy x waves_per_eu x xcd_swizzle x lds_stage) and the runtime parser accepts at most four, so none of these rows parses and gemm_a8w8_bpreshuffle_flydsl() falls back to the CK default heuristic:

parsed = _parse_flydsl_kernel_name(kernel_name)
if parsed is None:
    return gemm_a8w8_bpreshuffle_ck(XQ, WQ, x_scale, w_scale, Out)

No other tuned table has a row for these (gfx, cu_num, M, N, K) keys, so every one of these shapes has run untuned since #4396. The affected GEMMs are N ∈ {64, 4096, 8704, 10240}, K = 4096, M from 24 to 131072 (decode and prefill): the attention and GatedDeltaNet projections of Qwen3.5-397B at attention TP = 2.

Change

The 136 rows are replaced with the output of

python csrc/ck_gemm_a8w8_bpreshuffle/gemm_a8w8_bpreshuffle_tune.py --libtype all

on MI355X with the pinned flydsl==0.3.4.1. Shape keys are unchanged and no other row is touched. The tuner picked FlyDSL for 134 shapes (4 of them flydsl_bpreshuffle_8w_*) and CKTile for 2.

Rewriting the five knob tokens into the four-token spelling was measured first and rejected. It is exact only for the 70 rows with use_cshuffle_epilog == 0 (the other 66 name a variant that does not exist in the current catalog), and 11 of the 136 shapes came out slower than the CK default (worst 0.69x, M=1664 N=8704). Re-tuning has no such regression and is faster overall.

Performance (MI355X)

MI355X (gfx950, 256 CU), ROCm 7.2.0, torch 2.9.1, Triton 3.7.0, flydsl==0.3.4.1. main = 882ea79d. Each tree built its CK/CKTile runtime modules from its own tuned CSV (AITER_REBUILD=1).

Harness: aiter.gemm_a8w8_bpreshuffle (the public entry point, so dispatch is exactly what callers get) on per-token FP8 activations and per-channel FP8 weights shuffled with shuffle_weight(layout=(16, 16)), for all 136 shapes. Eager = triton.testing.do_bench (median, min of 3); graph = triton.testing.do_bench_cudagraph (min of 3), which hides host launch overhead.

geomean faster within ±2% slower
CUDA-graph replay 1.850x 131 1 4
Eager 1.666x 136 0 0

By N (geomean, graph / eager):

N shapes graph eager
64 53 2.040x 1.885x
4096 40 1.760x 1.624x
8704 22 1.537x 1.371x
10240 21 1.933x 1.568x

Selected shapes (µs, main → this PR):

M, N eager graph
48, 4096 11.8 → 11.4 (1.03x) 4.5 → 4.0 (1.14x)
288, 4096 32.9 → 16.1 (2.05x) 20.5 → 10.4 (1.97x)
896, 8704 35.3 → 34.4 (1.03x) 33.0 → 29.2 (1.13x)
1664, 8704 62.8 → 50.5 (1.24x) 61.4 → 48.9 (1.26x)
40, 10240 17.8 → 14.4 (1.24x) 9.2 → 8.8 (1.05x)
4864, 64 25.7 → 10.1 (2.54x) 11.8 → 6.1 (1.93x)
131072, 64 153.8 → 134.6 (1.14x) 115.7 → 103.1 (1.12x)

The four shapes that are slower under graph replay are all small and the gap is under 1 µs: M=192 N=4096 (8.6 → 9.3 µs, 0.93x), M=48 N=10240 (0.96x), M=48 N=8704 (0.96x), M=65536 N=64 (0.97x). All four are faster eagerly. They are kept as the tuner chose them, since the tuner's own timing (profiler, device time) ranked them first and the difference is within what its 101-iteration measurement can resolve.

Accuracy: against an fp32 reference of the dequantized inputs, the maximum relative error over all 136 shapes is 2.0e-5, with no element outside atol = rtol = 1e-2.

Validation

  • Every FlyDSL bpreshuffle kernelName in the shipped CSVs (1889 rows) parses with the runtime parser.
  • The merged a8w8 bpreshuffle table (default CSV plus model_configs/) has no duplicate (M, N, K, q_dtype_w, cu_num, gfx) key.

@jiaqiang-dot-liu
jiaqiang-dot-liu requested a review from a team October 11, 2026 05:43
@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: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 6393 --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 [Config] [FlyDSL] Re-tune 136 inert Qwen3.5-397B a8w8 bpreshuffle rows on gfx950, warn on unparseable kernel names [FlyDSL] Re-tune 136 inert Qwen3.5-397B a8w8 bpreshuffle rows on gfx950, warn on unparseable kernel names Oct 11, 2026
@zufayu
zufayu requested a review from coderfeli October 12, 2026 01:25
@solinzby1
solinzby1 self-requested a review October 13, 2026 02:11
Comment thread aiter/ops/gemm_op_a8w8.py Resolved
… rows on gfx950

136 of the 190 FlyDSL rows in
a8w8_bpreshuffle_tuned_gemm_qwen3_5_397b_a17b_mxfp4_attnfp8.csv, added in
ROCm#4396, carry a five-token knob field (e.g. `..._B16_2x0x1x3x0_default`).
The aiter tuner emits four tokens (use_async_copy x waves_per_eu x
xcd_swizzle x lds_stage) and the runtime parser accepts at most four, so
none of these rows parses. gemm_a8w8_bpreshuffle_flydsl() falls back to
the CK default heuristic for them, and every one of these shapes has run
untuned since the rows were added.

Replace the 136 rows with the output of

    python csrc/ck_gemm_a8w8_bpreshuffle/gemm_a8w8_bpreshuffle_tune.py --libtype all

on MI355X with flydsl 0.3.4.1. Shape keys are unchanged and no other row
is touched. The tuner picked FlyDSL for 134 shapes (4 of them 8-wave) and
CKTile for 2.

Kernel-level, over the 136 shapes against the CK default they replace:
1.85x geomean under CUDA-graph replay and 1.67x eager, maximum relative
error 2.0e-5 against an fp32 reference.

Signed-off-by: jiaqiang-dot-liu <[email protected]>
@jiaqiang-dot-liu
jiaqiang-dot-liu force-pushed the fix/flydsl-bpreshuffle-qwen35-inert-rows branch from 94bdf72 to 9c064c6 Compare October 13, 2026 02:26
@jiaqiang-dot-liu jiaqiang-dot-liu changed the title [FlyDSL] Re-tune 136 inert Qwen3.5-397B a8w8 bpreshuffle rows on gfx950, warn on unparseable kernel names [FlyDSL] Re-tune 136 unparseable Qwen3.5-397B a8w8 bpreshuffle rows on gfx950 Oct 13, 2026
@github-actions github-actions Bot changed the title [FlyDSL] Re-tune 136 unparseable Qwen3.5-397B a8w8 bpreshuffle rows on gfx950 [Config] Re-tune 136 inert Qwen3.5-397B a8w8 bpreshuffle rows on gfx950, warn on unparseable kernel names Oct 13, 2026
@github-actions github-actions Bot added Config and removed FlyDSL labels Oct 13, 2026
@jiaqiang-dot-liu jiaqiang-dot-liu changed the title [Config] Re-tune 136 inert Qwen3.5-397B a8w8 bpreshuffle rows on gfx950, warn on unparseable kernel names [Config] Re-tune 136 unparseable Qwen3.5-397B a8w8 bpreshuffle rows on gfx950 Oct 13, 2026
@solinzby1

Copy link
Copy Markdown
Contributor

LGTM

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants