Skip to content

[Config] [Perf] Tune DeepSeek-V4 M1/M2/M8/M64 FP8 GEMMs on gfx1250 - #7018

Merged
amd-ruitang3 merged 4 commits into
mainfrom
ruitang3/dsv4-small-m-fp8-gemm-tune
Oct 30, 2026
Merged

amd-ruitang3 merged 4 commits into
mainfrom
ruitang3/dsv4-small-m-fp8-gemm-tune

Conversation

@amd-ruitang3

@amd-ruitang3 amd-ruitang3 commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Several DeepSeek-V4 decode FP8 GEMM shapes on gfx1250 use oversized fallback tiles. Add measured M=1/2/8/M64 configurations for four projection shapes and retune one existing M64 entry, so the existing lookup selects tiles suited to these shapes.

The final diff changes only dsv4_a8w8_blockscale_mxscale_bpreshuffle_tuned_gemm.csv: 15 added keys and one replacement. All submitted rows use split-K=1. Kernel code and APIs are unchanged.

The exact final configuration has not been benchmarked or accuracy-tested end to end. The historical service experiment below used a different six-row local candidate and had an unresolved GSM8K score reduction. Its +38.48% throughput result is not a measured gain for this final PR.

Configuration scope

Target: gfx1250, 256 CUs, FP8 E4M3 inputs/weights, E8M0 activation scales in 1x128 column-major storage, E8M0 128x128 weight scales, (16,16) preshuffled weights, BF16 output.

M (N,K) Change
1, 2, 8 (2048,7168), (16384,1536), (7168,4096), (8192,1536) Add 12 DSV4 rows
64 (2048,7168), (16384,1536), (8192,1536) Add 3 DSV4 rows
64 (7168,4096) Replace 1 DSV4 row

The existing Kimi K3 CSV is byte-identical to upstream. In particular, the shared M64 keys (1536,7168) and (7168,768) retain their upstream configurations; their experimental DSV4 candidates are excluded. Kimi end-to-end performance and accuracy have not been tested.

AITER merges these model CSVs into a common shape-keyed table. Moving conflicting rows into the DSV4 CSV would not provide model isolation. This PR preserves the existing shared keys rather than adding duplicate alternatives. The resulting lookup for those two shared shapes matches the pre-M64-update lookup for every M=1..512.

Individual GEMM measurements

Before each single-GEMM CUDA Graph replay, flush 256 MiB of cache. Candidate order is randomized; medians use 24 GPU-event measurements after 5 warmups, excluding cache-flush time.

M N K Local baseline (us) Selected (us) Speedup
64 2048 7168 51.9375 10.1355 5.12x
64 16384 1536 16.5850 8.2120 2.02x
64 7168 4096 10.4155 9.8950 1.05x
64 8192 1536 16.1040 7.6920 2.09x

For the existing (64,7168,4096) row, the baseline is the same kernel as the pre-change PR configuration, remeasured under identical conditions. Old CSV us fields were measured under different conditions and are not directly comparable to these cold-cache values.

These four retained M64 candidates were included in six-seed changed-input graph checks and a broader six-shape/384-case numerical audit over actual M=33..64. The tested outputs matched the local pre-tuning dispatch bitwise and passed FP32 dequantized-reference checks: rtol=0.01, atol=0.01, nonclose fraction<=0.05, relative L2<=0.004. The local and PR dispatch tables differ, so this is not a claim that every submitted lookup matches the PR baseline bitwise.

The 12 submitted M1/M2/M8 rows passed 96 numerical cases, including M=5/6/7 tails. They matched the local fallback bitwise and passed the same reference checks. Individual measured speedups range from 2.24x to 5.42x for these rows.

GPU experiments used AITER 245e40cf24052611b6aa6e4921989511805e7a55 and ATOM 2c5403530f3c63a13e48398c0507bbe0c454d345. The FlyDSL GEMM kernel and common candidate/runner sources match the PR source; the complete AITER trees differ.

Final PR checks

  • python3 -m unittest op_tests.tuning_tests.test_config_shape_collision -v: 30 tests passed, no skips.
  • Actual PR-source CPU merge/lookup, targeting mocked gfx1250/256: 3157 -> 3160 unique rows relative to the previous small-M PR commit 327cd37ad; only 3 M64 additions and 1 M64 replacement. All other existing rows, including M1/M2/M8 and Kimi rows, are preserved.
  • All four retained M64 lookups select the measured candidates. Both excluded shared shapes retain upstream lookup results for M=1..512.
  • Kimi CSV bytes match the upstream blob; the full PR diff contains only the DSV4 CSV.
  • Repository pre-commit hook and git diff --check.

These checks validate configuration integrity and selection. They do not substitute for end-to-end performance or accuracy measurements of the final configuration. CI status is shown in the PR checks.

Historical six-row local experiment: service measurements and accuracy limitations

The following results were measured before reducing the submitted M64 scope to four rows. The experimental candidate changed all six local M64 shapes, including (1536,7168) and (7168,768), which are excluded from the final PR. The local baseline also contained 18 earlier M1/M2/M8 rows, whereas this PR submits 12 and preserves six upstream shared keys. These service results therefore do not measure the final PR delta.

DeepSeek-V4-Pro, TP4 on 4 x gfx1250, TRITON_MOE=0, FP8 KV, FP4 index, graph level 3, custom-allreduce minimum size 131072. ISL/OSL=8192/1024, concurrency 64, three rounds per configuration, each with 64 warmups and 256 measured requests, random seed 0, unlimited request rate and EOS ignored. All measured requests succeeded with exact token lengths; metrics were independently recomputed. GPU processes were sampled every 10 seconds, with no foreign workload observed. Before/after ran in successive phases, not alternating restarts.

Historical metric Local baseline Six-row candidate
TP4 total throughput (input + output tok/s) 18603.04 25761.87
Average total throughput per GPU (TP4 / 4) 4650.76 6440.47
Interactivity (tok/s/request) 37.70 55.98
Mean TPOT (ms) 26.53 17.86
Mean TTFT (s) 4.59 4.60

Throughput is the arithmetic mean of three rounds; interactivity is 1000 / pooled mean TPOT(ms), excluding TTFT. The six-row experiment improved total throughput by 38.48% and interactivity by 48.49%. Individual total-throughput rounds were 19076.16/17641.32/19091.63 before and 25739.99/25644.82/25900.79 after.

All valid normal-service GSM8K evaluations are retained: 1319 questions, 3-shot, concurrency 64, temperature 0, request seed 1234, max generation 2048. Responses, paired prompts and scoring were audited.

Evaluation Strict match Flexible extract
Baseline after performance rounds 1256/1319 1255/1319
Baseline fresh-service repeat 1254/1319 1253/1319
Six-row candidate: first valid evaluation 1254/1319 1253/1319
Six-row candidate: second valid evaluation 1243/1319 1242/1319
Six-row candidate: latest normal repeat 1248/1319 1247/1319

The latest strict result is 94.6171%, versus 95.0720% for the fresh baseline (-6 questions, -0.4549 percentage points). The cause is unresolved; observed baseline variation does not establish that the candidate's lower scores are harmless. End-to-end accuracy non-regression is not established.

In a separate instrumented full GSM8K run, old/new kernels consumed identical real activation, weight and scale tensors. All 2,667,940 comparisons across four ranks at actual M=48/64 were BF16-bitwise equal and finite, with maximum absolute error 0. A preceding 171,520-call diagnostic also passed. The full instrumented run scored 1253/1319 strict and 1252/1319 flexible. Its extra computation/copies/synchronization change timing, so it does not replace normal-service results.

The first candidate accuracy attempt faulted in opus_mla_v4_prefill_a8w8_32mx1_16nx4_kernel after the performance rounds, producing no valid score. Logs were retained; later valid evaluations restarted with the same six candidate configurations. The failure's cause and relationship to GEMM tuning are unresolved. GSM8K does not establish 8K long-context accuracy.

The canonical local runtime table has not been switched to the six-row candidate or to the final PR configuration.

Add twelve gfx1250 FlyDSL MXFP8-128 configurations at M=1, 2 and 8
for four DeepSeek-V4 TP4 projection shapes. Use split-K=1 configurations
selected with cold-cache timings and changed-input numerical checks.

Keep the six overlapping keys already present in the upstream Kimi K3
table to preserve unique keys in the runtime configuration merge.

Signed-off-by: amd-ruitang3 <[email protected]>
@amd-ruitang3
amd-ruitang3 requested a review from a team October 27, 2026 13:51
@github-actions github-actions Bot changed the title [Perf] Tune DeepSeek-V4 small-batch FP8 GEMMs on gfx1250 [Config] [Perf] Tune DeepSeek-V4 small-batch FP8 GEMMs on gfx1250 Oct 27, 2026
@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 7018 --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.

Add three M64 configuration keys and retune three existing keys across
DeepSeek-V4 and the shared Kimi K3 table. Keep merged shape keys unique.
Select split-K=1 kernels using cold-cache measurements and bitwise checks
against the validated local dispatch, including full-model real inputs.

Local TP4 CONC64 total throughput improves 38.48%. Record all normal
GSM8K repeats and the unresolved score reduction in the PR description;
these results do not establish end-to-end accuracy non-regression.

Signed-off-by: amd-ruitang3 <[email protected]>
@Boss2002n Boss2002n changed the title [Config] [Perf] Tune DeepSeek-V4 small-batch FP8 GEMMs on gfx1250 [Config] [Perf] Tune DeepSeek-V4 M1/M2/M8/M64 FP8 GEMMs on gfx1250 Oct 28, 2026
HaonanWang98 and others added 2 commits October 28, 2026 15:06
Restore the two shared-shape Kimi rows because the DSV4 tuning experiment
did not validate Kimi end-to-end performance or accuracy. Keep the four
DSV4 M64 changes and the existing M1/M2/M8 additions.

The runtime merge has no duplicate keys, and both shared shapes retain
their pre-update lookup results for M=1..512. All 30 config collision tests
pass. End-to-end results for the six-row local experiment do not measure
the reduced final PR configuration.

Signed-off-by: hwang <[email protected]>
@aiter-bot

Copy link
Copy Markdown

NOT READY FOR HUMAN REVIEW

PR Self-Review

Revision 2bfa653348b5 · mode shadow

Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision.

Questions to answer in the PR description

  1. What behavior does this PR change, and why is the existing behavior insufficient?
  2. What did you validate, and what remains unverified? Include commands, hardware/configuration and results.
  3. Which exact workload keys consume these configuration changes, and what evidence shows that unrelated shapes keep their previous selection?
  4. For every changed op_tests/ file, what behavior does it cover and why is it not redundant? Write None if no op test changed.

Edit the PR Self-Review section in the PR description. Include the current revision SHA; this comment refreshes automatically.

Missing or invalid answers

  • FAIL — missing ### Reviewed revision in the PR description
  • FAIL — missing ### Behavior and intent in the PR description
  • FAIL — missing ### Validation and unverified scope in the PR description
  • FAIL — missing ### PR-specific question in the PR description
  • FAIL — missing ### Changed op tests in the PR description
  • FAIL — Reviewed revision must contain at least the first 7 characters of the current head SHA
  • FAIL — Behavior and intent has no substantive answer
  • FAIL — Validation and unverified scope has no substantive answer
  • FAIL — PR-specific question has no substantive answer

Shadow mode reports what would block but keeps the status successful. Set AITER_PR_SELF_REVIEW_MODE=enforce only after reviewing real false positives.

@amd-ruitang3
amd-ruitang3 merged commit 11066b0 into main Oct 30, 2026
55 checks passed
@amd-ruitang3
amd-ruitang3 deleted the ruitang3/dsv4-small-m-fp8-gemm-tune branch October 30, 2026 07:57
solinzby1 pushed a commit that referenced this pull request Nov 2, 2026
…7018)

* Tune DeepSeek-V4 small-batch FP8 GEMMs on gfx1250

Add twelve gfx1250 FlyDSL MXFP8-128 configurations at M=1, 2 and 8
for four DeepSeek-V4 TP4 projection shapes. Use split-K=1 configurations
selected with cold-cache timings and changed-input numerical checks.

Keep the six overlapping keys already present in the upstream Kimi K3
table to preserve unique keys in the runtime configuration merge.

Signed-off-by: amd-ruitang3 <[email protected]>

* Tune DeepSeek-V4 M64 FP8 GEMMs on gfx1250

Add three M64 configuration keys and retune three existing keys across
DeepSeek-V4 and the shared Kimi K3 table. Keep merged shape keys unique.
Select split-K=1 kernels using cold-cache measurements and bitwise checks
against the validated local dispatch, including full-model real inputs.

Local TP4 CONC64 total throughput improves 38.48%. Record all normal
GSM8K repeats and the unresolved score reduction in the PR description;
these results do not establish end-to-end accuracy non-regression.

Signed-off-by: amd-ruitang3 <[email protected]>

* Preserve upstream Kimi K3 M64 GEMM configurations

Restore the two shared-shape Kimi rows because the DSV4 tuning experiment
did not validate Kimi end-to-end performance or accuracy. Keep the four
DSV4 M64 changes and the existing M1/M2/M8 additions.

The runtime merge has no duplicate keys, and both shared shapes retain
their pre-update lookup results for M=1..512. All 30 config collision tests
pass. End-to-end results for the six-row local experiment do not measure
the reduced final PR configuration.

Signed-off-by: hwang <[email protected]>

---------

Signed-off-by: amd-ruitang3 <[email protected]>
Signed-off-by: hwang <[email protected]>
Co-authored-by: hwang <[email protected]>
shantipriya-amd pushed a commit to shantipriya-amd/aiter that referenced this pull request Nov 18, 2026
…OCm#7018)

* Tune DeepSeek-V4 small-batch FP8 GEMMs on gfx1250

Add twelve gfx1250 FlyDSL MXFP8-128 configurations at M=1, 2 and 8
for four DeepSeek-V4 TP4 projection shapes. Use split-K=1 configurations
selected with cold-cache timings and changed-input numerical checks.

Keep the six overlapping keys already present in the upstream Kimi K3
table to preserve unique keys in the runtime configuration merge.

Signed-off-by: amd-ruitang3 <[email protected]>

* Tune DeepSeek-V4 M64 FP8 GEMMs on gfx1250

Add three M64 configuration keys and retune three existing keys across
DeepSeek-V4 and the shared Kimi K3 table. Keep merged shape keys unique.
Select split-K=1 kernels using cold-cache measurements and bitwise checks
against the validated local dispatch, including full-model real inputs.

Local TP4 CONC64 total throughput improves 38.48%. Record all normal
GSM8K repeats and the unresolved score reduction in the PR description;
these results do not establish end-to-end accuracy non-regression.

Signed-off-by: amd-ruitang3 <[email protected]>

* Preserve upstream Kimi K3 M64 GEMM configurations

Restore the two shared-shape Kimi rows because the DSV4 tuning experiment
did not validate Kimi end-to-end performance or accuracy. Keep the four
DSV4 M64 changes and the existing M1/M2/M8 additions.

The runtime merge has no duplicate keys, and both shared shapes retain
their pre-update lookup results for M=1..512. All 30 config collision tests
pass. End-to-end results for the six-row local experiment do not measure
the reduced final PR configuration.

Signed-off-by: hwang <[email protected]>

---------

Signed-off-by: amd-ruitang3 <[email protected]>
Signed-off-by: hwang <[email protected]>
Co-authored-by: hwang <[email protected]>
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.

5 participants