Skip to content

[Triton/Gluon] [Config] Use the M_LEQ_8192 config as "any" in the tuned gfx1250 Gluon GEMM files - #6921

Merged
azaidy merged 1 commit into
mainfrom
satya/gluon_gemm_any_m8192
Oct 28, 2026
Merged

azaidy merged 1 commit into
mainfrom
satya/gluon_gemm_any_m8192

Conversation

@Boss2002n

@Boss2002n Boss2002n commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

In each changed config file, "any" is now a copy of "M_LEQ_8192" - No other bucket changes

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

@Boss2002n
Boss2002n marked this pull request as ready for review October 25, 2026 23:44
@Boss2002n
Boss2002n requested review from a team and a balanced review from Copilot October 25, 2026 23:44

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

One updated fallback omits a key required by the family configuration rules.

1 open issue
What changed in this PR

This PR updates AITER’s tuned gfx1250 Gluon GEMM fallbacks to reuse each file’s M_LEQ_8192 configuration for any.

Changes:

  • Updates fallback tile sizes and launch settings across six GEMM families.
  • Switches several A16W16 fallbacks to compute-bound kernels.
  • Leaves all named M buckets unchanged.

All paths below are relative to aiter/ops/triton/configs/gfx1250/gluon/gemm/. Tile sizes refer to the updated any entry.

File Description
gemm_afp4wfp4_preshuffled/​GEMM-AFP4WFP4_PRESHUFFLED-N=8192-K=8192.json Uses 1024×1024 tiles and 16 CTAs.
gemm_afp4wfp4_preshuffled/​GEMM-AFP4WFP4_PRESHUFFLED-N=8192-K=28672.json Uses 1024×1024 tiles and 16 CTAs.
gemm_afp4wfp4_preshuffled/​GEMM-AFP4WFP4_PRESHUFFLED-N=7168-K=8192.json Uses 1024×512 tiles and 8 CTAs.
gemm_afp4wfp4_preshuffled/​GEMM-AFP4WFP4_PRESHUFFLED-N=7168-K=2048.json Uses 1024×512 tiles and three buffers.
gemm_afp4wfp4_preshuffled/​GEMM-AFP4WFP4_PRESHUFFLED-N=7168-K=18432.json Uses 1024×1024 tiles and 16 CTAs.
gemm_afp4wfp4_preshuffled/​GEMM-AFP4WFP4_PRESHUFFLED-N=7168-K=16384.json Uses 1024×1024 tiles and 16 CTAs.
gemm_afp4wfp4_preshuffled/​GEMM-AFP4WFP4_PRESHUFFLED-N=6144-K=4096.json Uses 1024×512 tiles and three buffers.
gemm_afp4wfp4_preshuffled/​GEMM-AFP4WFP4_PRESHUFFLED-N=57344-K=8192.json Uses 1024×1024 tiles and 16 CTAs.
gemm_afp4wfp4_preshuffled/​GEMM-AFP4WFP4_PRESHUFFLED-N=4096-K=7168.json Uses 1024×1024 tiles and 16 CTAs.
gemm_afp4wfp4_preshuffled/​GEMM-AFP4WFP4_PRESHUFFLED-N=4096-K=4096.json Uses 1024×1024 tiles and 16 CTAs.
gemm_afp4wfp4_preshuffled/​GEMM-AFP4WFP4_PRESHUFFLED-N=4096-K=14336.json Uses 1024×1024 tiles and 16 CTAs.
gemm_afp4wfp4_preshuffled/​GEMM-AFP4WFP4_PRESHUFFLED-N=36864-K=7168.json Uses 1024×512 tiles and 8 CTAs.
gemm_afp4wfp4_preshuffled/​GEMM-AFP4WFP4_PRESHUFFLED-N=32768-K=512.json Uses 512×1024 tiles and 8 CTAs.
gemm_afp4wfp4_preshuffled/​GEMM-AFP4WFP4_PRESHUFFLED-N=28672-K=4096.json Uses 512×512 tiles and 4 CTAs.
gemm_afp4wfp4_preshuffled/​GEMM-AFP4WFP4_PRESHUFFLED-N=24576-K=1536.json Uses 512×1024 tiles and 8 CTAs.
gemm_afp4wfp4_preshuffled/​GEMM-AFP4WFP4_PRESHUFFLED-N=2112-K=7168.json Uses 512×512 tiles and three buffers.
gemm_afp4wfp4_preshuffled/​GEMM-AFP4WFP4_PRESHUFFLED-N=18432-K=16384.json Uses 1024×1024 tiles and 16 CTAs.
gemm_afp4wfp4_preshuffled/​GEMM-AFP4WFP4_PRESHUFFLED-N=16384-K=53248.json Uses 512×1024 tiles and 8 CTAs.
gemm_afp4wfp4_preshuffled/​GEMM-AFP4WFP4_PRESHUFFLED-N=16384-K=16384.json Uses 1024×1024 tiles and 16 CTAs.
gemm_afp4wfp4_preshuffled/​GEMM-AFP4WFP4_PRESHUFFLED-N=12288-K=1536.json Uses 1024×512 tiles and 8 CTAs.
gemm_afp4wfp4_preshuffled/​GEMM-AFP4WFP4_PRESHUFFLED-N=106496-K=16384.json Uses 2048×512 tiles and 16 CTAs.
gemm_afp4wfp4_preshuffled/​GEMM-AFP4WFP4_PRESHUFFLED-N=10240-K=8192.json Uses 1024×256 tiles and three buffers.
gemm_a8w8_blockscale/​GEMM-A8W8_BLOCKSCALE-N=7168-K=8192.json Uses 128×128 tiles and grouped scheduling.
gemm_a8w8_blockscale/​GEMM-A8W8_BLOCKSCALE-N=7168-K=2048.json Uses 128×128 tiles and two warps.
gemm_a8w8_blockscale/​GEMM-A8W8_BLOCKSCALE-N=7168-K=18432.json Uses 128×128 tiles and two warps.
gemm_a8w8_blockscale/​GEMM-A8W8_BLOCKSCALE-N=7168-K=16384.json Uses 128×128 tiles and two warps.
gemm_a8w8_blockscale/​GEMM-A8W8_BLOCKSCALE-N=4096-K=7168.json Uses 128×128 tiles and revised wave settings.
gemm_a8w8_blockscale/​GEMM-A8W8_BLOCKSCALE-N=36864-K=7168.json Uses 128×128 tiles and grouped scheduling.
gemm_a8w8_blockscale/​GEMM-A8W8_BLOCKSCALE-N=32768-K=512.json Uses 256×128 tiles and two warps.
gemm_a8w8_blockscale/​GEMM-A8W8_BLOCKSCALE-N=24576-K=1536.json Uses 256×128 tiles and two warps.
gemm_a8w8_blockscale/​GEMM-A8W8_BLOCKSCALE-N=2112-K=7168.json Uses 128×128 tiles and revised grouping.
gemm_a8w8_blockscale/​GEMM-A8W8_BLOCKSCALE-N=16384-K=512.json Uses 256×128 tiles and two warps.
gemm_a8w8_blockscale/​GEMM-A8W8_BLOCKSCALE-N=12288-K=1536.json Uses 256×128 tiles and four buffers.
gemm_a8w8_blockscale_preshuffled/​GEMM-A8W8_BLOCKSCALE_PRESHUFFLED-N=7168-K=8192.json Uses 128×128 tiles and three buffers.
gemm_a8w8_blockscale_preshuffled/​GEMM-A8W8_BLOCKSCALE_PRESHUFFLED-N=7168-K=2048.json Uses 128×128 tiles and four buffers.
gemm_a8w8_blockscale_preshuffled/​GEMM-A8W8_BLOCKSCALE_PRESHUFFLED-N=7168-K=18432.json Uses 128×128 tiles and two warps.
gemm_a8w8_blockscale_preshuffled/​GEMM-A8W8_BLOCKSCALE_PRESHUFFLED-N=7168-K=16384.json Updates grouping and buffer count.
gemm_a8w8_blockscale_preshuffled/​GEMM-A8W8_BLOCKSCALE_PRESHUFFLED-N=4096-K=7168.json Uses 128×128 tiles and revised grouping.
gemm_a8w8_blockscale_preshuffled/​GEMM-A8W8_BLOCKSCALE_PRESHUFFLED-N=36864-K=7168.json Uses 256×128 tiles and revised grouping.
gemm_a8w8_blockscale_preshuffled/​GEMM-A8W8_BLOCKSCALE_PRESHUFFLED-N=32768-K=512.json Uses 256×128 tiles and two warps.
gemm_a8w8_blockscale_preshuffled/​GEMM-A8W8_BLOCKSCALE_PRESHUFFLED-N=24576-K=1536.json Uses 256×128 tiles and four buffers.
gemm_a8w8_blockscale_preshuffled/​GEMM-A8W8_BLOCKSCALE_PRESHUFFLED-N=2112-K=7168.json Uses 128×128 tiles and grouped scheduling.
gemm_a8w8_blockscale_preshuffled/​GEMM-A8W8_BLOCKSCALE_PRESHUFFLED-N=16384-K=512.json Uses 256×128 tiles and two warps.
gemm_a8w8_blockscale_preshuffled/​GEMM-A8W8_BLOCKSCALE_PRESHUFFLED-N=12288-K=1536.json Uses 128×128 tiles and two warps.
gemm_a16w16/​GEMM-A16W16-N=5120-K=2880.json Selects compute-bound execution with 256×128 tiles.
gemm_a16w16/​GEMM-A16W16-N=2880-K=4096.json Selects compute-bound execution with 256×128 tiles.
gemm_a16w16/​GEMM-A16W16-N=256-K=7168.json Selects compute-bound execution with six buffers.
gemm_a16w16/​GEMM-A16W16-N=128-K=5120.json Selects compute-bound execution with 64×64 tiles.
gemm_a16w16/​GEMM-A16W16-N=128-K=4096.json Selects compute-bound execution with five buffers.
gemm_a16w16/​GEMM-A16W16-N=128-K=2880.json Uses 64×64 tiles and a larger K block.
gemm_a16w16_persistent/​GEMM-A16W16-PERSISTENT-N=5120-K=2880.json Uses 128×256 tiles and a smaller K block.
gemm_a16w16_persistent/​GEMM-A16W16-PERSISTENT-N=2880-K=4096.json Uses 256×128 tiles and a smaller K block.
gemm_a16w16_persistent/​GEMM-A16W16-PERSISTENT-N=256-K=7168.json Uses 64×128 tiles and five buffers.
gemm_a16w16_persistent/​GEMM-A16W16-PERSISTENT-N=128-K=5120.json Uses 64×64 tiles and five buffers.
gemm_a16w16_persistent/​GEMM-A16W16-PERSISTENT-N=128-K=4096.json Uses 64×64 tiles and five buffers.
gemm_a16w16_persistent/​GEMM-A16W16-PERSISTENT-N=128-K=2880.json Uses 64×64 tiles and a larger K block.
batched_gemm_a16w8/​BATCHED_GEMM-A16W8-B=128-N=512-K=128.json Widens N tiles and updates workgroup settings.
batched_gemm_a16w8/​BATCHED_GEMM-A16W8-B=128-N=128-K=512.json Reduces K blocks and updates workgroup settings.

Review effort: Balanced

@zufayu
zufayu requested review from a team and azaidy October 26, 2026 01:05

@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 c8cb22b into main Oct 28, 2026
183 checks passed
@azaidy
azaidy deleted the satya/gluon_gemm_any_m8192 branch October 28, 2026 14:56
solinzby1 pushed a commit that referenced this pull request Nov 2, 2026
azaidy pushed a commit that referenced this pull request Nov 11, 2026
…with rotating weights; LM-head files (#7289)

* gfx1250 gluon gemm_a16w16 compute_bound: register-store epilogues, chosen per config entry (REGISTER_STORE)

The compute_bound kernel ended with the gfx1250 B1 pattern: the tile is staged in LDS
(ds_store), a workgroup barrier, then tensor_store_from_lds, whose LDS read can miss
the waves' ds_stores on gfx1250 (no documented wait or fence closes it; B1a-B1c).
A config entry may now pick the epilogue with "REGISTER_STORE":
  0 the LDS-staged TDM store (default: every existing entry is unchanged),
  1 buffer stores straight from the WMMA layout (as the bandwidth_bound kernel),
  2 coalesced register store: convert_layout to a blocked layout of 16-byte
    vectors along N (an ordinary ds_store/barrier/ds_load round trip), then
    buffer stores rebased to the block in int64.
AITER_GFX1250_A16W16_STORE=<0|1|2> overrides every entry (A/B only).

Cost vs the TDM store at gpt-oss's existing entries (gfx1250 DPX partition, bf16,
bias): mode 2 +0..5 % at M 256-8192, -24 % at O M=64 (30.1 -> 22.9 us), -12 % at QKV
M=16; mode 1 +3..16 % at M >= 256.

Plan: perf1101 P1 (B1 prerequisite of the large-M a16w16 dispatch)

* gfx1250 gluon gemm_a16w16: gpt-oss large-M buckets (M_BOUNDS to 32768), retuned 4096/8192, TP2 shape files

gpt-oss's QKV (N5120 K2880), O (N2880 K4096) and router (N128 K2880) files stopped at
M_LEQ_8192 and the loader searched only the standard bounds, so every prefill batch
above 8192 tokens (chunk 16384: 94 % of 70k/300 prefill batches, 12 % at 8k/1k c64
with mixed chunk) ran the 'any' entry, bandwidth_bound 128x128x64. The TP2 shapes
(QKV N2560 K2880, O N2880 K2048) had no file at all and ran DEFAULT.json at every M.

- QKV and O: M_BOUNDS up to 32768; M_LEQ_4096/8192/16384/32768 = compute_bound
  256x256x64, 4 buffers, 8 warps, waves_per_eu 1, coalesced register store
  (REGISTER_STORE 2: no new LDS-staged TDM store epilogue). Best of 126 candidates
  at M 16384 (BLOCK_K dividing K), and faster than the old 4096/8192 entries.
- Router: M_BOUNDS to 32768; M_LEQ_8192/16384/32768 = compute_bound 128x128x64,
  4 buffers, 4 warps, register store.
- TP2 QKV and O: new files with DEFAULT_FALLBACK (DEFAULT.json keeps M <= 128):
  M_LEQ_256..1024 = compute_bound 128x128x64, 2048..32768 = 256x256x64, register store.

Kernel time, old file -> new (us, bf16 + bias, one gfx1250 DPX partition, A-B-A):
  QKV  M 7500 340 -> 302, 8192 365 -> 307, 16384 3278 -> 618, 32768 6567 -> 1230
  O    M 7500 288 -> 246, 8192 293 -> 249, 16384 2643 -> 503, 32768 5252 -> 1020
  router M 8192 26.7 -> 18.9, 16384 101.5 -> 26.9
  TP2 QKV M 1024 51.5 -> 26.4, 7500 843 -> 167, 16384 1684 -> 308
  TP2 O   M 1024 43.9 -> 21.0, 7500 719 -> 132, 16384 1453 -> 267
Other buckets unchanged. fp32-reference max rel err 0.003 (same as before); CUDA-graph
replay bitwise equal over 6000 calls per shape at M 8192/9000/16384/16385.

Plan: perf1101 P1 (large-M a16w16 dispatch; router separately; TP2 files added)

* gfx1250 gluon gemm_a16w16 compute_bound: share the register-store code, validate the store mode

Review follow-up (perf1101 P1, codex round 1, findings 3-4): REGISTER_STORE outside
{0, 1, 2} is rejected (ValueError on the host, static_assert in the kernel) instead of
falling to the TDM store; the two register-store modes share one store helper; the
store layout helper drops its unused BLOCK_M; the comment states the override's scope
(non-persistent gluon compute_bound launches; unset in serving).
Same kernels, same outputs: P1's correctness check passes unchanged (55 shape/M
cases, old vs new bitwise equal, 2,000 replayed calls each); mode-2 store cost at the
shipped 256x256 tile 1.012-1.014 of the TDM store.

Plan: perf1101 P1 (review round 1)

* gfx1250 gluon gemm_a16w16: gpt-oss band starts without regressions (O 2049-3072, TP2 129-1536, 2049-3072)

Review follow-up (perf1101 P1, codex round 1, finding 2): a dense A-B-A over every
changed band showed four band starts slower than the old schedule (O M 2049 +16 %,
TP2 QKV M 1025 +9 %, TP2 O M 2049 +5 %, M 257 +3 %): 256x256 tiles just past a
bound leave most of a tile empty. Per-band sweep of eight register-store tiles:
  O (TP1): new bound 3072, M_LEQ_3072 = 128x128x64 (2049-3072: 0.91-0.95 of old).
  TP2 QKV: new bound 1536; M_LEQ_256 = 128x64x64, M_LEQ_512 = 128x128x128,
           M_LEQ_1024/1536 = 128x128x64, M_LEQ_2048 = 256x256x64.
  TP2 O:   new bound 3072; M_LEQ_256 = 128x64x64, M_LEQ_512 = 128x128x128,
           M_LEQ_1024 = 128x128x64, M_LEQ_2048 = 256x256x64, M_LEQ_3072 = 128x128x64.
All compute_bound, 4 buffers, 4 warps (256x256: 8 warps), coalesced register store.
Dense A-B-A (TP1 20 M from 2048 to 32768, TP2 28 M from 128 to 32768): new/old
0.17-1.01 everywhere, no point above 1.02. Old vs new outputs bitwise equal at every
band boundary (65 cases, same K order); 2,000 replayed calls each, 0 mismatches.

Plan: perf1101 P1 (review round 1)

* gfx1250 gluon gemm_a16w16: move the TP2 gpt-oss shape files into the 96-CU tree (pure git mv)

They were tuned on a 96-CU DPX partition, and since #6573 a 96-CU device reads
configs/gfx1250/96cu/gluon/gemm/gemm_a16w16/ whole: in the plain tree no DPX
device ever loaded them (configs/AGENTS.md, CU trees).

* gfx1250 gluon gemm_a16w16: the gpt-oss QKV, O and router entries go in the 96-CU tree

The retuned QKV (N 5120, K 2880), O (N 2880, K 4096) and router (N 128, K 2880)
tables were measured on a 96-CU DPX partition, which reads only the 96cu tree,
so on main they were never used there (Copilot, #7288). The 96cu files hold
these tables whole (buckets this PR did not retune keep #6921's values); the
plain-tree files go back to main's, so devices that read the plain tree see no
change from this PR.

* gfx1250 gluon gemm_a16w16: let the tuner search and keep REGISTER_STORE

The tuner's keys are the union of the family DEFAULT.json's keys, and
write_best_configs.py writes only those keys into a bucket. Neither gluon
DEFAULT.json (plain or 96cu) had REGISTER_STORE, so the tuner never searched it
and a retuned bucket silently lost it, going back to the LDS + TDM-store
epilogue (Copilot, #7288). Every DEFAULT bucket now says REGISTER_STORE 0 (what
it already meant; bandwidth_bound pops and ignores it) and SEARCH_SPACE offers
0, 1, 2.

* gfx1250 gluon gemm_a16w16: black

* gfx1250 gluon gemm_a16w16: test the REGISTER_STORE epilogues through the public wrapper

Modes 0/1/2 on fp16 and bf16, bias on and off, at the gpt-oss bucket edges
(1025, 2049, 3073) and with partial M and N tiles (M 1, 97, 300; N 200); the
AITER_GFX1250_A16W16_STORE override for each mode; an invalid override (3) and
an invalid entry value (5) raise ValueError (Copilot, #7288).  73 passed on
gfx1250 (MI450 DPX partition, 96 CU).

* gfx1250 gluon gemm_a16w16: test the tuned gpt-oss entries and their 96-CU lookup

A 96-CU lookup of the QKV, O, router and TP2 shapes at M 4096-32768 must land on
tuned compute_bound entries (on the PR as filed it landed on the 96cu
DEFAULT's untuned bandwidth_bound rows), and every gpt-oss shape
must compute the right result at M 1, 64, 1000, 2049, 3073 and 8192 through the
tuned lookup.

* gfx1250 gluon gemm_a16w16: read the 96-CU gpt-oss tables as gfx1250

The lookup test passed cu_num=96 and left the arch as the runner's, so MI35X asked for a gfx950 Gluon default that is not in the tree.

* gfx1250 gluon gemm_a16w16: gpt-oss decode buckets and LM-head tuning, stacked on the REGISTER_STORE PR

Rebuilt on top of pr-gfx1250-gemm-a16w16-large-m-regstore so the shared commits are not duplicated.
Only the gpt-oss decode buckets, the LM-head shape files and the 96-CU lookup test differ from that branch.

* gfx1250 gluon gemm_a16w16: drop the hardware-bug notes from the store comments
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.

3 participants