Skip to content

[Triton/Gluon] [Config] [gfx1250] gemm_a16w16: add N=32768 K=512 config (DeepSeek kv_b_proj) - #7962

Merged
azaidy merged 9 commits into
ROCm:mainfrom
JiaoliangYu:jiaolyu/gfx1250-a16w16-kv-b-proj-config
Nov 24, 2026
Merged

azaidy merged 9 commits into
ROCm:mainfrom
JiaoliangYu:jiaolyu/gfx1250-a16w16-kv-b-proj-config

Conversation

@JiaoliangYu

@JiaoliangYu JiaoliangYu commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Change

  • Adds aiter/ops/triton/configs/gfx1250/gluon/gemm/gemm_a16w16/GEMM-A16W16-N=32768-K=512.json. It tunes DeepSeek-V3/R1 kv_b_proj at attention TP1: 128 heads x (128 + 128), with kv_lora_rank=512.
  • M <= 128 keeps the values from DEFAULT, except that the file has no M_LEQ_1, M_LEQ_4 or M_LEQ_8: M <= 16 takes the M_LEQ_16 values, which are faster at M=1..8 on MI455X (see the self-review). M <= 256 uses compute_bound 256x128x64. Larger M uses compute_bound 256x256x64, with 4 warps and 4 buffers.
  • Each compute_bound entry sets waves_per_eu=0 and REGISTER_STORE=0. These values match the wrapper defaults and give every entry the complete DEFAULT key set.
  • This PR tunes one Gluon config.

Results

Original measurements on MI455X (gfx1250), single GPU, BF16:

  • M=11776: 500.7 -> 255.7 us.
  • Faster than DEFAULT for every measured M from 256 to 16384. Outputs were bit-identical.
  • DeepSeek-R1 MLPerf offline prefill step median: 248.2 -> 229.5 ms.

The config follow-up makes two existing defaults explicit. These GPU measurements were not rerun on the current revision.

Relation to #6397

#6397 is open. It sends large untuned gfx1250 shapes to the FlyDSL BF16 GEMM by default. This file supplies a shape-specific Gluon config for N=32768, K=512. The current loader marks the explicit M buckets as tuned. Its any bucket still returns is_tuned=False.

We have not compared this config with #6397's FlyDSL path for this shape.

PR Self-Review

Reviewed revision

1603337152f1881bed8d6d1d8fb52b31578867b3

Behavior and intent

This PR adds the gfx1250 Gluon gemm_a16w16 config for DeepSeek-V3/R1 kv_b_proj at attention TP1 (N=32768, K=512), where DEFAULT is slower at large M. Per review, the small-M buckets M_LEQ_1, M_LEQ_4 and M_LEQ_8 are removed: M <= 16 now takes the M_LEQ_16 config (BLOCK_N 32, 2 warps), which measured fastest at M=2..8 and within 0.1 us at M=1. The earlier one-line _is_gfx1250 fixture change is dropped; main fixed that test in #8117, and the file now matches main.

Validation and unverified scope

On MI455X (gfx1250), bf16, each small-M bucket's config called directly at M=1..8 (do_bench_cudagraph, 11 interleaved rounds, median): M_LEQ_16 3.47-4.05 us, M_LEQ_1 3.37-4.62 us, M_LEQ_4/M_LEQ_8 4.88-6.02 us; all four outputs bit-identical, max abs error vs fp32 about 0.25. Through get_gemm_config with this JSON, M=1..16 select M_LEQ_16 (tuned) and M=17 selects M_LEQ_32. The timing used the aiter in the gfx1250 image with the config passed explicitly, not a build of this branch; the kernel is the same.

Unverified on this head: the large-M buckets were not re-timed (unchanged from the earlier revision), and FP16 and the FlyDSL comparison were not measured.

PR-specific question

The loader takes the first M_LEQ_x with M <= x that the file has, so removing the three small buckets sends M <= 16 to M_LEQ_16; the buckets from M_LEQ_32 up are unchanged. The get_gemm_config check above confirms the selection at M = 1, 2, 4, 8, 9, 16 and 17.

Changed op tests

None.

DeepSeek-V3/R1 kv_b_proj at attention TP1. M<=128 keeps the DEFAULT
entries; M<=256 uses compute_bound 256x128x64 and larger M 256x256x64.
@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 7962 --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.

@JiaoliangYu
JiaoliangYu marked this pull request as ready for review November 16, 2026 07:01
@JiaoliangYu
JiaoliangYu requested a review from a team November 16, 2026 07:01
@github-actions github-actions Bot changed the title [Triton/Gluon] [gfx1250] gemm_a16w16: add N=32768 K=512 config (DeepSeek kv_b_proj) [Triton/Gluon] [Config] [gfx1250] gemm_a16w16: add N=32768 K=512 config (DeepSeek kv_b_proj) Nov 16, 2026
@aiter-bot

aiter-bot commented Nov 16, 2026 •

Copy link
Copy Markdown

READY FOR HUMAN REVIEW

PR Self-Review

Revision 1603337152f1 · 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 adds the gfx1250 Gluon `gemm_a16w16` config for DeepSeek-V3/R1 kv_b_proj at attention TP1 (N=32768, K=512), where DEFAULT is slower at large M. Per review, the small-M buckets `M_LEQ_1`, `M_LEQ_4` and `M_LEQ_8` are removed: M <= 16 now takes the `M_LEQ_16` config (BLOCK_N 32, 2 warps), which measured fastest at M=2..8 and within 0.1 us at M=1. The earlier one-line `_is_gfx1250` fixture change is dropped; main fixed that test in #8117, and the file now matches main.

Validation and unverified scope

On MI455X (gfx1250), bf16, each small-M bucket's config called directly at M=1..8 (`do_bench_cudagraph`, 11 interleaved rounds, median): `M_LEQ_16` 3.47-4.05 us, `M_LEQ_1` 3.37-4.62 us, `M_LEQ_4`/`M_LEQ_8` 4.88-6.02 us; all four outputs bit-identical, max abs error vs fp32 about 0.25. Through `get_gemm_config` with this JSON, M=1..16 select `M_LEQ_16` (tuned) and M=17 selects `M_LEQ_32`. The timing used the aiter in the gfx1250 image with the config passed explicitly, not a build of this branch; the kernel is the same.

Unverified on this head: the large-M buckets were not re-timed (unchanged from the earlier revision), and FP16 and the FlyDSL comparison were not measured.

PR-specific question

The loader takes the first `M_LEQ_x` with M <= x that the file has, so removing the three small buckets sends M <= 16 to `M_LEQ_16`; the buckets from `M_LEQ_32` up are unchanged. The `get_gemm_config` check above confirms the selection at M = 1, 2, 4, 8, 9, 16 and 17.

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.

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

All seven compute_bound entries omit the required waves_per_eu and REGISTER_STORE keys; both must be set to 0 to satisfy the complete-entry rule while preserving wrapper defaults.

1 open issue
What changed in this PR

Adds a shape-specific gfx1250 Gluon GEMM config for DeepSeek-V3/R1’s kv_b_proj at tensor parallelism 1. This changes tuning data only; no kernel or wrapper code changes.

Changes:

  • Adds configuration for N=32768, K=512.
  • Preserves DEFAULT settings for M ≤ 128.
  • Uses compute-bound tiles of 256×128×64 for 128 < M ≤ 256 and 256×256×64 for larger M.
File Description
aiter/​ops/​triton/​configs/​gfx1250/​gluon/​gemm/​gemm_a16w16/​GEMM-A16W16-N=32768-K=512.json Adds shape-specific tile and launch settings across M buckets.

Review effort: Balanced

@zufayu
zufayu requested review from a team and k50112113 November 17, 2026 01:08

@k50112113 k50112113 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.

M_LEQ_1 and M_LEQ_4 should be merged into M_LEQ_8, in M_LEQ_1 you have "num_warps": 1 but the runtime should only be noise compared to "num_warps": 2 Please do a quick test on this and if the runtime does not change a lot, please only keep M_LEQ_8 and remove M_LEQ_1 and M_LEQ_4

@JiaoliangYu

Copy link
Copy Markdown
Contributor Author

I will compare num_warps=1 and 2 for M=1..8 before changing the buckets. The current PR keeps M_LEQ_1, M_LEQ_4 and M_LEQ_8.

The executable MI455X/gfx1250 package compares the current config with a local candidate that removes only M_LEQ_1 and M_LEQ_4. It includes complete M-bucket correctness, bit identity and CUDA graph timing checks. It records raw rounds and repeats the BF16 run independently. The baseline is e9d66dc. The local candidate is 64b263f50f8d6db877f33a37240acfb95296fee3; it has not been pushed to this PR.

I do not have the GPU measurements from this session. I will report the measured difference and run variation before applying the bucket change. The same push separately repairs the gfx950 stand-in setup that failed Standard shard 3, and includes the latest main.

@github-actions github-actions Bot changed the title [Triton/Gluon] [Config] [gfx1250] gemm_a16w16: add N=32768 K=512 config (DeepSeek kv_b_proj) [Triton/Gluon] [FlyDSL] [gfx1250] gemm_a16w16: add N=32768 K=512 config (DeepSeek kv_b_proj) Nov 18, 2026
@github-actions github-actions Bot added FlyDSL and removed Config labels Nov 18, 2026
@k50112113

Copy link
Copy Markdown
Contributor

one quick question why do you have op_tests/flydsl_tests/test_flydsl_allreduce_rank_agreement.py change? Also please measure the M 1 2 4 8 to make sure we don't need those small M bucket thanks.

…nfig

Drop M_LEQ_1, M_LEQ_4 and M_LEQ_8: on MI455X the M_LEQ_16 config
(BLOCK_N 32, 2 warps) is the fastest at M=2..8 and within 0.1 us at M=1,
bit-identical. Also drop the rank-agreement fixture line; main fixed that
test in ROCm#8117.
@JiaoliangYu

Copy link
Copy Markdown
Contributor Author

@k50112113 Thanks, both addressed in 1603337.

  1. Small-M buckets: measured at M=1..8 on MI455X (gfx1250), bf16, N=32768 K=512, each bucket's config called directly (do_bench_cudagraph, 11 interleaved rounds, median us). All four configs give bit-identical outputs.
M M_LEQ_1 (BN 16, 1 warp) M_LEQ_4 (BN 16, 2 warps) M_LEQ_8 (BN 16, 2 warps) M_LEQ_16 (BN 32, 2 warps)
1 3.37 4.94 4.88 3.47
2 3.50 5.24 5.20 3.50
3 3.77 5.71 5.54 3.69
4 3.89 5.47 5.43 3.60
5 4.17 5.65 5.56 3.73
6 4.22 5.67 5.90 3.95
7 4.30 5.95 6.02 4.05
8 4.62 5.81 5.81 4.02

You were right that the small buckets are not needed, but merging them into M_LEQ_8 would slow M=1 from 3.37 to 4.88 us: the BN 16 / 2-warp config is the slowest at every M. The M_LEQ_16 config is the fastest at M=2..8 and within 0.1 us at M=1, so I removed M_LEQ_1, M_LEQ_4 and M_LEQ_8, and M<=16 now takes M_LEQ_16 (checked through get_gemm_config).

  1. test_flydsl_allreduce_rank_agreement.py: when this branch merged main on 11-18, _init_fly_rms read self._is_gfx1250, which that test's __new__-built communicator lacks, so the test failed here. custom_all_reduce: set _dcp_merge_max_rows in __init__, not in _init_fly_rms #8117 moved that read into __init__, so the line is no longer needed and is removed; the file now matches main.

@github-actions github-actions Bot changed the title [Triton/Gluon] [FlyDSL] [gfx1250] gemm_a16w16: add N=32768 K=512 config (DeepSeek kv_b_proj) [Triton/Gluon] [Config] [gfx1250] gemm_a16w16: add N=32768 K=512 config (DeepSeek kv_b_proj) Nov 22, 2026
@github-actions github-actions Bot added Config and removed FlyDSL labels Nov 22, 2026

@valarLip valarLip left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

✅ LGTM

The file is the one the gfx1250 Gluon gemm_a16w16 wrapper loads for N=32768, K=512. Replaying get_gemm_config on CPU gives:

  • M ≤ 16 → M_LEQ_16 (16x32x512, 2 warps)
  • M 17-128 → DEFAULT's buckets, copied unchanged
  • M 129-256 → 256x128x64 compute_bound
  • M 257-8192 → 256x256x64 compute_bound
  • M > 8192 → any

Copying DEFAULT's M ≤ 128 buckets is needed: without DEFAULT_FALLBACK, it is what lets M ≤ 8 take the faster M_LEQ_16 tile.

Every entry has exactly DEFAULT.json's key set. K=512 divides every BLOCK_K. NUM_BUFFERS=4 passes the compute_bound static assert (≥2), and REGISTER_STORE=0 / waves_per_eu=0 match the wrapper defaults. Both tiles are already used in sibling gfx1250 configs.

@k50112113's asks are addressed at 1603337:

  • M_LEQ_1, M_LEQ_4 and M_LEQ_8 are gone, with M=1..8 timings showing M_LEQ_16 fastest at M=2..8 and within 0.1 µs at M=1.
  • The flydsl test change is reverted (fixed on main by #8117).

Please re-review or dismiss the change request so this can merge.

Reviewed at 1603337. Squash note for merge: drop the reverted "[FlyDSL] initialize the gfx950 fused rank-test fixture" line, and do not keep "M<=128 keeps the DEFAULT entries".

@valarLip valarLip left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved at 1603337, see the LGTM comment above.

@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 4d5ca03 into ROCm:main Nov 24, 2026
76 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.

7 participants