Skip to content

[FlyDSL] [gfx1250] TDM HGEMM: FP32 cluster split-K, and DSV4.1 BF16 rows where TDM measures faster - #8031

Merged
valarLip merged 25 commits into
ROCm:mainfrom
xytpai:xyt/gfx1250-fp32-cluster-splitk-20261116
Nov 27, 2026
Merged

valarLip merged 25 commits into
ROCm:mainfrom
xytpai:xyt/gfx1250-fp32-cluster-splitk-20261116

Conversation

@xytpai

@xytpai xytpai commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

On gfx1250 the TDM HGEMM kernel reduces split-K partials in FP32 inside a cluster, and 111 DeepSeek-V4.1 BF16 rows plus the five Qwen 3.5 TDM rows use it. Every row that changes kernel was re-timed against the row it replaces in one session.

Motivation

  • The BF16 split-K paths rounded each partial to BF16 (workspace) or added partials with packed BF16 atomics in arrival order (tdma/tdmia). The second is not deterministic and both lose the fractional part of a partial.
  • The gfx1250 tuner raced TDM only, so the FT/HT kernels could not win a shape they are better at.

Changes

  • Kernel (kernels/gemm_a16w16_tdm_gfx1250.py, gemm_a16w16_tdm.py): split_k > 1 stores FP32 partials to a per-launch workspace with device scope, waits for the wave's stores, passes one cluster barrier, and rank 0 adds the partials in a fixed order. Output is rounded once, then bias is added. split_k = 1 writes the output directly and uses no workspace and no cluster. The packed-atomic reduction and its arguments are removed. Two rocdl.sched_barrier(0) in the compute loop are removed.
  • Policies (gemm_kernels.py): tdm and tdmi (interleaved wave schedule). tdma/tdmia are no longer emitted; a persisted name that still carries one maps to tdm/tdmi.
  • Architectures: flydsl_hgemm_policy_runs_on(policy, gfx) is the one predicate for "this policy has a kernel on this runtime". flydsl_hgemm checks it once for every policy, after the argument checks and before routing, and raises RuntimeError on a False answer (the per-branch gfx checks are gone); the tuned-row lookup skips the row, so a gfx1250-strict runtime that borrows gfx1250 rows falls back instead of raising.
  • Tuner catalog (gemm_a16w16_policy.py): the gfx1250 race for same-dtype output is TDM plus the original FT/HT configs; block_n 160 is added to the TDM grid.
  • Rows: 111 DSV4.1 rows move to TDM (89 from FT/HT, 22 from OPUS). The five Qwen 3.5 rows move from tdma/tdm to tdm on the new kernel.

Performance

gfx1250, 256 CUs, one GPU per run, all arms in one session, run_perftest(num_warmup=10, num_iters=101) per block, arms alternated A B B A. Per-row tables are in the measurement comment below.

Hardware Workload/configuration Before After Change
gfx1250, 256 CUs 89 DSV4.1 BF16 rows, FT/HT row on main vs TDM row, through tuned.gemm_a16w16 1.000 0.92 median (0.69 to 0.997) 8% faster, median
gfx1250, 256 CUs 22 DSV4.1 BF16 rows, OPUS row on main vs TDM row 1.000 0.94 median (0.72 to 0.999) 6% faster, median
gfx1250, 256 CUs 5 Qwen 3.5 rows (M 1 to 16, N 128, K 4096), pre-PR kernel vs this kernel 4.49 to 4.65 µs 3.38 to 3.54 µs 23% to 26% faster
gfx1250, 256 CUs 132 TDM rows, with vs without the two sched_barrier(0) 1.000 0.92 median (0.81 to 1.008) 8% faster, median; outputs bitwise equal

Rows that did not measure faster are not in this PR: 16 rows the tuning run had moved to TDM are back on their previous row (TDM/previous 1.005 to 1.156), and 42 OPUS rows that only changed their recorded time are back to main's text.

How the shipped rows were produced: the tuning run raced TDM candidates only (plus the row's own OPUS kernel for rows that were OPUS), at source 6acacf2, with FlyDSL 0.5.0. It did not race FT/HT. The FT/HT comparison is the same-session A/B above, done afterwards for every row. The us column of the kept rows is from the tuning run, not from the A/B session.

Testing

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

Run on gfx1250 (256 CUs), FlyDSL 0.5.0, at f5ec86c46:

  • python3 -m pytest op_tests/tuning_tests/test_a16w16_tuned_config_lookup.py: 24 passed, 4959 subtests.
  • python3 op_tests/test_flydsl_hgemm.py: exit 0.
  • Split-K stress: 106 TDM rows with split_k > 1, 91,200 launches on two alternating inputs, each output compared bit for bit with the first result for that input: 0 mismatches.
  • black --check (26.5.1) and ruff check (0.16.7) on the changed files: clean.

Review round 2, at 2b070061d, on a gfx1250 node (256 CUs) with the compiled modules of the 2026-11-24 main image (FlyDSL 0.5.3) and this branch's Python sources:

  • python3 -m pytest op_tests/tuning_tests/test_a16w16_tuned_config_lookup.py: 24 passed, 4959 subtests.
  • flydsl_hgemm against a float reference: tdm with split_k 1 and 4, ft, ht (M 64, N 1024, K 2048), and tdmi and tdm with the t256x256x128x2_ks1_w2x2x1 config of a DSV4.1 row (M 160, N 4096, K 5120): rel err 1.65e-3 to 1.67e-3. sk and bs raise RuntimeError: FlyDSL HGEMM policy ... has no kernel for gfx1250.
  • black --check (26.10.1) and ruff check (0.16.0) on the changed files: clean.

Documentation

  • Docstrings updated
  • User guide updated
  • Performance guide updated
  • No documentation change is needed, with the reason stated below

Dependencies

  • No new third-party dependencies added

Breaking Changes

  • flydsl_gemm_a16w16_tdm no longer accepts split_k_atomic and split_k_policy.
  • Kernel names with _ptdma_/_ptdmia_ still parse; they now run the FP32 reduction.

PR Self-Review

Reviewed revision

2b070061d

Behavior and intent

On gfx1250, TDM HGEMM with split_k > 1 now reduces FP32 partials in a cluster in a fixed order; before, partials were rounded to BF16 or added with BF16 atomics in arrival order, which loses precision and (for the atomic path) is not deterministic. The tuner races TDM and FT/HT for same-dtype output; before it raced TDM only. 111 DSV4.1 rows and 5 Qwen 3.5 rows select the TDM kernel. A gfx1250-strict runtime skips TDM rows instead of raising.

Validation and unverified scope

Validated on one gfx1250 machine (256 CUs), FlyDSL 0.5.0: the commands and results under Testing, and the same-session A/B under Performance (ab.py rows|barrier|qwen|stress, results posted in the measurement comment).

Remains unverified (not run):

  • op_tests/test_flydsl_hgemm.py was not rerun at 2b070061d; that revision only moves the architecture check and changes two test lines, and the checks under Testing cover the moved check.
  • No run on gfx1250-strict hardware. The strict behaviour is covered by tests that patch the runtime name.
  • No gfx950 or gfx942 run; those paths change only through shared dispatch code, covered by the lookup tests.
  • OPUS rows in the A/B ran from the OPUS module built into the test image, not rebuilt from this tree.
  • The A/B is one session on one machine. The us values in the CSV are from the earlier tuning sessions.
  • The illegal instruction on GPU 0 and the page fault at row 371 during the tuning run are not explained. The stress run here did not reproduce them.
  • No end-to-end model run.

PR-specific question

Workload keys that consume the configuration changes: 111 keys in dsv41_bf16_tuned_gemm.csv and 5 keys in qwen3_5_397b_bf16_tuned_gemm.csv. All are gfx1250, 256 CUs, BF16 input and output, no bias, no scaling, no preshuffle. The DSV4.1 keys are listed with their before and after times in the measurement comment; the Qwen keys are M 1, 2, 4, 8, 16 with N 128, K 4096.

Unrelated shapes keep their previous selection:

  • Against main, the two CSVs differ in exactly those 116 rows. No key is added or removed (390 and 141 rows), and every other row is byte-identical to main. The lookup matches the full key, so no other shape can reach a changed row.
  • The FT/HT, OPUS and Triton kernels are not changed. Only the TDM kernel is, and on main the only rows that select it are the five Qwen rows above.
  • On a gfx1250-strict runtime the five Qwen keys change behaviour: they raised in flydsl_hgemm, and now the lookup skips the TDM row and the default path runs. The 111 DSV4.1 keys fall back the same way there.

Selection boundary of the changed kernel: TDM runs only on a gfx1250 runtime, for BF16 or FP16 input with the same output dtype, k_waves = 1, and a tile that validate_gemm_gfx1250_config accepts. The name parser rejects any other name and flydsl_hgemm raises for any other runtime or dtype. FP32 output keeps the FT/HT path.

Changed op tests

  • op_tests/test_flydsl_hgemm.py: test_hgemm_tdm and test_hgemm_tdm_tuned run the TDM kernel directly and through the tuned dispatch for both schedules and for split_k 1, 3 and 8 with guard pages; check_tdm_contracts checks rejected inputs and that fractional partials survive the FP32 workspace (the old same-dtype partials rounded them away); run_torch_tdm is their reference. They are the only on-device coverage of the new reduction.
  • op_tests/tuning_tests/test_a16w16_tuned_config_lookup.py: name round-trips for tdm/tdmi and the mapping of removed names; the catalog contains both backends, with one concrete name of each; every TDM row in the CSVs routes to the TDM wrapper on gfx1250 and is refused on gfx1250-strict; the lookup skips a borrowed TDM row on gfx1250-strict. At 2b070061d the strict-runtime case matches the single gate's message, and the assertion about the never-shipped _gm0_i{0,1}_p spelling is gone. None of this is covered elsewhere.

@xytpai
xytpai requested a review from a team November 16, 2026 14:06
@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 8031 --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.

@github-actions github-actions Bot changed the title [HIP] [FlyDSL] [gfx1250] Sync BF16/FP16 TDM GEMM with FP32 cluster split-K [FlyDSL] [gfx1250] Sync BF16/FP16 TDM GEMM with FP32 cluster split-K Nov 16, 2026
@aiter-bot

aiter-bot commented Nov 16, 2026 •

Copy link
Copy Markdown

READY FOR HUMAN REVIEW

PR Self-Review

Revision 2b070061dfc4 · 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

On gfx1250, TDM HGEMM with split_k > 1 now reduces FP32 partials in a cluster in a fixed order; before, partials were rounded to BF16 or added with BF16 atomics in arrival order, which loses precision and (for the atomic path) is not deterministic. The tuner races TDM and FT/HT for same-dtype output; before it raced TDM only. 111 DSV4.1 rows and 5 Qwen 3.5 rows select the TDM kernel. A gfx1250-strict runtime skips TDM rows instead of raising.

Validation and unverified scope

Validated on one gfx1250 machine (256 CUs), FlyDSL 0.5.0: the commands and results under Testing, and the same-session A/B under Performance (`ab.py rows|barrier|qwen|stress`, results posted in the measurement comment).

Remains unverified (not run):
- `op_tests/test_flydsl_hgemm.py` was not rerun at `2b070061d`; that revision only moves the architecture check and changes two test lines, and the checks under Testing cover the moved check.
- No run on gfx1250-strict hardware. The strict behaviour is covered by tests that patch the runtime name.
- No gfx950 or gfx942 run; those paths change only through shared dispatch code, covered by the lookup tests.
- OPUS rows in the A/B ran from the OPUS module built into the test image, not rebuilt from this tree.
- The A/B is one session on one machine. The `us` values in the CSV are from the earlier tuning sessions.
- The illegal instruction on GPU 0 and the page fault at row 371 during the tuning run are not explained. The stress run here did not reproduce them.
- No end-to-end model run.

PR-specific question

Workload keys that consume the configuration changes: 111 keys in `dsv41_bf16_tuned_gemm.csv` and 5 keys in `qwen3_5_397b_bf16_tuned_gemm.csv`. All are `gfx1250`, 256 CUs, BF16 input and output, no bias, no scaling, no preshuffle. The DSV4.1 keys are listed with their before and after times in the measurement comment; the Qwen keys are M 1, 2, 4, 8, 16 with N 128, K 4096.

Unrelated shapes keep their previous selection:
- Against main, the two CSVs differ in exactly those 116 rows. No key is added or removed (390 and 141 rows), and every other row is byte-identical to main. The lookup matches the full key, so no other shape can reach a changed row.
- The FT/HT, OPUS and Triton kernels are not changed. Only the TDM kernel is, and on main the only rows that select it are the five Qwen rows above.
- On a `gfx1250-strict` runtime the five Qwen keys change behaviour: they raised in `flydsl_hgemm`, and now the lookup skips the TDM row and the default path runs. The 111 DSV4.1 keys fall back the same way there.

Selection boundary of the changed kernel: TDM runs only on a `gfx1250` runtime, for BF16 or FP16 input with the same output dtype, `k_waves` = 1, and a tile that `validate_gemm_gfx1250_config` accepts. The name parser rejects any other name and `flydsl_hgemm` raises for any other runtime or dtype. FP32 output keeps the FT/HT path.

Changed op tests

- `op_tests/test_flydsl_hgemm.py`: `test_hgemm_tdm` and `test_hgemm_tdm_tuned` run the TDM kernel directly and through the tuned dispatch for both schedules and for split_k 1, 3 and 8 with guard pages; `check_tdm_contracts` checks rejected inputs and that fractional partials survive the FP32 workspace (the old same-dtype partials rounded them away); `run_torch_tdm` is their reference. They are the only on-device coverage of the new reduction.
- `op_tests/tuning_tests/test_a16w16_tuned_config_lookup.py`: name round-trips for `tdm`/`tdmi` and the mapping of removed names; the catalog contains both backends, with one concrete name of each; every TDM row in the CSVs routes to the TDM wrapper on gfx1250 and is refused on gfx1250-strict; the lookup skips a borrowed TDM row on gfx1250-strict. At `2b070061d` the strict-runtime case matches the single gate's message, and the assertion about the never-shipped `_gm0_i{0,1}_p` spelling is gone. None of this is covered elsewhere.

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.

@xytpai xytpai changed the title [FlyDSL] [gfx1250] Sync BF16/FP16 TDM GEMM with FP32 cluster split-K [FlyDSL] [gfx1250] Unify FP32 cluster TDM policy and retune existing BF16 configs Nov 16, 2026
@github-actions github-actions Bot changed the title [FlyDSL] [gfx1250] Unify FP32 cluster TDM policy and retune existing BF16 configs [HIP] [FlyDSL] [gfx1250] Unify FP32 cluster TDM policy and retune existing BF16 configs Nov 16, 2026
@github-actions github-actions Bot added the HIP label Nov 16, 2026
@xytpai
xytpai force-pushed the xyt/gfx1250-fp32-cluster-splitk-20261116 branch from 584421b to c23cfe1 Compare November 16, 2026 14:33
@xytpai xytpai changed the title [HIP] [FlyDSL] [gfx1250] Unify FP32 cluster TDM policy and retune existing BF16 configs [FlyDSL] [gfx1250] FP32 cluster TDM and native BF16 retuning with FT/HT candidates Nov 16, 2026
@github-actions github-actions Bot changed the title [FlyDSL] [gfx1250] FP32 cluster TDM and native BF16 retuning with FT/HT candidates [HIP] [FlyDSL] [gfx1250] FP32 cluster TDM and native BF16 retuning with FT/HT candidates Nov 16, 2026
@zufayu
zufayu requested review from aoli26 and coderfeli November 17, 2026 01:06
@github-actions github-actions Bot changed the title [HIP] [FlyDSL] [gfx1250] FP32 cluster TDM and native BF16 retuning with FT/HT candidates [FlyDSL] [gfx1250] FP32 cluster TDM and native BF16 retuning with FT/HT candidates Nov 24, 2026
@github-actions github-actions Bot removed the HIP label Nov 24, 2026
@XiaobingSuper

Copy link
Copy Markdown
Contributor

PR 8031: same-session measurements (review item 2)

All numbers below were taken on 2026-11-24 in one session on one machine. Each run used one GPU and nothing else ran on that GPU.

Setup

Item Value
GPU gfx1250, 256 compute units (get_gfx_runtime() = gfx1250)
Kernel / driver Linux 6.14.0-34, amdgpu-dkms 7.1.0.31300009-2425321
Software Python 3.12.3, torch 2.11.0+rocm10.1.0a20260811, FlyDSL 0.5.0
Tree this branch at the review-fix commit, on top of main ee51699f2
OPUS rows launched from the OPUS module built into the image (aiter 81e809ff1), not rebuilt from this tree; the lookup resolved every OPUS row to the kernel name in the CSV
Timing aiter.test_common.run_perftest(num_warmup=10, num_iters=101), the call the tuner uses. One block is one such call. Arms alternate A B B A, repeated 3 times; rows that were not clearly faster got 6 more repeats on a second GPU and the blocks were pooled. The number reported is the median block.
Noise Within one arm the blocks spread by 2.1% (median over rows). The 42 OPUS rows that kept their kernel measure old/new 1.000 (0.981 to 1.011).

1. DSV4.1 rows: the row on main against the row this PR proposed

Both rows go through tuned.gemm_a16w16, the production dispatch, with a one-row tuned table.

Previous row Rows New/old, median Range New faster by more than 2% Within 2% New slower by more than 2%
HT 56 0.925 0.691 to 1.063 44 5 7
FT 44 0.926 0.711 to 1.108 42 1 1
OPUS 27 0.963 0.724 to 1.156 20 3 4

Decision taken in this branch: a row stays on TDM only if the pooled new/old is at or below 1.0. 16 rows go back to the row on main; 111 rows stay on TDM. The M=768, N=384, K=5120 row is not counted: main moved it to a Triton row in #7663.

Rows put back (16)

M N K Previous row Previous µs TDM µs TDM/previous Blocks per arm
5120 128 512 OPUS OPUS kid 705 ks0 3.754 4.338 1.156 18
2560 128 512 OPUS OPUS kid 713 ks0 3.553 4.091 1.151 18
768 128 512 FT t16x16x256x3_ks1_w1x1x1_bias0_ktail0_gm0_pft 3.141 3.481 1.108 18
512 384 5120 HT t64x64x128x6_ks5_w4x2x1_bias0_ktail0_gm0_pht 6.666 7.086 1.063 18
480 384 5120 HT t64x64x128x5_ks5_w4x2x1_bias0_ktail0_gm0_pht 6.822 7.162 1.050 18
576 512 5120 HT t64x64x128x4_ks5_w4x2x1_bias0_ktail0_gm0_pht 8.337 8.718 1.046 18
3072 32320 5120 OPUS OPUS kid 715 ks0 396.273 413.890 1.044 18
480 512 5120 HT t64x64x128x5_ks4_w4x2x1_bias0_ktail0_gm0_pht 7.257 7.563 1.042 18
1024 384 5120 HT t64x64x128x4_ks5_w4x2x1_bias0_ktail0_gm0_pht 9.036 9.412 1.042 18
512 512 5120 HT t64x64x128x5_ks4_w4x2x1_bias0_ktail0_gm0_pht 7.543 7.770 1.030 18
2048 129280 5120 OPUS OPUS kid 716 ks0 1161.987 1192.030 1.026 18
672 512 5120 HT t64x64x128x4_ks5_w4x2x1_bias0_ktail0_gm0_pht 8.981 9.167 1.021 18
5120 384 5120 HT t64x128x128x5_ks1_w2x2x1_bias0_ktail0_gm0_pht 21.251 21.633 1.018 18
3072 512 5120 HT t64x128x128x5_ks1_w2x2x1_bias0_ktail0_gm0_pht 19.672 19.939 1.014 18
2048 128 512 OPUS OPUS kid 713 ks0 3.283 3.301 1.005 18
1024 512 5120 HT t64x64x128x4_ks4_w4x2x1_bias0_ktail0_gm0_pht 10.171 10.227 1.005 18

Rows kept on TDM (111): new/old median 0.923, range 0.691 to 0.999; 5 of them are within 2% of the previous row

M N K Previous row Previous µs TDM row TDM µs TDM/previous
6 32 5120 HT 4.042 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 3.676 0.910
12 32 5120 HT 4.219 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 3.676 0.871
18 32 5120 FT 4.162 t16x32x512x3_ks5_w1x2x1_bias0_ktail0_gm0_ptdm 3.648 0.876
24 32 5120 HT 4.098 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 3.545 0.865
30 32 5120 FT 4.170 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 3.569 0.856
36 32 5120 FT 4.203 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 3.611 0.859
42 32 5120 FT 4.205 t16x32x128x6_ks8_w1x2x1_bias0_ktail0_gm0_ptdm 3.563 0.847
48 32 5120 FT 4.266 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 3.665 0.859
72 32 5120 FT 4.337 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 3.670 0.846
96 32 5120 HT 4.393 t16x32x128x6_ks8_w1x2x1_bias0_ktail0_gm0_ptdm 3.643 0.829
128 32 5120 FT 3.886 t16x32x128x6_ks8_w1x2x1_bias0_ktail0_gm0_ptdm 3.571 0.919
144 32 5120 HT 4.436 t16x32x128x6_ks8_w1x2x1_bias0_ktail0_gm0_ptdm 3.651 0.823
192 32 5120 HT 4.146 t16x32x128x6_ks8_w1x2x1_bias0_ktail0_gm0_ptdm 3.638 0.877
240 32 5120 HT 4.606 t16x32x128x6_ks8_w1x2x1_bias0_ktail0_gm0_ptdm 3.716 0.807
256 32 5120 FT 4.013 t16x32x128x6_ks8_w1x2x1_bias0_ktail0_gm0_ptdm 3.729 0.929
288 32 5120 HT 4.671 t16x32x128x6_ks8_w1x2x1_bias0_ktail0_gm0_ptdm 3.768 0.807
336 32 5120 HT 4.789 t16x32x128x6_ks8_w1x2x1_bias0_ktail0_gm0_ptdm 3.752 0.783
384 32 5120 HT 4.146 t16x32x128x6_ks8_w1x2x1_bias0_ktail0_gm0_ptdm 3.830 0.924
480 32 5120 HT 4.954 t16x32x128x6_ks8_w1x2x1_bias0_ktail0_gm0_ptdm 3.905 0.788
512 32 5120 HT 4.256 t16x32x128x6_ks8_w1x2x1_bias0_ktail0_gm0_ptdm 3.924 0.922
576 32 5120 FT 4.811 t16x32x128x6_ks8_w1x2x1_bias0_ktail0_gm0_ptdm 4.009 0.833
672 32 5120 HT 5.180 t16x32x128x6_ks8_w1x2x1_bias0_ktail0_gm0_ptdm 4.089 0.789
768 32 5120 HT 4.588 t16x32x128x6_ks8_w1x2x1_bias0_ktail0_gm0_ptdm 4.155 0.906
1024 32 5120 FT 4.990 t32x32x128x6_ks8_w2x2x1_bias0_ktail0_gm0_ptdm 4.276 0.857
2048 32 5120 HT 7.207 t32x32x128x6_ks8_w2x2x1_bias0_ktail0_gm0_ptdm 4.980 0.691
3072 32 5120 HT 7.678 t32x32x128x7_ks5_w2x2x1_bias0_ktail0_gm0_ptdm 5.782 0.753
4096 32 5120 HT 8.541 t64x32x128x7_ks4_w4x2x1_bias0_ktail0_gm0_ptdm 6.314 0.739
5120 32 5120 FT 9.877 t64x32x256x3_ks5_w4x2x1_bias0_ktail0_gm0_ptdm 7.309 0.740
6144 32 5120 FT 11.331 t64x32x256x3_ks5_w4x2x1_bias0_ktail0_gm0_ptdm 8.052 0.711
16384 32 5120 OPUS 16.708 t64x32x256x5_ks1_w4x2x1_bias0_ktail0_gm4_ptdm 14.495 0.868
40 128 512 FT 3.091 t16x16x256x3_ks1_w1x1x1_bias0_ktail0_gm0_ptdm 2.998 0.970
336 128 512 HT 3.496 t16x16x256x3_ks1_w1x1x1_bias0_ktail0_gm0_ptdm 3.251 0.930
672 128 512 FT 3.559 t32x16x512x2_ks1_w2x1x1_bias0_ktail0_gm0_ptdm 3.399 0.955
1536 128 512 OPUS 3.445 t16x32x256x3_ks1_w1x2x1_bias0_ktail0_gm4_ptdm 3.441 0.999
5 128 5120 FT 3.913 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 3.730 0.953
10 128 5120 HT 3.979 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 3.750 0.943
15 128 5120 HT 4.035 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 3.823 0.948
20 128 5120 FT 4.163 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 3.747 0.900
25 128 5120 HT 4.086 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 3.785 0.926
30 128 5120 HT 4.028 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 3.833 0.952
35 128 5120 FT 4.239 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 3.784 0.893
40 128 5120 FT 4.027 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 3.805 0.945
60 128 5120 HT 4.149 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 3.883 0.936
80 128 5120 FT 4.249 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 3.913 0.921
120 128 5120 FT 4.223 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 4.110 0.973
160 128 5120 FT 4.728 t32x16x256x5_ks5_w2x1x1_bias0_ktail0_gm0_ptdm 4.363 0.923
200 128 5120 FT 4.921 t16x32x128x6_ks8_w1x2x1_bias0_ktail0_gm0_ptdm 4.330 0.880
240 128 5120 FT 5.386 t64x16x128x6_ks8_w4x1x1_bias0_ktail0_gm0_ptdm 4.719 0.876
280 128 5120 FT 5.679 t64x16x256x5_ks5_w4x1x1_bias0_ktail0_gm0_ptdm 4.818 0.848
480 128 5120 FT 5.311 t32x32x128x6_ks8_w2x2x1_bias0_ktail0_gm0_ptdm 5.042 0.949
1 384 5120 FT 4.066 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 3.875 0.953
2 384 5120 HT 4.106 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 3.911 0.952
3 384 5120 HT 4.096 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 3.918 0.957
4 384 5120 HT 4.109 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 3.938 0.958
6 384 5120 FT 4.145 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 3.969 0.957
8 384 5120 FT 4.122 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 3.938 0.955
12 384 5120 FT 4.180 t16x32x128x6_ks8_w1x2x1_bias0_ktail0_gm0_ptdm 4.034 0.965
16 384 5120 FT 4.171 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 3.712 0.890
18 384 5120 HT 4.297 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 3.987 0.928
24 384 5120 FT 4.300 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 4.067 0.946
30 384 5120 HT 4.279 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 4.192 0.980
32 384 5120 HT 4.309 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 3.984 0.925
36 384 5120 FT 4.455 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 4.179 0.938
40 384 5120 HT 4.642 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 4.332 0.933
42 384 5120 FT 4.529 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 4.223 0.932
48 384 5120 FT 4.536 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 4.239 0.934
64 384 5120 OPUS 5.992 t16x32x128x6_ks8_w1x2x1_bias0_ktail0_gm0_ptdm 4.338 0.724
72 384 5120 HT 4.946 t16x64x128x6_ks8_w1x4x1_bias0_ktail0_gm0_ptdm 4.546 0.919
96 384 5120 FT 5.400 t32x32x256x5_ks5_w2x2x1_bias0_ktail0_gm0_ptdm 4.599 0.852
128 384 5120 FT 5.604 t32x32x256x5_ks5_w2x2x1_bias0_ktail0_gm0_ptdm 4.785 0.854
240 384 5120 HT 6.820 t32x64x256x5_ks5_w2x4x1_bias0_ktail0_gm0_ptdm 5.853 0.858
256 384 5120 FT 6.834 t32x64x256x5_ks5_w2x4x1_bias0_ktail0_gm0_ptdm 5.755 0.842
384 384 5120 OPUS 8.495 t48x64x256x5_ks5_w1x4x1_bias0_ktail0_gm0_ptdm 6.694 0.788
2048 384 5120 OPUS 13.773 t128x128x256x2_ks5_w4x4x1_bias0_ktail0_gm0_ptdm 13.360 0.970
3072 384 5120 HT 18.633 t96x128x128x2_ks5_w2x4x1_bias0_ktail0_gm0_ptdm 17.106 0.918
4096 384 5120 OPUS 22.998 t64x128x128x3_ks2_w2x4x1_bias0_ktail0_gm0_ptdm 20.011 0.870
6 512 5120 FT 4.177 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 4.013 0.961
12 512 5120 FT 4.166 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 4.049 0.972
18 512 5120 HT 4.443 t16x32x128x6_ks8_w1x2x1_bias0_ktail0_gm0_ptdm 4.062 0.914
24 512 5120 HT 4.438 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 4.096 0.923
30 512 5120 HT 4.455 t16x16x128x6_ks8_w1x1x1_bias0_ktail0_gm0_ptdm 4.233 0.950
36 512 5120 HT 4.585 t16x32x128x6_ks8_w1x2x1_bias0_ktail0_gm0_ptdm 4.240 0.925
42 512 5120 HT 4.650 t16x32x128x6_ks8_w1x2x1_bias0_ktail0_gm0_ptdm 4.339 0.933
48 512 5120 HT 4.679 t16x32x128x6_ks8_w1x2x1_bias0_ktail0_gm0_ptdm 4.263 0.911
72 512 5120 HT 5.570 t32x32x256x5_ks5_w2x2x1_bias0_ktail0_gm0_ptdm 4.675 0.839
96 512 5120 HT 5.783 t32x32x256x5_ks5_w2x2x1_bias0_ktail0_gm0_ptdm 4.885 0.845
128 512 5120 HT 5.569 t32x32x128x6_ks8_w2x2x1_bias0_ktail0_gm0_ptdm 5.064 0.909
144 512 5120 FT 5.774 t32x64x512x3_ks5_w2x4x1_bias0_ktail0_gm0_ptdm 5.376 0.931
192 512 5120 FT 5.872 t32x64x256x5_ks5_w2x4x1_bias0_ktail0_gm0_ptdm 5.605 0.955
240 512 5120 FT 6.580 t64x32x256x4_ks4_w4x2x1_bias0_ktail0_gm0_ptdm 6.288 0.956
256 512 5120 FT 6.183 t64x32x128x6_ks4_w4x2x1_bias0_ktail0_gm0_ptdm 6.109 0.988
288 512 5120 HT 6.543 t48x64x256x5_ks5_w1x4x1_bias0_ktail0_gm0_ptdm 6.523 0.997
336 512 5120 HT 7.065 t64x64x256x3_ks5_w2x4x1_bias0_ktail0_gm0_ptdm 6.819 0.965
384 512 5120 HT 7.003 t64x64x256x3_ks5_w2x4x1_bias0_ktail0_gm0_ptdm 6.905 0.986
768 512 5120 HT 9.413 t64x128x128x4_ks5_w2x4x1_bias0_ktail0_gm0_ptdm 9.156 0.973
4096 512 5120 OPUS 24.036 t128x128x256x2_ks2_w4x4x1_bias0_ktail0_gm0_ptdm 22.583 0.940
4 32320 5120 OPUS 25.924 t16x128x256x3_ks1_w1x4x1_bias0_ktail0_gm0_ptdm 23.298 0.899
8 32320 5120 OPUS 26.298 t16x128x512x2_ks1_w1x4x1_bias0_ktail0_gm0_ptdm 24.024 0.914
16 32320 5120 OPUS 26.935 t16x128x256x3_ks1_w1x2x1_bias0_ktail0_gm0_ptdm 23.572 0.875
24 32320 5120 OPUS 26.343 t32x128x128x4_ks1_w2x4x1_bias0_ktail0_gm0_ptdm 25.567 0.971
32 32320 5120 OPUS 26.464 t32x128x128x5_ks1_w1x4x1_bias0_ktail0_gm0_ptdm 24.203 0.915
512 32320 5120 OPUS 73.426 t256x256x128x2_ks1_w2x2x1_bias0_ktail0_gm0_ptdmi 71.166 0.969
4096 32320 5120 OPUS 563.662 t256x256x128x2_ks1_w2x2x1_bias0_ktail0_gm4_ptdmi 545.107 0.967
8192 32320 5120 OPUS 1147.364 t256x256x128x2_ks1_w2x2x1_bias0_ktail0_gm4_ptdmi 1145.156 0.998
1 129280 5120 OPUS 79.759 t16x256x128x2_ks1_w1x4x1_bias0_ktail0_gm0_ptdm 76.777 0.963
4 129280 5120 OPUS 80.018 t16x128x128x2_ks1_w1x4x1_bias0_ktail0_gm0_ptdm 75.495 0.943
8 129280 5120 OPUS 80.146 t16x256x128x2_ks1_w1x4x1_bias0_ktail0_gm0_ptdm 77.670 0.969
16 129280 5120 OPUS 81.247 t16x256x128x2_ks1_w1x4x1_bias0_ktail0_gm0_ptdm 76.236 0.938
32 129280 5120 OPUS 82.871 t32x256x128x2_ks1_w1x2x1_bias0_ktail0_gm0_ptdm 80.402 0.970
160 129280 5120 OPUS 145.922 t256x256x128x2_ks1_w2x2x1_bias0_ktail0_gm0_ptdmi 130.829 0.897
256 129280 5120 OPUS 152.960 t256x256x128x2_ks1_w2x2x1_bias0_ktail0_gm0_ptdmi 140.333 0.917

2. The two rocdl.sched_barrier(0) removed from the compute loop

Same kernel, same tile, with and without the two barriers, called through the TDM wrapper with a preallocated output. 132 TDM rows (DSV4.1 and Qwen 3.5).

Rows Without/with, median Range Faster without by more than 2% Within 2% Slower without by more than 2% Outputs bitwise equal
132 0.922 0.806 to 1.008 107 25 0 132 of 132

The rows within 2% are the large shapes (N = 32320 and 129280, and M of 2048 and above), where the kernel is bound by memory, not by the schedule.

3. The five Qwen 3.5 rows

Three arms per row, pre-PR kernel (from the merge base) and this PR's kernel in the same process: the pre-PR kernel with the old tile, the new kernel with the old tile, the new kernel with the new tile. Ten blocks per arm.

M N K Pre-PR reduction Pre-PR kernel, old tile µs New kernel, old tile µs New kernel, new tile µs New/pre-PR Error ratio pre-PR Error ratio new
1 128 4096 BF16 packed atomic 4.494 3.461 3.465 0.771 0.0078 0.0000
2 128 4096 BF16 packed atomic 4.552 3.507 3.520 0.773 0.0195 0.0000
4 128 4096 BF16 packed atomic 4.566 3.508 3.494 0.765 0.0273 0.0000
8 128 4096 BF16 packed atomic 4.646 3.548 3.542 0.762 0.0215 0.0000
16 128 4096 BF16 workspace 4.572 3.378 3.379 0.739 0.0088 0.0000

The gain comes from the kernel. The tile change in these five rows is within 0.5% and could be dropped.

4. Split-K stress

Every shipped TDM row with split_k > 1 at the time of the run (106 rows) was launched repeatedly through tuned.flydsl_gemm on two alternating input sets. The output buffer is filled with NaN before each launch and compared bit for bit with the first result for that input, so a stale partial from the previous launch would show.

Rows Launches Bitwise mismatches Rows with errors Error ratio against the FP32 reference
106 91200 0 0 0.0000 at most

The 22 rows that use t16x32x128x6_ks8 (the kernel the review asks about) ran 3000 launches each; the others 300. This run does not reproduce or explain the earlier illegal instruction on GPU 0 or the page fault in row 371: which kernel was running then is only in the logs of that tuning run.

@XiaobingSuper XiaobingSuper changed the title [FlyDSL] [gfx1250] FP32 cluster TDM and native BF16 retuning with FT/HT candidates [FlyDSL] [gfx1250] TDM HGEMM: FP32 cluster split-K, and DSV4.1 BF16 rows where TDM measures faster Nov 24, 2026
zejunchen-zejun added a commit that referenced this pull request Nov 25, 2026
…M rows for every M bucket up to 1024

Rows for the router (896x7168), latent down (3584x7168) and latent up
(7168x3584) GEMMs of Kimi-K3's latent MoE on gfx1250 / 256 CUs: one row for
every decode M bucket up to 1024 (16-aligned to 256, 32-aligned to 1024), so
no decode M falls through to a power-of-two row.

Each bucket was picked inside a decode-step proxy (92 layers x the three
GEMMs, per-layer weights, CUDA graph) at every multiple of 5 in the bucket,
since DP8EP8 decode with DSpark k=4 gives M = 5 x requests per rank. Step
proxy, every multiple of 5 from M 100 to 960: -4.6% on average, worst +0.6%;
c256 -11.4%, c512 -7.0%, c1024 -9.2%.

The latent rows at M 1/2/4/8 and 2048-32768 are #8348's, with the _i0_ptdm /
_i1_ptdm names written as _ptdm / _ptdmi. The TDM rows need #8031's kernel.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

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

⚠️ Action required before merge (2)

  1. Make flydsl_hgemm_policy_runs_on the one gate, or stop calling it that (follow-up to item 1).
    • The body and commit 79b6913 say it "is the one place that says which policy an architecture can run". The predicate does answer for sk/bs/ft/ht/hti too (aiter/ops/flydsl/gemm_kernels.py:238-242).
    • But flydsl_hgemm calls it only for TDM (:309). The sk and ft/ht branches keep their own copies of the same arch rules (:367/:374-375, :388/:395, :406/:414-417).
    • Every copy agrees today, but the tuned-row filter (aiter/tuned_gemm.py:193-201) and the launcher can drift apart.
    • Fix: call the predicate once at the top of flydsl_hgemm for every policy and drop the per-branch copies. No route changes, and no test matches the removed messages. The alternative is to reword the claim to "TDM availability" in the body and squash text.
  2. Drop the test for a name format that never shipped. op_tests/tuning_tests/test_a16w16_tuned_config_lookup.py:394 asserts that the _gm0_i{0,1}_p spelling is rejected. That spelling existed only in this PR's earlier revisions, so this is the same "assert a removed thing is absent" test that item 10 asked to remove.

Prior asks at f5ec86c:

  • Done: items 1 (except the leftover above), 3, 5, 6, 7, 8, 9 and 10, each checked in code.
  • Item 2: the same-session ABBA tables, the 16 rows put back, the sched_barrier A/B (median 0.92, bitwise equal) and the split-K stress (91,200 launches, 0 mismatches) are all done. I no longer require the kernel IDs for the tuning-run illegal instruction and page fault. Every shipped split-K row was stressed with no fault, and the body lists the faults as unverified. They stay a residual risk.
  • Item 4 (split): not pursued, per your reply.

Checked and fine:

  • Shipped rows: all 116 TDM rows parse and round-trip, and are valid for their real M/N/K (ks ≤ 9, K divisible by ks·block_k, LDS ≤ 320 KiB).
  • CSV keys: no duplicate key, and no other key changed.
  • Lookup cost: the strict-row filter sits behind the lru_cache lookup, so it runs and warns once per shape.
  • FP32 workspace: bounds and the store → s_wait_storecnt → cluster barrier → load order hold, and so does the graph-capture/stream behaviour.
  • CI: all green.

Reviewed at f5ec86c (deep re-review, two independent passes, CPU name/shape probes). Already fixed: items 3, 5-10; item 1 except the leftover above; item 2 except the fault IDs, now dropped.

flydsl_hgemm asks flydsl_hgemm_policy_runs_on once, after the argument checks and before any branch, for every policy; the skinny branch's gfx950 check and the trailing gfx950/gfx1250 check go, so the launcher and the tuned-row filter read the same rule. No route changes: gfx1250 vs gfx950 still picks the kernel. A policy without a kernel on the runtime raises RuntimeError("FlyDSL HGEMM policy ... has no kernel for <gfx>"); bs on a non-gfx950 runtime now raises it here instead of the band launcher's ValueError, which still checks the CU count.

Drop the lookup-test assertion that the never-shipped _gm0_i{0,1}_p spelling is rejected, and match the strict-runtime test to the new message.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@XiaobingSuper

Copy link
Copy Markdown
Contributor

@valarLip Thanks. Both items are addressed in 2b070061d.

  1. One gate. flydsl_hgemm now calls flydsl_hgemm_policy_runs_on(policy, gfx) once for every policy, after the argument checks and before routing, and raises RuntimeError("FlyDSL HGEMM policy ... has no kernel for <gfx>") on a False answer. The skinny branch's gfx950 check and the trailing gfx950/gfx1250 check are removed. The gfx1250-vs-gfx950 routing branch stays, so no route changes, and the body's claim holds as written.
    • The gate sits after the argument checks, so every existing error keeps its precedence. For example, test_tdmi_cannot_enter_gfx950_preshuffle_path still gets the preshuffle ValueError.
    • One visible difference: bs on a non-gfx950 runtime now raises this RuntimeError instead of the band launcher's ValueError. The launcher still checks the CU count. No test matched the removed messages.
  2. Test for the unshipped name. The _gm0_i{0,1}_p assertion is removed. The strict-runtime case in the same file now matches the new message.

Validation at 2b070061d on gfx1250 (256 CUs):

  • op_tests/tuning_tests/test_a16w16_tuned_config_lookup.py: 24 passed, 4959 subtests.
  • flydsl_hgemm against a float reference: tdm with split_k 1 and 4, tdmi and tdm with a DSV4.1 row's t256x256x128x2_ks1_w2x2x1 config, ft and ht. Relative error is 1.65e-3 to 1.67e-3 in every case. sk and bs raise the new error.
  • black 26.10.1 and ruff 0.16.0: clean.

The Testing and Self-Review sections of the description are updated to this revision.

@valarLip
valarLip merged commit deca29e into ROCm:main Nov 27, 2026
64 checks passed
zufayu pushed a commit that referenced this pull request Dec 2, 2026
…spatch (#8960)

* [GEMM] gemm_a16w16: return the empty result for M=0 before backend dispatch

An idle data-parallel rank's dummy step reaches the lm_head GEMM with no
rows. _gemm_a16w16 looked up a tuned config for M=0 and dispatched it; on
gfx1250 DSV4.1 BF16 shapes resolve to the FlyDSL TDM kernel (#8031), whose
validator rejects a zero dimension. The idle ranks crashed and the serving
rank hung in a collective (DSV4.1-Flash DEP4).

Answer M=0 before the lookup with the [*A.shape[:-1], N] result of otype,
or `out` viewed to that shape. The out-dtype check still runs first; M>0 is
unchanged. Add op_tests/test_gemm_a16w16.py -t empty.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(gemm_a16w16): spell out K=0 vs M=0 behavior in the docstring

Per review feedback on #8960: document that the M=0 early return is
independent of K=0, which still falls through to the normal tuned
dispatch and is only as well-defined as the selected backend's
handling of a zero contraction.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: root <[email protected]>
gbyu-amd added a commit that referenced this pull request Dec 3, 2026
…does (_ptdm / _ptdmi)

The rebase onto main 12-03 dropped k3-455-dev's pre-merge copy of #8031
(b445370, PR head 520f0bb) for main's merged deca29e. The two spell a
TDM HGEMM's wave schedule differently: the PR head wrote it as a name token,
`..._gm{g}_i0_ptdm_gfx1250` / `..._gm{g}_i1_ptdm_gfx1250`, while main's
final version folds it into the policy, `..._gm{g}_ptdm_gfx1250` (plain) /
`..._gm{g}_ptdmi_gfx1250` (interleaved), and its _HGEMM_KERNEL_RE has no
`_i` token. Main converted its own CSV rows; the K3 rows tuned on the PR head
kept the old spelling, so get_flydsl_hgemm_kernel_params() returns None for
them and every lookup logs "not recognized by the current catalog; falling
back to next candidate" and runs the default Triton gemm_a16w16 (C1203 on
e17: 1332 warnings per D tray, all during graph capture).

Rows affected, all gfx1250 bf16 -> bf16:
- kimik3_bf16_tuned_gemm.csv, 256 rows from #9096: LM / DSpark draft head,
  N 163840, K 7168, M 1-256;
- kimik3_bf16_tuned_gemm.csv, 20 rows from #8348: latent-MoE
  routed_expert_down_proj (N 3584, K 7168) and routed_expert_up_proj
  (N 7168, K 3584), M 1-32768;
- op_tests/k3_latent_bf16_tuned_rows.csv, the same 20 latent rows.

Rename only: `_i0_ptdm_` -> `_ptdm_`, `_i1_ptdm_` -> `_ptdmi_`; no other
byte changes. Every renamed name parses with this tree's
get_flydsl_hgemm_kernel_params() (TDM validator included) to the same
tile / stages / waves / split-K / group_m / interleave the old parser read
from the old name, and no file in the tree keeps `_i[01]_ptdm`. The TDM
kernel builder is unchanged between the two trees apart from the cache-policy
constant's name and the AOT factory wrapper.

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.

5 participants