Skip to content

[Config] [Perf] Tune gfx1250 DSv4.1 BF16 LM-head and router GEMMs - #7246

Merged
demonsan merged 2 commits into
ROCm:mainfrom
amd-ruitang3:OCT_31-dsv41-opus-lmhead-tuning
Nov 2, 2026
Merged

demonsan merged 2 commits into
ROCm:mainfrom
amd-ruitang3:OCT_31-dsv41-opus-lmhead-tuning

Conversation

@amd-ruitang3

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

Copy link
Copy Markdown
Contributor

Summary

Add 32 OPUS tuning entries for DSv4.1 BF16 GEMMs on gfx1250 with 256 CUs. The draft LM head, DP-sharded target LM head and selected router shapes now use measured OPUS configurations instead of the untuned Gluon fallback.

Motivation

Model traces showed expensive BF16 LM-head GEMMs. The existing tables had no entries for these hardware and N/K combinations. OPUS-only searches found faster configurations for the full-vocabulary draft head and sharded target head, plus three router buckets.

Changes

Append rows to aiter/configs/model_configs/dsv41_bf16_tuned_gemm.csv. All 175 original rows remain byte-for-byte unchanged. The PR changes no runtime or kernel code.

All new rows use K=5120, BF16 input/output, TN layout, no bias, no scaling and no weight preshuffle.

Workload N M values Rows
Draft LM head 129280 1, 4, 8, 16, 32, 64, 120, 128, 160, 256, 512, 1024, 2048, 4096, 8192 15
DP-sharded target LM head 32320 4, 8, 16, 32, 64, 128, 256, 512, 576, 768, 1024, 2048, 4096, 8192 14
MoE router 384 64, 4096, 8192 3

The router and sharded-head search independently evaluated all 13 standard M buckets (1, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192), plus router M=144/192 and target-head M=576/768. Only the 17 configurations with at least 3% median latency reduction are included. Router M=144/192 and target-head M=1 keep their prior selection.

The router M=64 entry uses splitK=7. Target-head M=4/16 use splitK=1. All other new rows use splitK=0. Each row records its measured latency and TFLOPS/bandwidth calculated from that latency and shape.

Performance

Hardware: gfx1250, 256 CUs. Workload: BF16 [M,5120] @ [N,5120].T. Search candidates are OPUS only; the unchanged production Gluon configuration is the reference.

Final isolated measurements use 25 graph replays and the median of five alternating OPUS/default rounds, with a 4096 MiB input-copy budget. Draft-head measurements use 24 calls per graph; the router and sharded-head measurements use max(24, input-copy count) calls per graph, with at most 64 copies. Split-K timings include the reduction kernel where applicable.

Draft LM head (N=129280)

M=120 and M=160 use the winners for M=128 and M=256, respectively, with independent timing and correctness checks.

M Default Gluon (µs) Tuned OPUS (µs) Speedup
1 84.724 77.440 1.094×
4 93.702 77.970 1.202×
8 99.069 78.119 1.268×
16 91.334 78.878 1.158×
32 116.747 79.816 1.463×
64 157.992 82.435 1.917×
120 229.710 97.987 2.344×
128 219.334 93.629 2.343×
160 376.078 172.142 2.185×
256 581.968 182.045 3.197×
512 814.208 314.078 2.592×
1024 1571.630 567.777 2.768×
2048 1814.082 1121.796 1.617×
4096 3736.354 2217.768 1.685×
8192 6856.188 4360.385 1.572×

Router and DP-sharded target LM head

N M Default Gluon (µs) Tuned OPUS (µs) Latency reduction
384 64 5.464 5.192 4.98%
384 4096 22.584 19.874 12.00%
384 8192 31.226 22.951 26.50%
32320 4 25.467 23.697 6.95%
32320 8 26.658 23.736 10.96%
32320 16 25.710 24.096 6.28%
32320 32 30.387 24.942 17.92%
32320 64 40.573 26.350 35.06%
32320 128 56.024 30.179 46.13%
32320 256 141.843 41.955 70.42%
32320 512 198.139 76.567 61.36%
32320 576 224.148 97.553 56.48%
32320 768 300.550 130.826 56.47%
32320 1024 392.379 146.261 62.72%
32320 2048 451.263 280.014 37.95%
32320 4096 937.164 558.867 40.37%
32320 8192 1716.187 1100.272 35.89%

Model trace validation

These are profiled per-kernel durations, separate from the isolated measurements above:

Workload (M, N, K) Before mean After mean Observation
Draft head (120, 129280, 5120) 1.005 ms 0.555 ms OPUS selected
Draft head (160, 129280, 5120) 1.798 ms 0.772 ms OPUS selected
Target head (576, 32320, 5120) 214.732 µs 89.496 µs 58.32% lower; all 392 calls matched kid 582

The target-head comparison uses a five-second, four-GPU trace. Target-head M=768 was absent from this short sample, so its validation is limited to the isolated GEMM and production launch-route checks. Shape distributions and workload progress differ across traces. Router M=144/192 retain their default configurations; their trace timing variation is not attributed to this tuning.

Testing

  • Unit tests added or updated
  • Performance benchmarks run
  • Tested on MI250X
  • Tested on MI300X

All 32 submitted configurations passed full-output comparison against FP32 matmul cast to BF16 (atol=0.1, rtol=0.01) and production tgemm launch-route checks during tuning. All 30 router/target-head search winners passed these checks before selecting the 17 improvements. The final proposed CSV also passed lookup checks for all 32 submitted configurations.

This is a CSV-only change for gfx1250/256 CUs. No new unit test is added. Other GPU architectures were not tested locally.

Documentation

  • No documentation change is needed, with the reason stated below

The existing CSV schema and loading behavior are unchanged. Measurement details are included here.

Dependencies

  • No new third-party dependencies added

Breaking Changes

None.

PR Self-Review

Reviewed revision

d6b8b2b6afccae4ae69367d32e7b14af0cccdada

Behavior and intent

The existing model-config merge discovers the 32 added rows. For the architecture, CU count, BF16 types and shape/flag keys listed above, the lookup selects measured OPUS kernels and splitK values. The change preserves every original model-table row and modifies one CSV file.

Validation and unverified scope

  • git diff bd4ff1c7087970a5b9af92f90c83635e4240f562 HEAD --check: passed.
  • CSV schema, expected M coverage, measured metadata and collision checks against the canonical and other model BF16 tables: passed. No new duplicate keys; all original rows are byte-for-byte unchanged. The 17 additional rows exactly match the tested configuration.
  • All 32 submitted rows resolve through get_GEMM_A16W16_tuned_config to the intended OPUS kid, kernel name and splitK with the proposed model CSV selected by AITER_CONFIG_GEMM_BF16.
  • All 16 selected kid/name pairs exist in this branch's registry. The relevant lookup/launch code, gfx1250 headers and selected precompiled code objects match the tested checkout byte-for-byte.
  • Numerical, production launch-route and performance evidence was collected on AITER 6ff69e426e2eaf8f8ba32837eeece590de5a1426 and ATOM dd8ce2e95c78e357b66698654ce0ddb8783eee3f. This config-only branch is based on upstream main bd4ff1c7087970a5b9af92f90c83635e4240f562. A separate model trace on this upstream-main checkout and other GPU architectures remain unverified.
  • Black/Ruff/C++ formatting have no changed source files to check. Remote CI for the updated revision is pending.

PR-specific question

Which exact workload keys consume these configuration changes, and what evidence shows that unrelated shapes keep their previous selection?

The lookup key is (gfx, cu_num, M, N, K, bias, dtype, outdtype, scaleAB, bpreshuffle). New keys use gfx1250, 256, the M/N pairs in the Changes table, K=5120, False, torch.bfloat16, torch.bfloat16, False, False.

The existing lookup checks exact M first, then its padded-M buckets. Intermediate M values can also use the added rows when their normal bucket resolves to a supported OPUS candidate. This bucketing behavior is unchanged. Router M=144/192 and target-head M=1 have no new matching exact or padded entry.

The diff only appends 32 rows; all 175 original rows are byte-for-byte unchanged. The new keys have no collisions with the canonical or other model BF16 tables. Lookup code still keys on architecture, CU count, N/K, dtype and flags, so other workload families retain their previous entries and selection rules.

Changed op tests

None.

@amd-ruitang3
amd-ruitang3 requested a review from a team October 31, 2026 07:10
@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 7246 --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 [OPUS][Perf] Tune gfx1250 DSv4.1 BF16 LM-head GEMMs [Config] [Perf] Tune gfx1250 DSv4.1 BF16 LM-head GEMMs Oct 31, 2026
@aiter-bot

aiter-bot commented Oct 31, 2026 •

Copy link
Copy Markdown

READY FOR HUMAN REVIEW

PR Self-Review

Revision d6b8b2b6afcc · mode shadow

Author self-review accepted. Readiness report:

Author answers

  • PASS — current-SHA answers are present and structurally specific
Show the author's self-review answers

Behavior and intent

The existing model-config merge discovers the 32 added rows. For the architecture, CU count, BF16 types and shape/flag keys listed above, the lookup selects measured OPUS kernels and splitK values. The change preserves every original model-table row and modifies one CSV file.

Validation and unverified scope

- `git diff bd4ff1c7087970a5b9af92f90c83635e4240f562 HEAD --check`: passed.
- CSV schema, expected M coverage, measured metadata and collision checks against the canonical and other model BF16 tables: passed. No new duplicate keys; all original rows are byte-for-byte unchanged. The 17 additional rows exactly match the tested configuration.
- All 32 submitted rows resolve through `get_GEMM_A16W16_tuned_config` to the intended OPUS kid, kernel name and splitK with the proposed model CSV selected by `AITER_CONFIG_GEMM_BF16`.
- All 16 selected kid/name pairs exist in this branch's registry. The relevant lookup/launch code, gfx1250 headers and selected precompiled code objects match the tested checkout byte-for-byte.
- Numerical, production launch-route and performance evidence was collected on AITER `6ff69e426e2eaf8f8ba32837eeece590de5a1426` and ATOM `dd8ce2e95c78e357b66698654ce0ddb8783eee3f`. This config-only branch is based on upstream main `bd4ff1c7087970a5b9af92f90c83635e4240f562`. A separate model trace on this upstream-main checkout and other GPU architectures remain unverified.
- Black/Ruff/C++ formatting have no changed source files to check. Remote CI for the updated revision is pending.

PR-specific question

**Which exact workload keys consume these configuration changes, and what evidence shows that unrelated shapes keep their previous selection?**

The lookup key is `(gfx, cu_num, M, N, K, bias, dtype, outdtype, scaleAB, bpreshuffle)`. New keys use `gfx1250`, `256`, the M/N pairs in the Changes table, K=`5120`, `False`, `torch.bfloat16`, `torch.bfloat16`, `False`, `False`.

The existing lookup checks exact M first, then its padded-M buckets. Intermediate M values can also use the added rows when their normal bucket resolves to a supported OPUS candidate. This bucketing behavior is unchanged. Router M=144/192 and target-head M=1 have no new matching exact or padded entry.

The diff only appends 32 rows; all 175 original rows are byte-for-byte unchanged. The new keys have no collisions with the canonical or other model BF16 tables. Lookup code still keys on architecture, CU count, N/K, dtype and flags, so other workload families retain their previous entries and selection rules.

Changed op tests

None.

PR state

  • PASS — pull request is marked ready for review

Copilot findings

  • PASS — no active Copilot finding lacks a substantive author reply
  • ADVISORY — Copilot did not review the current head SHA

Code and op-test hygiene

  • PASS — no committed artifact or conflict marker detected

Required CI

  • PASS — Black: passed
  • PASS — Ruff: passed
  • PASS — Repository dependency: passed
  • PASS — Aiter Test Gate: passed

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 changed the title [Config] [Perf] Tune gfx1250 DSv4.1 BF16 LM-head GEMMs [Config] [Perf] Tune gfx1250 DSv4.1 BF16 LM-head and router GEMMs Oct 31, 2026
@zufayu
zufayu requested a review from demonsan November 2, 2026 01:20

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

@demonsan
demonsan merged commit 5967563 into ROCm:main Nov 2, 2026
demonsan pushed a commit that referenced this pull request Nov 2, 2026
…rows (#7247)

Tuned on MI455X (gfx1250, cu_num 256) for the exact shapes DeepSeek-V4.1-Flash
(target + MTP draft) runs under DEP4. Complements #7246: the draft lm_head
(N=129280, K=5120) is left to #7246 entirely, and no key added by #7246 is
repeated here.

- dsv41_bf16_tuned_gemm.csv: +181 gfx1250 rows (144 FlyDSL hgemm, 37 OPUS)
  for target lm_head N=32320 K=5120, N=1024 (fp32 out)/512/384/128/32 K=5120,
  N=128 K=512 and the draft N=1 K=5376 (fp32 out). These shapes had no
  gfx1250 row and ran the default Triton path. Rows are inserted right after
  the header so they do not textually conflict with #7246's appended rows.
- dsv41_a8w8_blockscale_mxscale_bpreshuffle_tuned_gemm.csv: +181 gfx1250
  32x32 rows (kernelId bmm, FlyDSL mxfp8_32 wmma) at M values not covered by
  the existing gfx1250 rows.
- dsv41_batched_gemm_a8w8_blockscale_mxscale_bpreshuffle_tuned.csv (new):
  30 gfx1250 32x32 batched rows (b=8).

No existing row is changed and no shape repeats across configs/ and
model_configs/, with or without #7246 merged. The new gfx1250 OPUS row for
(16384, 512, 5120) shares its M/N/K with a gfx950 row, so it is added to
_EXPECTED_GFX_KEY_FIXES in test_opus_a16w16_policy_parity.py, like the other
kid-596 entries.

Co-authored-by: Claude Opus 5.5 <[email protected]>
solinzby1 pushed a commit that referenced this pull request Nov 2, 2026
)

* [OPUS][Perf] Tune gfx1250 DSv4.1 BF16 LM-head GEMMs

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

* [Config] [Perf] Tune gfx1250 DSv4.1 BF16 router and sharded LM head

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

---------

Signed-off-by: jun <[email protected]>
Co-authored-by: jun <[email protected]>
solinzby1 pushed a commit that referenced this pull request Nov 2, 2026
…rows (#7247)

Tuned on MI455X (gfx1250, cu_num 256) for the exact shapes DeepSeek-V4.1-Flash
(target + MTP draft) runs under DEP4. Complements #7246: the draft lm_head
(N=129280, K=5120) is left to #7246 entirely, and no key added by #7246 is
repeated here.

- dsv41_bf16_tuned_gemm.csv: +181 gfx1250 rows (144 FlyDSL hgemm, 37 OPUS)
  for target lm_head N=32320 K=5120, N=1024 (fp32 out)/512/384/128/32 K=5120,
  N=128 K=512 and the draft N=1 K=5376 (fp32 out). These shapes had no
  gfx1250 row and ran the default Triton path. Rows are inserted right after
  the header so they do not textually conflict with #7246's appended rows.
- dsv41_a8w8_blockscale_mxscale_bpreshuffle_tuned_gemm.csv: +181 gfx1250
  32x32 rows (kernelId bmm, FlyDSL mxfp8_32 wmma) at M values not covered by
  the existing gfx1250 rows.
- dsv41_batched_gemm_a8w8_blockscale_mxscale_bpreshuffle_tuned.csv (new):
  30 gfx1250 32x32 batched rows (b=8).

No existing row is changed and no shape repeats across configs/ and
model_configs/, with or without #7246 merged. The new gfx1250 OPUS row for
(16384, 512, 5120) shares its M/N/K with a gfx950 row, so it is added to
_EXPECTED_GFX_KEY_FIXES in test_opus_a16w16_policy_parity.py, like the other
kid-596 entries.

Co-authored-by: Claude Opus 5.5 <[email protected]>
shantipriya-amd pushed a commit to shantipriya-amd/aiter that referenced this pull request Nov 18, 2026
…Cm#7246)

* [OPUS][Perf] Tune gfx1250 DSv4.1 BF16 LM-head GEMMs

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

* [Config] [Perf] Tune gfx1250 DSv4.1 BF16 router and sharded LM head

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

---------

Signed-off-by: jun <[email protected]>
Co-authored-by: jun <[email protected]>
shantipriya-amd pushed a commit to shantipriya-amd/aiter that referenced this pull request Nov 18, 2026
…rows (ROCm#7247)

Tuned on MI455X (gfx1250, cu_num 256) for the exact shapes DeepSeek-V4.1-Flash
(target + MTP draft) runs under DEP4. Complements ROCm#7246: the draft lm_head
(N=129280, K=5120) is left to ROCm#7246 entirely, and no key added by ROCm#7246 is
repeated here.

- dsv41_bf16_tuned_gemm.csv: +181 gfx1250 rows (144 FlyDSL hgemm, 37 OPUS)
  for target lm_head N=32320 K=5120, N=1024 (fp32 out)/512/384/128/32 K=5120,
  N=128 K=512 and the draft N=1 K=5376 (fp32 out). These shapes had no
  gfx1250 row and ran the default Triton path. Rows are inserted right after
  the header so they do not textually conflict with ROCm#7246's appended rows.
- dsv41_a8w8_blockscale_mxscale_bpreshuffle_tuned_gemm.csv: +181 gfx1250
  32x32 rows (kernelId bmm, FlyDSL mxfp8_32 wmma) at M values not covered by
  the existing gfx1250 rows.
- dsv41_batched_gemm_a8w8_blockscale_mxscale_bpreshuffle_tuned.csv (new):
  30 gfx1250 32x32 batched rows (b=8).

No existing row is changed and no shape repeats across configs/ and
model_configs/, with or without ROCm#7246 merged. The new gfx1250 OPUS row for
(16384, 512, 5120) shares its M/N/K with a gfx950 row, so it is added to
_EXPECTED_GFX_KEY_FIXES in test_opus_a16w16_policy_parity.py, like the other
kid-596 entries.

Co-authored-by: Claude Opus 5.5 <[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.

4 participants