Skip to content

[Triton/Gluon] [Config] [gfx1250] DSv4.1 router GEMM (N=384, K=5120): Gluon buckets and bf16 rows for M 1344 / 1536 (on #7663) - #8049

Merged
azaidy merged 2 commits into
ROCm:mainfrom
yhl-amd:hyi/dsv41-router-gemm-m1344-1536
Nov 30, 2026

Conversation

@yhl-amd

@yhl-amd yhl-amd commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

The DSv4.1 router GEMM (bf16, N=384, K=5120) at the high-concurrency decode widths with speculative tokens (M = 1344 and 1536 rows) had no exact bf16 row: it ran the M 2048 row's kernel. A Gluon a16w16 tile sized for these M is a better fit.

#7663 (now merged) added M_BOUNDS and the M 576 / 672 / 768 buckets to the same JSON; this PR builds on it.

Technical Details

  • aiter/ops/triton/configs/gfx1250/gluon/gemm/gemm_a16w16/GEMM-A16W16-N=384-K=5120.json: M_BOUNDS gains 1344 and 1536; new buckets M_LEQ_1344 (BLOCK 32x64x256, 4 buffers, 4 warps) and M_LEQ_1536 (64x64x256, 4 buffers, 4 warps). The other buckets are unchanged.
  • aiter/configs/model_configs/dsv41_bf16_tuned_gemm.csv: two gfx1250 rows (M 1344 / 1536, N 384, K 5120) that select the Gluon kernel.
  • No op test change: [Triton/Gluon] Reduce the number of tests in shard 1 to avoid time out #8036 trimmed the DSv4.1 router shapes from test_gemm_a16w16.py to keep the test shard within its time limit, so this PR no longer changes any op test and the two new tiles (M_LEQ_1344, M_LEQ_1536) have no dedicated op test. Their gfx1250 validation is the run already posted (see Test Result).

Test Plan

  • gfx1250 (earlier head 4342568a73, which still carried the router test shapes that [Triton/Gluon] Reduce the number of tests in shard 1 to avoid time out #8036 later removed): pytest op_tests/triton_tests/gemm/basic/test_gemm_a16w16.py -k "test_gemm_a16_w16 and 384 and 5120".
  • gfx1250: tgemm.mm at M in {1024, 1025, 1152, 1344, 1345, 1400, 1536, 1537, 2048}, N 384, K 5120 on main and on this branch: tuned-row selection (with AITER_LOG_TUNED_CONFIG=1), output hash comparison and cosine against an fp32 reference.

Test Result

  • gfx1250: the a16w16 tests for these shapes pass (the skipped ones are the non-gfx1250 / layout combinations the test itself skips).
  • M 1344 / 1536 now resolve to the exact rows (libtype triton); every output is byte-identical to main for all nine M (the router logits do not change), cosine against fp32 is at the bf16 level.

PR Self-Review

Reviewed revision

c11c2c8bc9

Behavior and intent

  • This PR (two commits): the gfx1250 Gluon a16w16 config for the DSv4.1 router GEMM (bf16, N 384, K 5120) gains M_BOUNDS 1344 / 1536 with buckets M_LEQ_1344 and M_LEQ_1536, and dsv41_bf16_tuned_gemm.csv gains two gfx1250 rows (M 1344 / 1536, N 384, K 5120) that route these M to the Gluon kernel. The other buckets are unchanged.
  • Why: at the high-concurrency decode widths with speculative tokens the router had no exact row (it ran the M 2048 row's kernel); a Gluon tile sized for these M fits better.
  • M_BOUNDS and the M 576 / 672 / 768 buckets came from [Triton/Gluon] [gfx1250] DSv4.1 router GEMM (N=384, K=5120): Gluon buckets and bf16 rows for M 576/672/768 #7663, which is now in main.
  • Risk: low. Router logits are byte-identical to main at every tested M, so expert selection does not change; a bad tile would only cost time. The Gluon JSON is read only for calls that the CSV routes to the Triton kernel.
  • Compatibility: gfx1250 / cu_num 256 only; other architectures, other shapes and the other buckets of this JSON are untouched. No API or environment-variable change.

Validation and unverified scope

  • gfx1250, at 4342568a73 (the only later commit, 8fdea7181c, converts the bw column of the two new CSV rows from TB/s to GB/s; that column is tuning metadata and is not read at dispatch): pytest op_tests/triton_tests/gemm/basic/test_gemm_a16w16.py -k "test_gemm_a16_w16 and 384 and 5120" passed (skips are the non-gfx1250 / layout combinations the test itself skips).
  • gfx1250, same revision, main vs this branch: tgemm.mm at M in {1024, 1025, 1152, 1344, 1345, 1400, 1536, 1537, 2048}, N 384, K 5120, with AITER_LOG_TUNED_CONFIG=1: M 1344 / 1536 resolve to the new rows (libtype triton); all nine outputs byte-identical to main; cosine against an fp32 reference at the bf16 level.
  • Earlier, on an older aiter tree (main e9efac0e2 plus DSv4.1 serving patches): with real router weights at M 1344 / 1536 the Gluon logits were byte-identical to the previous kernel in every case, and the rows were part of the gfx1250 DSv4.1-Flash serving stack that passed its accuracy checks.
  • Rebase at this head: the two commits were rebased onto main deca29ee4 (previous head 333a7645a4, kept as bak/8049-pre1127a). The JSON hunk applied unchanged (main has not touched this file). The CSV conflict was textual only: [FlyDSL] [gfx1250] TDM HGEMM: FP32 cluster split-K, and DSV4.1 BF16 rows where TDM measures faster #8031 retuned the adjacent lm_head rows (N 32320, K 5120, M 4096 / 8192) that sit right before the two rows this PR appends; main's values were kept and this PR's two rows were appended after them, so the added lines are identical to the previous head. main still has no gfx1250 N 384, K 5120 row at M 1344 / 1536, so no key is shared. [FlyDSL] [gfx1250] TDM HGEMM: FP32 cluster split-K, and DSV4.1 BF16 rows where TDM measures faster #8031 did retune the M 2048 router row that these M fell back to before this PR; the earlier byte-identical comparison was against the previous M 2048 kernel and has not been repeated against the new one. The test file stays as on main ([Triton/Gluon] Reduce the number of tests in shard 1 to avoid time out #8036). On this head, test_config_shape_collision and test_csv_validation pass (python -m unittest), the JSON parses with no duplicate keys, the CSV has no duplicate keys and every row has the header's column count, and black and ruff report clean on the test file (unchanged from main).
  • Unverified: not re-run on the current main (gfx1250 validation pending; the gfx1250 evidence is the earlier run above); the two new tiles have no op test in CI after [Triton/Gluon] Reduce the number of tests in shard 1 to avoid time out #8036, and a fork PR cannot use the gfx1250 FFM CI.

PR-specific question

The keys consumed are the bf16 CSV rows (gfx1250, cu_num 256, M 1344 / 1536, N 384, K 5120, bf16, no bias) in dsv41_bf16_tuned_gemm.csv, and the M_LEQ_1344 / M_LEQ_1536 buckets of GEMM-A16W16-N=384-K=5120.json (read only when a row routes to the Gluon kernel). Unrelated shapes keep their selection because no other row or bucket changes; within this shape, the nine-M run above (both sides of each new bound) gave outputs byte-identical to main.

Changed op tests

None changed. #8036 trimmed the DSv4.1 router shapes from test_gemm_a16w16.py to keep the test shard within its time limit, so this PR no longer changes any op test and the two new tiles (M_LEQ_1344, M_LEQ_1536) have no dedicated op test. Their gfx1250 validation is the run already reported below (the a16w16 pytest at 4342568a73 and the main-vs-branch tgemm.mm comparison).

🤖 Generated with Claude Code

@yhl-amd
yhl-amd requested a review from a team November 16, 2026 18:00
@yhl-amd yhl-amd added the Config label Nov 16, 2026
@github-actions github-actions Bot changed the title [Config] [Triton/Gluon] [gfx1250] DSv4.1 router GEMM (N=384, K=5120): Gluon buckets and bf16 rows for M 1344 / 1536 (on #7663) [Triton/Gluon] [gfx1250] DSv4.1 router GEMM (N=384, K=5120): Gluon buckets and bf16 rows for M 1344 / 1536 (on #7663) Nov 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter standard tests on MI35X
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:mi300x Run Aiter standard tests on MI300X in PRs; main branch always runs them
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 Radeon R9700 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 8049 --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.

Reviews:
A reviewer is usually assigned within one working day after the PR is ready for review (see Code Review Process). If nobody has responded for about a week, mention the area contact listed in CONTACTS.md. Want to help review? See REVIEWERS.md.

@aiter-bot

aiter-bot commented Nov 16, 2026 •

Copy link
Copy Markdown

READY FOR HUMAN REVIEW

PR Self-Review

Revision c11c2c8bc92a · 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

- This PR (two commits): the gfx1250 Gluon a16w16 config for the DSv4.1 router GEMM (bf16, N 384, K 5120) gains `M_BOUNDS` 1344 / 1536 with buckets `M_LEQ_1344` and `M_LEQ_1536`, and `dsv41_bf16_tuned_gemm.csv` gains two gfx1250 rows (M 1344 / 1536, N 384, K 5120) that route these M to the Gluon kernel. The other buckets are unchanged.
- Why: at the high-concurrency decode widths with speculative tokens the router had no exact row (it ran the M 2048 row's kernel); a Gluon tile sized for these M fits better.
- `M_BOUNDS` and the M 576 / 672 / 768 buckets came from #7663, which is now in main.
- Risk: low. Router logits are byte-identical to main at every tested M, so expert selection does not change; a bad tile would only cost time. The Gluon JSON is read only for calls that the CSV routes to the Triton kernel.
- Compatibility: gfx1250 / cu_num 256 only; other architectures, other shapes and the other buckets of this JSON are untouched. No API or environment-variable change.

Validation and unverified scope

- gfx1250, at `4342568a73` (the only later commit, `8fdea7181c`, converts the `bw` column of the two new CSV rows from TB/s to GB/s; that column is tuning metadata and is not read at dispatch): `pytest op_tests/triton_tests/gemm/basic/test_gemm_a16w16.py -k "test_gemm_a16_w16 and 384 and 5120"` passed (skips are the non-gfx1250 / layout combinations the test itself skips).
- gfx1250, same revision, main vs this branch: `tgemm.mm` at M in {1024, 1025, 1152, 1344, 1345, 1400, 1536, 1537, 2048}, N 384, K 5120, with `AITER_LOG_TUNED_CONFIG=1`: M 1344 / 1536 resolve to the new rows (`libtype triton`); all nine outputs byte-identical to main; cosine against an fp32 reference at the bf16 level.
- Earlier, on an older aiter tree (main `e9efac0e2` plus DSv4.1 serving patches): with real router weights at M 1344 / 1536 the Gluon logits were byte-identical to the previous kernel in every case, and the rows were part of the gfx1250 DSv4.1-Flash serving stack that passed its accuracy checks.
- Rebase at this head: the two commits were rebased onto main `deca29ee4` (previous head `333a7645a4`, kept as `bak/8049-pre1127a`). The JSON hunk applied unchanged (main has not touched this file). The CSV conflict was textual only: #8031 retuned the adjacent lm_head rows (N 32320, K 5120, M 4096 / 8192) that sit right before the two rows this PR appends; main's values were kept and this PR's two rows were appended after them, so the added lines are identical to the previous head. main still has no gfx1250 N 384, K 5120 row at M 1344 / 1536, so no key is shared. #8031 did retune the M 2048 router row that these M fell back to before this PR; the earlier byte-identical comparison was against the previous M 2048 kernel and has not been repeated against the new one. The test file stays as on main (#8036). On this head, `test_config_shape_collision` and `test_csv_validation` pass (`python -m unittest`), the JSON parses with no duplicate keys, the CSV has no duplicate keys and every row has the header's column count, and black and ruff report clean on the test file (unchanged from main).
- Unverified: not re-run on the current main (gfx1250 validation pending; the gfx1250 evidence is the earlier run above); the two new tiles have no op test in CI after #8036, and a fork PR cannot use the gfx1250 FFM CI.

PR-specific question

The keys consumed are the bf16 CSV rows `(gfx1250, cu_num 256, M 1344 / 1536, N 384, K 5120, bf16, no bias)` in `dsv41_bf16_tuned_gemm.csv`, and the `M_LEQ_1344` / `M_LEQ_1536` buckets of `GEMM-A16W16-N=384-K=5120.json` (read only when a row routes to the Gluon kernel). Unrelated shapes keep their selection because no other row or bucket changes; within this shape, the nine-M run above (both sides of each new bound) gave outputs byte-identical to main.

Changed op tests

None changed. #8036 trimmed the DSv4.1 router shapes from `test_gemm_a16w16.py` to keep the test shard within its time limit, so this PR no longer changes any op test and the two new tiles (`M_LEQ_1344`, `M_LEQ_1536`) have no dedicated op test. Their gfx1250 validation is the run already reported below (the a16w16 pytest at `4342568a73` and the main-vs-branch `tgemm.mm` comparison).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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.

Copilot AI 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.

🟡 Changes recommended

The new bandwidth values in dsv41_bf16_tuned_gemm.csv use TB/s rather than the expected GB/s, understating both rows by about 1000×.

1 open issue
What changed in this PR

This PR builds on #7663 to tune the DSv4.1 bf16 router GEMM (N=384, K=5120) on gfx1250 for larger speculative-decode workloads.

Changes:

  • Adds Gluon configuration buckets for M=1344 and M=1536.
  • Adds exact model dispatch rows that select Gluon for these sizes.
  • Extends TN-layout tests with the lower and upper boundaries of the new buckets.
File Description
op_tests/​triton_tests/​gemm/​basic/​test_gemm_a16w16.py Adds DSv4.1 router shapes to the GEMM tests.
aiter/​ops/​triton/​configs/​gfx1250/​gluon/​gemm/​gemm_a16w16/​GEMM-A16W16-N=384-K=5120.json Extends M bounds and adds tuned Gluon configurations.
aiter/​configs/​model_configs/​dsv41_bf16_tuned_gemm.csv Updates router dispatch rows and recorded performance metrics.

Review effort: Balanced

@yhl-amd

yhl-amd commented Nov 21, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto #7663's new head 7818b63 (main df3e0b2); now at 24c3717. The CSV and JSON hunks applied unchanged; the only conflict was test_gemm_a16w16.py (main's #8214 replaced get_x_vals() with get_shapes()), resolved like #7663 by adding M 1025 / 1344 / 1345 / 1536 to the inline N=384, K=5120 list. Self-Review updated.

@yhl-amd
yhl-amd force-pushed the hyi/dsv41-router-gemm-m1344-1536 branch from 24c3717 to 31ef4a3 Compare November 23, 2026 16:49
@yhl-amd

yhl-amd commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (a91a5ba2f) now that #7663 has merged; the carried #7663 commits are dropped and only this PR's two commits remain. New head 31ef4a3fcb (previous head kept as bak/8049-pre1124a). No conflicts: main's versions of the three files equal #7663's last head, so the PR diff is identical to the previous head. test_config_shape_collision and test_csv_validation pass, the JSON has no duplicate keys, and black/ruff pass on the test file. The "stacked on #7663" note has been removed from the description and the Self-Review revision updated. @k50112113 could you take a look? This is the follow-up to #7663 (same router GEMM config, M 1344 / 1536 buckets and rows).

@yhl-amd
yhl-amd requested a review from k50112113 November 23, 2026 16:50
@yhl-amd
yhl-amd force-pushed the hyi/dsv41-router-gemm-m1344-1536 branch from 31ef4a3 to 333a764 Compare November 26, 2026 04:05
@github-actions github-actions Bot changed the title [Triton/Gluon] [gfx1250] DSv4.1 router GEMM (N=384, K=5120): Gluon buckets and bf16 rows for M 1344 / 1536 (on #7663) [Triton/Gluon] [Config] [gfx1250] DSv4.1 router GEMM (N=384, K=5120): Gluon buckets and bf16 rows for M 1344 / 1536 (on #7663) Nov 26, 2026
@yhl-amd

yhl-amd commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (9e5e03626); new head 333a7645a4 (previous head kept as bak/8049-pre1126a). The CSV and JSON changes are unchanged. The only conflict was test_gemm_a16w16.py: #8036 removed the router shapes to keep the shard within its time limit, so I took main's version and this PR now touches only the CSV and the JSON. The two new tiles therefore have no dedicated op test; their gfx1250 validation is the run already reported in the description. test_config_shape_collision and test_csv_validation pass, and the description and Self-Review revision are updated.

yhl-amd and others added 2 commits November 27, 2026 15:28
…1344 / 1536

The DSv4.1 router GEMM at the high-concurrency decode widths (M 1344 and
1536 rows with speculative tokens) had no exact bf16 row and ran the
default selection. Add Gluon a16w16 buckets M_LEQ_1344 (32x64x256, 4
buffers) and M_LEQ_1536 (64x64x256, 4 buffers) to the N=384, K=5120 config,
and the two bf16 rows that select Gluon at those M. The logits are bit
identical to the previous kernel; the other buckets are unchanged.

Builds on ROCm#7663 (M_BOUNDS and the M 576 / 672 / 768 buckets of the same
file), which is in main. No op test is added: ROCm#8036 trimmed the router
shapes from the a16w16 test to keep the shard within its time limit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…GB/s

The two bf16 rows added for M 1344 and 1536 stored the bandwidth column in
TB/s, while the rest of the table (and BaseTuner.calculate) use GB/s.
Convert the two cells from the recorded time with the same formula; the
kernel selection and the other columns are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@yhl-amd
yhl-amd force-pushed the hyi/dsv41-router-gemm-m1344-1536 branch from 333a764 to c11c2c8 Compare November 27, 2026 07:30
@yhl-amd

yhl-amd commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (deca29ee4); new head c11c2c8bc9 (previous head kept as bak/8049-pre1127a). The CSV conflict was textual only (#8031 retuned the adjacent lm_head M 4096 / 8192 rows; main's values kept, the two router rows appended unchanged), no key is shared with main, and the test file stays as on main. Note that #8031 also retuned the M 2048 router row these M used to fall back to; the earlier byte-identical comparison was against the previous kernel and has not been repeated. test_config_shape_collision and test_csv_validation pass; Self-Review revision updated.

@azaidy azaidy 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!

@azaidy
azaidy merged commit 96f3f0f into ROCm:main Nov 30, 2026
71 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants