Skip to content

fix(plugins/aiter): move #354's gemm_n6144_k6144 and gemm_n6288_k7168 kernels under provider/gemm/impls - #366

Merged
kyle-256 merged 2 commits into
mainfrom
fix/pr354-kernels-under-provider
Nov 27, 2026
Merged

kyle-256 merged 2 commits into
mainfrom
fix/pr354-kernels-under-provider

Conversation

@zhenhuang12

@zhenhuang12 zhenhuang12 commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Why

#354 was merged without a rebase onto #352, which moved every op family under aklr/plugins/aiter/provider/. Its two fixed FlyDSL gemm kernels (bf74e6e2… for n6144 / k6144, 93d75fc2… for n6288 / k7168) landed at aklr/plugins/aiter/gemm/impls, outside the gemm op package, where nothing loads them. The two files they replace (feac6650…, f1dc78b3…) stayed under provider/ and are still the ones served, so #354's race fixes are not in effect on main. This is the same slip #359 fixed for gemm_n19360_k6144.

This moves the two new files to aklr/plugins/aiter/provider/gemm/impls and removes the two they replace, which is the change #354 described.

Scope

  • Two renames, byte for byte (similarity 100%), and two withdrawn kernels: flydsl/gemm_n6144_k6144/feac6650c272c5eb.json and flydsl/gemm_n6288_k7168/f1dc78b3e8b7c074.json. aklr/plugins/aiter/gemm/ no longer exists. Contracts and workload lists are unchanged.
  • The new files carry no measured fields, as in fix(gemm): wait for LDS writes at the scratch barrier, keep strip reads in their ring stage (n6144 / k6144, n6288 / k7168) #354, so dispatch does not serve their workloads until CI measures them at the new path. The withdrawn files' published measurements go with them.
  • Two kb pages cited the withdrawn files: harness/skills/kb/cases/bf16_small_m_column_strip.md and k3_bf16_splitk_wide_n.md now cite the new ones. The cited kernel.py line numbers hold (both sources keep their line count; the changed lines are 84, 156-157, 241 and 120). The strip page said MFMA columns 24–31 read the next stage's bytes; it now says they read the stage's own B rows again, and that its measurements (E2) are of the earlier code.
  • No code changes.

Verification

Environment: head 1a5d90cad, which merges main 9e28ceecd into 9cd56c53c to resolve two modify/delete conflicts (main's measurement commits rewrote the two withdrawn files); the GPU run of the new head is pending. GPU run of 9cd56c53c (on a8b1327f8): 45818663800. Local checks: CPU only, Python 3.12, torch 2.11.0+cpu.
Gate overrides: none

Kernels

CI run 45818663800 on 9cd56c53c, before the merge of main: code-lint, aiter-test, sglang-test, vllm-test and coverage-report passed. Its per-workload numbers are in the run's validation report and are not copied into a table here. The kernel sources are the ones #354 measured in its ci:gpu run 45761184135.

What was run on this head:

  • Which files the gemm op package reads, ContractRegistry.default().read_schemas("aklr.plugins.aiter.provider.gemm"):

    schemas errors bf74e6e2… 93d75fc2… feac6650… f1dc78b3…
    main 9e28ceecd 255 0 not read not read read read
    this PR 255 0 read read gone gone
  • python -m aklr validate --base origin/main --stages audit --under <each directory> passes with no finding (log below).

  • python -m aklr export check exits 0.

  • pytest tests/plugins/aiter tests/core tests/benchmarks/test_kernels_report.py: 1083 passed, 350 skipped, 1 failed. The failure, tests/core/runtime/test_dispatch.py::TestDispatcherRegistry::test_init_skips_schema_whose_requires_fails[0.3.2-True], is RuntimeError: Tried to instantiate dummy base class _cuda_isCurrentStreamCapturing from the CPU-only torch, and fails the same way on main a8b1327f8 on this machine. python3 tests/check_layout.py passes.

Validation log
$ python -m aklr validate --base origin/main --stages audit --under aklr/plugins/aiter/provider/gemm/impls/flydsl/gemm_n6144_k6144
[12:13:49] validate: 2026-11-26, head 9cd56c53c799, base a8b1327f852a, unknown unknown x0
[12:13:49] audit: started (stage 1/1)
[12:13:49] audit: checking 1 schemas
[12:13:50] audit: checking changes against base a8b1327f852a
[12:13:50] audit: passed, findings: 0, 0:00:01
$ python -m aklr validate --base origin/main --stages audit --under aklr/plugins/aiter/provider/gemm/impls/flydsl/gemm_n6288_k7168
[12:13:54] validate: 2026-11-26, head 9cd56c53c799, base a8b1327f852a, unknown unknown x0
[12:13:54] audit: started (stage 1/1)
[12:13:54] audit: checking 1 schemas
[12:13:55] audit: checking changes against base a8b1327f852a
[12:13:55] audit: passed, findings: 0, 0:00:01

Not run

  • python -m aklr validate --base origin/main --stages audit,bench and the GPU tests were not run locally (no GPU on the machine at hand); they ran in the CI run above.
  • No test guards against a schema file outside provider/; this is the second time it happened (fix(plugins/aiter): move gemm_n19360_k6144 under provider/gemm/impls #359). Not added here, to keep this PR to kernels and documents.

Risk

Affects: bf16 gemm n6144 / k6144 (m 1–128) and n6288 / k7168 (workloads up to m 2732, plus m 9397 and 16384): the served kernels become #354's fixed ones once CI measures them; until then these workloads fall back to aiter.
If wrong: slower than the withdrawn kernels where the margin is thin (#354 reports four workloads demoted: n6144 m 32, n6288 m 24, 32, 48); outputs cannot become wrong from the added wait, per #354.
Undo: git revert brings back the two withdrawn files with their measurements and puts the new ones back at the unloaded path; [email protected] makes every gemm fall back.

… kernels under provider/gemm/impls

#354 was merged without a rebase onto #352, which moved the op families under provider/.
Its two fixed kernels (bf74e6e2, 93d75fc2) landed at aklr/plugins/aiter/gemm/impls, outside
the gemm op package, where nothing loads them, and the files they replace (feac6650,
f1dc78b3) stayed under provider/ and kept being served without the fix.

Move the two new files to provider/gemm/impls, byte for byte, and remove the two they
replace, as #354 intended. The two kb pages that cite the old files now cite the new ones,
and the strip page describes the in-stage reads.
Copilot AI max review requested due to automatic review settings November 26, 2026 12:17
@zhenhuang12 zhenhuang12 added the ci:priority-high Run the PR's SaFE GPU jobs at high priority (with ci:gpu) label Nov 26, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

For m=32–60, delayed partner workgroups can exceed _SPIN_LIMIT, causing the kernel to consume unverified workspace data and silently produce incorrect results.

No open issues 🎉

What changed in this PR

Restores discovery of the FlyDSL GEMM variants containing #354’s LDS fixes by placing them under the aiter provider layout introduced in #352.

Changes:

  • Adds the two replacement schemas under provider/gemm/impls and withdraws their predecessors.
  • Preserves embedded kernel sources and workloads; default dispatch awaits CI measurements.
  • Updates knowledge-base citations and clarifies the strip kernel’s in-stage reads.
File Description
harness/​skills/​kb/​cases/​k3_bf16_splitk_wide_n.md Updates n6288 schema citations.
harness/​skills/​kb/​cases/​bf16_small_m_column_strip.md Updates n6144 citations, read description, and measurement caveats.
aklr/​plugins/​aiter/​provider/​gemm/​impls/​flydsl/​gemm_n6288_k7168/​f1dc78b3e8b7c074.json Withdraws the previous n6288 variant.
aklr/​plugins/​aiter/​provider/​gemm/​impls/​flydsl/​gemm_n6288_k7168/​93d75fc23aa2cf3e.json Places the replacement n6288 variant in the discoverable package.
aklr/​plugins/​aiter/​provider/​gemm/​impls/​flydsl/​gemm_n6144_k6144/​feac6650c272c5eb.json Withdraws the previous n6144 variant.
aklr/​plugins/​aiter/​provider/​gemm/​impls/​flydsl/​gemm_n6144_k6144/​bf74e6e2b7edd005.json Places the replacement n6144 variant in the discoverable package.

Review effort: Max

@zhenhuang12

Copy link
Copy Markdown
Collaborator Author

On Copilot's "Needs a closer look" (_SPIN_LIMIT at m 32–60 in gemm_n6288_k7168):

The claim is right about the code, and it is not something this PR changes.

  • In 93d75fc23aa2cf3e.json#kernel.py, a K half polls its partner's (value, tag) pairs until all carry this launch's tag or the count reaches _SPIN_LIMIT = 2²² (:34, :427-433), then adds whatever the slot holds to its own term (:440-446). If the partner workgroup has not stored by then, the sum is wrong and nothing reports it.

  • The kb page already records it, with the conditions it was seen under (a stream limited to 64 or 16 CUs, or another kernel holding half of every XCD): harness/skills/kb/cases/k3_bf16_splitk_wide_n.md lines 68–73, (field, E15).

  • It is the same on main. The file main serves today, f1dc78b3e8b7c074.json, differs from this one in one source line, the _barrier wait fix(gemm): wait for LDS writes at the scratch barrier, keep strip reads in their ring stage (n6144 / k6144, n6288 / k7168) #354 added:

    $ diff <(kernel.py of main's provider/.../gemm_n6288_k7168/f1dc78b3e8b7c074.json) <(kernel.py of this PR's 93d75fc23aa2cf3e.json)
    120c120
    <         None, [], f"s_waitcnt vmcnt({vmcnt})\n\ts_barrier", "", has_side_effects=True
    ---
    >         None, [], f"s_waitcnt vmcnt({vmcnt}) lgkmcnt(0)\n\ts_barrier", "", has_side_effects=True
    

This PR moves #354's file byte for byte, so the hand-off is neither better nor worse than what is served now. Removing it means changing how the two K halves hand off (or withdrawing the m 32–60 path), which is a kernel change for a PR of its own; no code is changed here for it.

main's measurement commits (90b13b2, 77a0630) wrote speedup, accuracy and microseconds
into feac6650 and f1dc78b3, the two files this branch withdraws: modify/delete conflicts.
Keep them withdrawn.
@kyle-256
kyle-256 merged commit 82f8e6d into main Nov 27, 2026
13 checks passed
ChengYao-amd added a commit that referenced this pull request Nov 27, 2026
Follows main's moves: the ops now live under aklr/plugins/aiter/provider (#327, #366), so the route
imports flash_mla_with_kvcache from aklr.plugins.aiter.provider.mla and the K3 DCP verify schema moves
there. The schema now carries #339's kernel (the same FlyDSL dense fp8 MLA decode, whose chunk partials
are f16 and normalized by the probabilities the value GEMM reads), so its uuid is 6c9983e6c91c4680;
workloads unchanged (rows 5-40 at the three pool sizes, table width 131073), measurements dropped for
the bot.

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

ci:gpu ci:priority-high Run the PR's SaFE GPU jobs at high priority (with ci:gpu)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants