Skip to content

[Config] [Tuning] Add DSv4 a8w8 blockscale GEMM configs for gfx942 / cu_num=304 (MI325X) - #4816

Closed
zzw09773 wants to merge 1 commit into
ROCm:mainfrom
zzw09773:add-mi325x-gfx942-cu304-dsv4-gemm-configs
Closed

zzw09773 wants to merge 1 commit into
ROCm:mainfrom
zzw09773:add-mi325x-gfx942-cu304-dsv4-gemm-configs

Conversation

@zzw09773

Copy link
Copy Markdown
Contributor

What

Tuned a8w8_blockscale and a8w8_blockscale_bpreshuffle GEMM configs for DeepSeek-V4 on gfx942 with cu_num=304 (MI325X) — 464 rows across the 7 (N, K) pairs that a production DSv4 deployment actually reaches.

Why

The shipped DSv4 tables cover gfx950/256, gfx1250/256 and gfx942/**80**. MI325X reports cu_num=304, so every lookup misses and falls through to the default config. On an 8×MI325X DeepSeek-V4-Pro-0813 server that is 100,216 not found tuned config messages during startup alone, across 6,438 raw shapes. After this change the same boot emits 72.

How the rows were produced

Both files were generated with the in-tree tuner on the target hardware:

python3 csrc/ck_gemm_a8w8_blockscale/gemm_a8w8_blockscale_tune.py \
        -i <shapes.csv> -o aiter/configs/model_configs/dsv4_a8w8_blockscale_tuned_gemm.csv \
        --compare --update_improved --min_improvement_pct 5 --errRatio 0.001 \
        --shape_grouped --mp 8
# ... and the same with --preshuffle for the bpreshuffle table
  • Shapes: the in-tree dsv4_a8w8_blockscale_untuned_gemm.csv M sweep (68 values, 1 – 32768) applied to the (N, K) pairs observed in the running server — blockscale (768,7168) (2048,7168) (7168,384) (7168,21504), bpreshuffle (768,7168) (2048,7168) (7168,2048).
  • --min_improvement_pct 5: 464 of 476 shapes cleared the bar and are included. The other 12 are deliberately absent so they keep using the default kernel.
  • --errRatio 0.001 — 50× tighter than the default. Every adopted row has errRatio exactly 0.0.
  • Wall clock: 21 min 31 s for all 476 shapes on 8 GPUs (12 min 17 s + 9 min 15 s).

Measured speedup (--compare, per-shape pre/post in one run)

kernel M ≤ 256 (decode) 257 – 4096 M > 4096 (prefill)
a8w8_blockscale (272 shapes) 1.35× (1.01 – 1.88) 2.09× 2.91× (0.99 – 3.23)
..._bpreshuffle (204 shapes) 2.24× (1.18 – 2.73) 1.36× 1.27× (1.00 – 1.38)

Medians. 476 shapes, no regression — the single 0.99× entry did not clear the 5 % bar and is therefore not in the table.

End-to-end check

DeepSeek-V4-Pro-0813, 8×MI325X, TP8, max_model_len=600000, DSpark speculative decoding, cudagraphs on:

  • needle retrieval at 2k / 12k / 100k / 300k / 518k tokens — 3/3 at every step, three trials each
  • single-stream decode, 2000-token generations, 6 runs: prose 63.9 → 70.4 tok/s median

The serving image under test also carries a backport of vllm-project/vllm#49544 (FlyDSL fp8 MQA logits on gfx942), so the end-to-end figures should not be attributed to these configs alone. The per-shape table above is the isolated measurement.

Notes

  • Rows are appended; no existing entry is modified, and there are no duplicate (gfx, cu_num, M, N, K) keys.
  • us / tflops / bw are this machine's measurements, consistent with how the existing rows were produced.
  • Happy to extend the sweep to other DSv4 (N, K) pairs or to re-run under different thresholds if you would prefer different acceptance criteria.

@zzw09773
zzw09773 requested a review from a team August 18, 2026 06:54
@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; main branch always runs both MI35X and MI300X
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: GPT-OSS-120B, DeepSeek-R1-0528, Kimi-K2.5
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 4816 --add-label <label>

PR title tags:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf] and op tags like [MLA] are left untouched. Add the no-auto-title label to opt this PR out of title tagging.

@github-actions github-actions Bot changed the title [Tuning] Add DSv4 a8w8 blockscale GEMM configs for gfx942 / cu_num=304 (MI325X) [Config] [Tuning] Add DSv4 a8w8 blockscale GEMM configs for gfx942 / cu_num=304 (MI325X) Aug 18, 2026
@zufayu
zufayu requested a review from yzhou103 August 19, 2026 01:24
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

No activity for 15 days, so this is now labelled stale. A push or a comment clears it; keep-open exempts it.

@github-actions github-actions Bot added the stale The PR hasn't been updated in 2 weeks label Oct 7, 2026
@zufayu
zufayu requested review from yifehuan and removed request for yzhou103 October 9, 2026 08:21
@github-actions github-actions Bot removed the stale The PR hasn't been updated in 2 weeks label Oct 10, 2026
The shipped DSv4 tables cover gfx950/256, gfx1250/256 and gfx942/80. MI325X
reports cu_num=304, so every lookup misses and falls back to the default
config -- 100,216 'not found tuned config' messages during a single server
startup, across 6,438 raw shapes.

Tuned on the target hardware with the in-tree tuner using
--compare --update_improved --min_improvement_pct 5 --errRatio 0.001.
464 of 476 shapes cleared the 5% bar; every adopted row has errRatio 0.0.

Median speedup: blockscale 1.35x at M<=256 and 2.91x at M>4096;
bpreshuffle 2.24x at M<=256. No regression across the 476 shapes.

Signed-off-by: zzw09773 <[email protected]>
@zzw09773
zzw09773 force-pushed the add-mi325x-gfx942-cu304-dsv4-gemm-configs branch from 6fd613a to e8eba50 Compare October 17, 2026 14:08
@zzw09773

Copy link
Copy Markdown
Contributor Author

Rebased onto current main. The only conflict was #5839 adding 25 gfx942/304 rows to dsv4_a8w8_blockscale_tuned_gemm.csv; none of its (gfx, cu_num, M, N, K) keys overlap with ours, so this PR is still pure additions (+264 / +200 rows, no deletions, no duplicate keys). @yifehuan could you take a look when you have time?

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e8eba50bf7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

gfx942,304,1472,768,7168,ck,11,0,27.7695,a8w8_blockscale_bpreshuffle_1x128x128_256x32x128x256_16x16_16x16_16x16x1_16x16x1_1x32x1x8_8_2x1_intrawave_v1,583.62,659.62,0.0
gfx942,304,1536,768,7168,ck,11,0,28.3917,a8w8_blockscale_bpreshuffle_1x128x128_256x32x128x256_16x16_16x16_16x16x1_16x16x1_1x32x1x8_8_2x1_intrawave_v1,595.65,664.78,0.0
gfx942,304,1600,768,7168,ck,11,0,28.1849,a8w8_blockscale_bpreshuffle_1x128x128_256x32x128x256_16x16_16x16_16x16x1_16x16x1_1x32x1x8_8_2x1_intrawave_v1,625.02,689.43,0.0
gfx942,304,1664,768,7168,asm,1,1,32.0867,_ZN5aiter42fp8gemm_bf16_blockscale_BpreShuffle_48x128E,570.98,622.95,0.0

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep fp16 calls off bf16-only ASM rows

On gfx942/304, when callers request dtype=torch.float16 for one of the 86 newly added asm shapes (for example this exact key), config lookup ignores dtype and gemm_a8w8_blockscale_bpreshuffle dispatches the row unconditionally. That public function explicitly accepts fp16 (aiter/ops/gemm_op_a8w8.py:1173-1176), but the selected backend rejects it in csrc/py_itfs_cu/asm_a8w8_blockscale_bpreshuffle.cu:64-65 because these _bf16_ kernels only support BF16. These keys previously missed and took the CK fallback, which instantiates F16, so supported fp16 calls now raise at runtime; filter ASM rows by output dtype or retain a CK route for fp16.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T14:15:24.762087Z e8eba50 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

No activity for 15 days, so this is now labelled stale. A push or a comment clears it; keep-open exempts it. Nothing is closed automatically.

@yifehuan

Copy link
Copy Markdown
Contributor

Closing this stale PR because it conflicts with main and its last code update was October 17. If you pick it back up, please rebase and check which omitted M values still select added configurations through the padded lookup.

@yifehuan yifehuan closed this Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Config stale The PR hasn't been updated in 2 weeks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants