Skip to content

feat(gemm): GLM-5.2 MXFP4 bf16 projections at the speculative verify token counts - #212

Merged
zhenhuang12 merged 1 commit into
mainfrom
feat/glm52-bf16-gemm-verify
Nov 16, 2026
Merged

zhenhuang12 merged 1 commit into
mainfrom
feat/glm52-bf16-gemm-verify

Conversation

@ChengYao-amd

@ChengYao-amd ChengYao-amd commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Why

GLM-5.2 MXFP4 keeps its attention, indexer and router projections in bf16. With EAGLE 5/1/6 the target verifies 6 tokens per request, so at verify and draft extend these GEMMs see 6·bs rows: 6–30 at TP8 (1–5 running requests) and 6–96 at TP4 (up to 16). Both of the [email protected] routes reach these calls (tgemm.mm, and aiter's Triton gemm_a16w16, which sglang calls for at most 64 rows when K ≤ 2048). The committed workloads cover only powers of two, so every verify call falls back. This PR adds schemas that serve those row counts.

Scope

Seven new [email protected] schemas. The committed ones are unchanged.

schema projection (GLM-5.2 MXFP4) rows kernel
flydsl/gemm_n2048_k2048/4d9208db TP8 q_b_proj 6–30 committed small-m FlyDSL kernel (340a6d0c), unchanged
triton/gemm_n6144_k2048/0774cef6 TP8 o_proj 6–30 committed Triton kernel (8307d207), unchanged
flydsl/gemm_n4096_k2048/a18601ce TP4 q_b_proj, indexer wq_b (both TP) 6–96, step 6 committed FlyDSL kernel (1e5f6ad3) plus one configuration for 65–96 rows
flydsl/gemm_n6144_k4096/02add52a TP4 o_proj 6–96, step 6 committed FlyDSL kernel (c735728b) with its row split fixed
triton/gemm_n32_k6144/65f19013 indexer weights_proj 6–96, step 6 new Triton split-K kernel
flydsl/gemm_n256_k6144/9bc59fe9 MoE router gate 6 committed FlyDSL kernel (5b35f66b), unchanged
triton/gemm_n2624_k6144/041f29d9 fused q_a / kv_a 48, 54, 60 committed Triton kernel (7511d8bb), unchanged
  • n4096 k2048, 65–96 rows. The committed kernel asserts at these row counts. Each 48-row half has three 16-row fragments, which the 2×2 wave layout cannot divide. The added configuration splits K over the four waves instead.
  • n6144 k4096 row split. The committed kernel starts the second half of its row split at the padded tile (TILE_M) instead of at m / 2. When m / 2 is not a multiple of 16, the rows of the first half past m / 2 are never written: 34–48 and 66–84 rows come out wrong. Its committed workloads (powers of two) are not affected. The copy here starts the second half at m / 2 and masks the first half's store at m / 2.
  • n32 k6144 split-K. A column tiling alone leaves most CUs idle on a 0.4 MB weight, so K is split over 12–24 workgroups per column tile. Each workgroup writes its fp32 partial through to memory and increments the tile's arrival counter. The last one to arrive sums the partials in split order, stores bf16 and resets the counter. Because the sum order is fixed, results are bitwise reproducible. Partials and counters are kept per device and stream.
  • Not served (left to sglang):
    • indexer wk (n128 k6144) and the router above 6 rows: aiter's asm GEMM already runs these in about 5 µs, and neither the committed kernels nor a split-K kernel beat it.
    • the fused q_a / kv_a GEMM outside 48–60 rows.
    • 36–96 rows of the TP8-only shapes.
    • draft decode at non-power-of-two batch sizes.

Tradeoffs

  • Copies, not edits: the committed n4096 k2048 and n6144 k4096 schemas keep serving their workloads unchanged; the fix and the new configuration live in the new files.
  • sglang's own path, not only the baseline: where K ≤ 2048 and the call has at most 64 rows, sglang calls aiter's Triton gemm_a16w16, not the tuned GEMM that is this op's baseline. A cold-cache microbench on the same image against that Triton path:
    • n2048 k2048: 1.13–1.51× at 6–30 rows;
    • n4096 k2048: 1.20–1.45× at 6–60 rows;
    • n6144 k2048: 1.14–1.28× at 6–30 rows.

Verification

Environment: CI run 43603051404 on this head: validation passed, 62/62 accurate, 1.06x – 1.96x (lower bound); unittest-aklr passed. The tables and log below are a local run on MI355X, lmsysorg/sglang:v0.5.22-rocm10-mi35x, ROCm 7.15, torch 2.11.0+rocm10.0.0, Triton 3.8.0, FlyDSL 0.3.2, AITER as ci.yaml's AKLR_BASELINE_AITER. The run was on head 37183081, which has the same seven files; the branch has since been rebased onto main 91e0370e, where export check, validate --stages audit, test_contracts.py and pre-commit pass again.
Gate overrides: none

Kernels

contract baseline measured accuracy (bound) speedup
[email protected] (7 schemas) aiter tuned gemm_a16w16 62/62 62/62 (contract bounds, bitwise determinism) CI 1.06x – 1.96x (local 1.09x – 1.95x)
schema rows baseline µs this µs lower bound
n2048 k2048 6 / 12 / 18 / 24 / 30 6.8 / 7.0 / 7.2 / 8.2 / 8.3 4.4 / 4.5 / 4.5 / 4.5 / 4.5 1.54 – 1.86
n6144 k2048 6 / 12 / 18 / 24 / 30 7.9 / 7.2 / 7.6 / 7.9 / 8.2 6.2 / 6.3 / 6.5 / 6.8 / 7.2 1.14 – 1.28
n4096 k2048 6 / 24 / 48 / 72 / 96 6.6 / 7.0 / 8.4 / 8.2 / 9.0 4.6 / 5.4 / 6.4 / 6.9 / 7.2 1.16 – 1.43 (16 rows)
n6144 k4096 6 / 24 / 48 / 72 / 96 11.8 / 13.8 / 15.7 / 18.3 / 18.7 9.4 / 10.5 / 13.0 / 15.5 / 16.5 1.13 – 1.32 (16 rows)
n32 k6144 6 / 24 / 48 / 72 / 96 9.0 / 7.0 / 7.3 / 7.2 / 10.3 4.6 / 4.8 / 4.9 / 5.3 / 5.4 1.31 – 1.95 (16 rows)
n256 k6144 6 5.2 4.4 1.16
n2624 k6144 48 / 54 / 60 13.6 / 14.6 / 15.0 12.3 / 12.6 / 12.9 1.09 – 1.15
Validation log
$ python -m aklr validate --base origin/main --stages audit,bench <the 7 schemas>
[12:42:17] validate: collecting schemas and platform
[12:42:18] validate: 2026-11-14, head 371830816585, base f44b4d88faf4, MI355X gfx950 x8
[12:42:18] audit: started (stage 1/2)
[12:42:18] audit: checking 7 schemas
[12:42:19] audit: checking changes against base f44b4d88faf4
[12:42:19] audit: passed, findings: 0, 0:00:01
[12:42:19] bench: started (stage 2/2)
[12:42:19] bench: reading 7 schemas
[12:42:19] bench: 7 batches (7 schemas), 62 workloads, 8 devices
[12:42:40] bench: 1/7 passed flydsl/gemm_n256_k6144/9bc59fe9: 1 wl, speedup 1.16x, acc ok
[12:42:55] bench: 2/7 passed triton/gemm_n2624_k6144/041f29d9: 3 wl, speedup 1.09x-1.15x, acc ok
[12:43:10] bench: 3/7 passed triton/gemm_n6144_k2048/0774cef6: 5 wl, speedup 1.14x-1.28x, acc ok
[12:43:12] bench: 4/7 passed flydsl/gemm_n2048_k2048/4d9208db: 5 wl, speedup 1.54x-1.86x, acc ok
[12:44:30] bench: 5/7 passed flydsl/gemm_n4096_k2048/a18601ce: 16 wl, speedup 1.16x-1.43x, acc ok
[12:44:31] bench: 6/7 passed flydsl/gemm_n6144_k4096/02add52a: 16 wl, speedup 1.13x-1.32x, acc ok
[12:44:36] bench: 7/7 passed triton/gemm_n32_k6144/65f19013: 16 wl, speedup 1.31x-1.95x, acc ok
[12:44:36] bench: 62 workloads
[12:44:36] bench:   outcome                         workloads
[12:44:36] bench:   passed                                 62
[12:44:36] bench:   speedup  best 1.95x, median 1.30x, worst 1.09x  (workloads with a speedup value)
[12:44:36] bench:   accuracy FAIL 0, ok 62, not measured 0
[12:44:36] bench:   per-schema table: report.md
[12:44:36] bench: passed, findings: 0, 0:02:17
validation passed

Code

No code changes. python -m aklr export check, python -m aklr validate --base origin/main --stages audit, pytest tests/ops/test_contracts.py and pre-commit run --from-ref origin/main --to-ref HEAD pass on the rebased head.

Serving check (not end to end): GLM-5.2 MXFP4 (amd/GLM-5.2-MXFP4) on MI355X with the InferenceX agentic recipe's server arguments (EAGLE 5/1/6, triton DSA, fp8 KV cache), acceptance not simulated, this PR's schemas with the speedups above (AKLR_MEASURED_DIR), AKLR_EXPORT=1:

  • TP4/EP4 with HiCache (--cuda-graph-max-bs-decode 32): [email protected] served n32 k6144, n4096 k2048 and n6144 k4096 at every verify row count captured up to 96 (6–48, 60, 72, 84, 96; batch sizes 9, 11, 13 and 15 are padded to the next graph), plus n256 k6144 at 6 and n2624 k6144 at 48 and 60.

  • TP8/EP1 (--cuda-graph-max-bs-decode 8): n2048 k2048 and n6144 k2048 served at 6–30; n4096 k2048 and n32 k6144 at 6–48; n256 k6144 at 6; n2624 k6144 at 48, 54 and 60.

  • GSM8K (400 questions, zero-shot chat, thinking off):

    config [email protected] AKLR on
    TP4 0.970 0.970
    TP8 0.965 0.975

Not run

  • End to end throughput (optional for schemas on an existing route).

Risk

Affects: bf16 GEMMs of these seven (n, k) shapes at the listed row counts: GLM-5.2 MXFP4's attention, indexer and router projections at verify and draft extend. Any other model with the same shapes at those row counts also gets the new schemas.
If wrong: wrong projection output, or slower verify steps at those row counts.
Undo: [email protected] (this turns off every gemm schema), or git revert.

🤖 Generated with Claude Code

…token counts

GLM-5.2 MXFP4 keeps its attention, indexer and router projections in bf16, and
with EAGLE 5/1/6 the target verifies 6 tokens per request, so these GEMMs see
6, 12, ..., 96 rows (TP8 at 1-5 running requests, TP4 up to 16). The gemm
route reaches all of them, but the committed workloads are powers of two only.

New schemas, committed ones unchanged:
- n2048 k2048 (TP8 q_b): the committed small-m FlyDSL kernel at 6-30 rows.
- n6144 k2048 (TP8 o_proj): the committed Triton kernel at 6-30 rows.
- n4096 k2048 (TP4 q_b, indexer wq_b): the committed FlyDSL kernel at 6-96
  rows, with a configuration for 65-96 rows, whose 48-row halves have three
  16-row fragments (the committed one asserts there).
- n6144 k4096 (TP4 o_proj): the committed FlyDSL kernel at 6-96 rows. Its
  row split started the second half at the padded tile instead of m / 2, so
  rows of the first half past m / 2 were never written when m / 2 is not a
  multiple of 16 (34-48, 66-84); the copy starts it at m / 2.
- n32 k6144 (indexer weights_proj): a Triton split-K kernel. The last
  workgroup of a column tile to arrive sums the fp32 partials in split order,
  so the result is bitwise reproducible.
- n256 k6144 (router) at 6 rows and n2624 k6144 (fused q_a / kv_a) at 48-60
  rows: committed kernels.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@zhenhuang12
zhenhuang12 marked this pull request as ready for review November 16, 2026 08:37
Copilot AI max review requested due to automatic review settings November 16, 2026 08:37
@zhenhuang12
zhenhuang12 merged commit 51acbd5 into main Nov 16, 2026
22 of 27 checks passed

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.

🟡 Changes recommended

Graph-captured invocations can read uninitialized counters or corrupt shared reduction scratch during concurrent replays, causing incorrect or unwritten outputs.

1 open issue
What changed in this PR

Adds seven [email protected] schemas so AKLR can accelerate GLM-5.2 MXFP4 bf16 projections at speculative-verification token counts instead of falling back.

Changes:

  • Adds 62 workloads at selected multiples of six, leaving existing schemas unchanged.
  • Reuses existing kernels with an additional larger-row configuration and a corrected row split.
  • Introduces a fixed-order Triton split-K kernel for the narrow indexer projection.
File Description
aklr/​ops/​gemm/​impls/​triton/​gemm_n6144_k2048/​0774cef6a82ceb70.json Covers TP8 output projections at 6–30 rows.
aklr/​ops/​gemm/​impls/​triton/​gemm_n32_k6144/​65f19013d279858b.json Adds split-K indexer projections at 6–96 rows.
aklr/​ops/​gemm/​impls/​triton/​gemm_n2624_k6144/​041f29d9ee169248.json Covers fused projections at 48, 54 and 60 rows.
aklr/​ops/​gemm/​impls/​flydsl/​gemm_n6144_k4096/​02add52af772193d.json Covers TP4 output projections with corrected row splitting.
aklr/​ops/​gemm/​impls/​flydsl/​gemm_n4096_k2048/​a18601ce69407734.json Covers query/indexer projections through 96 rows with an added configuration.
aklr/​ops/​gemm/​impls/​flydsl/​gemm_n256_k6144/​9bc59fe90224c762.json Covers the router projection at six rows.
aklr/​ops/​gemm/​impls/​flydsl/​gemm_n2048_k2048/​4d9208db05b89bab.json Covers TP8 query projections at 6–30 rows.

Review effort: Max

"sources": [
{
"path": "kernel.py",
"content": "\"\"\"Narrow-n BF16 NT GEMM ``out = a @ b.T`` for k = 6144 and a few dozen rows (Triton, gfx950).\n\nThe weight is a few MB, so a column tiling alone leaves most CUs idle: K is split over SPLIT\nworkgroups per column tile. Each writes its fp32 partial through to memory and bumps the tile's\narrival counter; the last to arrive sums the partials in split order, stores bf16 and resets the\ncounter. The sum order is fixed, so the result is bitwise reproducible. Partials and counters are\nkept per device and stream.\"\"\"\n\nimport functools\n\nimport torch\nimport triton\nimport triton.language as tl\n\n\[email protected]\ndef _wait_stores(x):\n return tl.inline_asm_elementwise(\"s_waitcnt vmcnt(0)\", \"=r,r\", [x], dtype=tl.int32, is_pure=False, pack=1)\n\n\[email protected]\ndef _splitk_kernel(\n A,\n B,\n C,\n P,\n CNT,\n M,\n N: tl.constexpr,\n K: tl.constexpr,\n BLOCK_M: tl.constexpr,\n BLOCK_N: tl.constexpr,\n BLOCK_K: tl.constexpr,\n SPLIT: tl.constexpr,\n):\n pid_n = tl.program_id(0)\n pid_k = tl.program_id(1)\n pid_m = tl.program_id(2)\n KC: tl.constexpr = K // SPLIT\n offs_m = pid_m * BLOCK_M + tl.arange(0, BLOCK_M)\n offs_n = pid_n * BLOCK_N + tl.arange(0, BLOCK_N)\n offs_k = pid_k * KC + tl.arange(0, BLOCK_K)\n row_ok = offs_m[:, None] < M\n a_ptrs = A + offs_m[:, None] * K + offs_k[None, :]\n b_ptrs = B + offs_n[None, :] * K + offs_k[:, None]\n acc = tl.zeros((BLOCK_M, BLOCK_N), dtype=tl.float32)\n for _ in tl.range(0, KC // BLOCK_K):\n a = tl.load(a_ptrs, mask=row_ok, other=0.0)\n b = tl.load(b_ptrs, cache_modifier=\".cg\")\n acc = tl.dot(a, b, acc=acc)\n a_ptrs += BLOCK_K\n b_ptrs += BLOCK_K\n if SPLIT == 1:\n tl.store(C + offs_m[:, None] * N + offs_n[None, :], acc.to(C.dtype.element_ty), mask=row_ok)\n else:\n tile_id = pid_m * tl.num_programs(0) + pid_n\n tile = tile_id * BLOCK_M * BLOCK_N\n loc = tl.arange(0, BLOCK_M)[:, None] * BLOCK_N + tl.arange(0, BLOCK_N)[None, :]\n stride = tl.num_programs(2) * N * BLOCK_M\n part = P + pid_k * stride + tile + loc\n tl.store(part, acc, cache_modifier=\".wt\")\n _wait_stores(pid_k)\n tl.debug_barrier()\n arrived = tl.atomic_add(CNT + tile_id, 1, sem=\"acq_rel\", scope=\"gpu\")\n if arrived == SPLIT - 1:\n tot = tl.load(P + tile + loc, cache_modifier=\".cv\")\n for s in tl.static_range(1, SPLIT):\n tot += tl.load(P + s * stride + tile + loc, cache_modifier=\".cv\")\n c_ptrs = C + offs_m[:, None] * N + offs_n[None, :]\n tl.store(c_ptrs, tot.to(C.dtype.element_ty), mask=row_ok)\n tl.atomic_xchg(CNT + tile_id, 0, sem=\"relaxed\", scope=\"gpu\")\n\n\n# (n, k) -> m upper bound -> (BLOCK_M, BLOCK_N, SPLIT, BLOCK_K, num_warps)\n_CONFIGS = {\n (32, 6144): {16: (16, 32, 24, 256, 4), 128: (16, 32, 12, 256, 2)},\n}\n_MAX_PART = 1 << 22 # fp32 partials per device and stream\n_MAX_TILES = 1024\n\n\[email protected]\ndef _workspace(device, stream):\n p = torch.empty(_MAX_PART, device=device, dtype=torch.float32)\n cnt = torch.zeros(_MAX_TILES, device=device, dtype=torch.int32)\n return p, cnt\n\n\ndef launch(a, b, out, cfg):\n m, k = a.shape\n n = b.shape[0]\n block_m, block_n, split, block_k, warps = cfg\n m_tiles = triton.cdiv(m, block_m)\n assert split * m_tiles * block_m * n <= _MAX_PART and m_tiles * (n // block_n) <= _MAX_TILES\n p, cnt = _workspace(a.device, torch.cuda.current_stream(a.device).cuda_stream)\n _splitk_kernel[(n // block_n, split, m_tiles)](\n a, b, out, p, cnt, m, N=n, K=k, BLOCK_M=block_m, BLOCK_N=block_n, BLOCK_K=block_k, SPLIT=split,\n num_warps=warps, num_stages=2,\n )\n\n\ndef run(*, a, b, trans_b, bias, out_dtype, out):\n m, k = a.shape\n n = b.shape[0]\n table = _CONFIGS.get((n, k))\n if not trans_b or bias is not None or table is None or m > max(table):\n torch.matmul(a, b.t() if trans_b else b, out=out)\n if bias is not None:\n out.add_(bias)\n return\n launch(a, b, out, table[min(x for x in table if m <= x)])\n"
zhenhuang12 added a commit that referenced this pull request Nov 17, 2026
…ts call

A schema's workload now carries `models`: the models whose serving makes that very call, sorted,
each once, lowercase (`kimi-k3`, `deepseek-v4-pro`, `glm-5.2`). The file's `models`, right after
`op_type`, is their union, written by `schema_text` and so checked on parse: the file shows at a
glance which models it is for, and each workload which of them calls it. The uuid hashes neither,
so no file moves; the schema_version stays 5.

A workload without `models` still parses (a base from before this change is read as it is), and
`schema_errors` refuses it (E10), so `export check` and audit require it of every committed and
changed file. `OpContract.narrow` keeps its signature; `workload_for` takes the models.

`python -m aklr export` takes `--model`: a new file's workloads carry it, and a committed file the
calls reach is listed with the called workloads that do not name it.

All 705 committed schemas (4668 workloads) are labelled. A workload takes the model named by the
commit that added it, in AKLR or, for AKLR's initial commit, in SIKL (whose main is that commit);
a kernel added later at an existing Point takes the Point's models. Where one scenario holds
workloads of several commits, they are told apart:
- flash_mla sparse decode and fp8_paged_mqa_logits (64 heads): SIKL #71's are deepseek-v4-flash,
  SIKL #83's deepseek-v4-pro; the three 262144-row ones of #96 ("DSV4") name both.
- deepseek_v2_fp8_moe at model_dim 6144: #46's are glm-5.2, #124's and #181's glm-5.3.
- gemm_n7168_k512: #159's multiples of 7 (DSPARK's draft) are kimi-k3.
Workloads from SIKL #52, which gave the pre-existing definitions their default sweep, take the
model of the commit that added the definition: SIKL #50 (DeepSeek-V4-Flash's schema set), #35 and
#47 (Kimi-K3). The definitions of SIKL #18 and #36 name no model and are labelled by their shapes,
as the owner reviewed: hidden-6144 GEMMs and MoE as glm-5.2, gemm_a8w8_blockwise_scaled_n3072_k1536
as deepseek-r1, gemm_n7168_k512's sweep as glm-5.2 and kimi-k3, the hidden-6144 norms as glm-5.2
and glm-5.3. By the owner's choice, DeepSeek-R1's workloads also name deepseek-v3, the DSA indexer
ones name glm-5.2 and glm-5.3, and gemm_n4096_k2048 and gemm_n512_k4096 also name qwen3.5. The
Qwen3.5 gated-attention decode workloads (qkv_dim 4608) also name qwen3-next, whose TP2 route
falls through to that op (#78).

Rebased onto main at #235: the files main rewrote (#169, #197, #217) keep their Points' models
under the new uuids and paths, and #212's seven GEMM files, at Points new to the tree, are glm-5.2.
zhenhuang12 added a commit that referenced this pull request Nov 17, 2026
A schema file now carries `models`, right after `op_type`: the models whose serving calls it,
sorted, each once, lowercase (`kimi-k3`, `deepseek-v4-pro`, `glm-5.2`). The file shows at a glance
which models it is for. The uuid does not hash it, so no file moves; the schema_version stays 5.

A file without `models` still parses (a base from before this change is read as it is), and
`schema_errors` refuses it (E10), so `export check` and audit require it of every committed and
changed file. `OpContract.narrow` takes `models`; a workload names none.

`python -m aklr export` takes `--model`: a new file carries it, and a committed file the calls
reach is listed with a note when its `models` lack it.

All 705 committed schemas are labelled. A file takes the models named by the commits that added
its workloads, in AKLR or, for AKLR's initial commit, in SIKL (whose main is that commit); a
kernel added later at an existing Point takes the Point's models. The definitions of SIKL #18 and
#36 name no model and are labelled by their shapes, as the owner reviewed: hidden-6144 GEMMs and
MoE as glm-5.2, gemm_a8w8_blockwise_scaled_n3072_k1536 as deepseek-r1, gemm_n7168_k512's sweep as
glm-5.2 and kimi-k3, the hidden-6144 norms as glm-5.2 and glm-5.3. By the owner's choice,
DeepSeek-R1's files also name deepseek-v3, the DSA indexer ones name glm-5.2 and glm-5.3, and
gemm_n4096_k2048 and gemm_n512_k4096 also name qwen3.5. The Qwen3.5 gated-attention decode files
(qkv_dim 4608) also name qwen3-next, whose TP2 route falls through to that op (#78). #212's seven
GEMM files are glm-5.2.

The models are per file, not per workload: of the 705 files, one
(fp8_paged_mqa_logits_page_size64_n_heads64) holds workloads of different models
(deepseek-v4-flash alone, and with deepseek-v4-pro); it names both.
zhenhuang12 pushed a commit that referenced this pull request Nov 18, 2026
* docs(kb): name the kernel files main holds now, after #168 and #220 renamed them

#168 (kernel.requires) and #220 (aiter in kernel.requires) renamed every kernel file they touched without changing
its code, so the case pages' sources: lines and their text named files main no longer has (kb_reconcile: 0 covered,
100 gone). Each gone file is replaced by the file in its directory whose kernel (entry point and sources) is
byte-identical; where #212 added a second schema of the same kernel, by the one with the same workloads. The
withdrawn 4ea93103 is left for a separate edit.

* docs(kb): mark fused_moe 4ea93103 withdrawn

#153 withdrew it (1.043 over aiter, under the 5% bar). Its sources: line goes, the Points table says so, and S8 pins
the source to the revision before #153 so the citation still resolves.

* docs(kb): GEMM: nt at K=512, bounded-wait fold, ring barrier, cached fold workspace

- small_m.md §6: E134's nt cost at K=512 holds for that forge kernel only;
  #188's direct-to-LDS B stream at the same shape pays 1.66-1.69x with nt
  (E147). The shape does not decide the policy.
- wait_free_fold.md: a waiting fold is safe with a bounded wait, hand-off on
  timeout and a per-call workspace, as #159's FOLD 4/5 (exact under
  contention, two streams and concurrent graphs). Cost and risk: a
  workspace cached per (device, stream), as in #212's Triton n32_k6144, is
  shared by every graph captured on that stream (wrong outputs).
- datapath.md §4: a ring barrier before a DMA refill must also wait
  lgkmcnt(0); #110's n4096_k8192 races under contention without it.
  correctness.md and flydsl/gemm.md point there.

* docs(kb): mHC 4096 Gram form without a clamp; aiter's stage 2 drops b_nt

- cases/mhc_fused_post_pre.md: the hidden-4096 kernel returns NaN when
  the residual streams cancel; clamp the form at 0 like the hidden-7168
  kernel.
- moe/grouped_sorted_tokens.md §4, flydsl/moe.md §4: aiter's mixed stage-2
  builder discards b_nt, so a _bnt2 row loads w2 cached; restoring it took
  #122's fused MoE from 256.8 to 217.5 us at 512 tokens.

* docs(kb): pitfalls: degenerate Points, eager host time, in-place state

- degenerate_points.md (new): Points whose inputs all take a kernel's fast
  path (#201's FlashMLA q8: every request 8 KV rows) score a speedup that
  realistic lengths reverse. attention/measurement.md §8 points there.
- eager_call_host_time.md (new): the graph-replay speedup leaves out a
  @flyc.jit launcher's per-call host time; #134's top-k is 2.8-7.1x in
  replays and 0.18-0.68x of aiter called eagerly.
- state_kept_across_calls.md: form 3, a kernel that skips unchanged state
  stores timed on state replayed in place (#75's GDN decode: 2.40x in
  place, 1.62x with fresh state). triton/gdn.md points there.

* docs(kb): mHC case: the hidden-7168 HIP file #168 renamed, and #202's FlyDSL kernel beside it

* docs(kb): evidence counts from the runs' logs; R2 at batch 4 and 8; aiter's top-k fails the reference at 16384

This branch was previously deployed

1 inactive deployment
gpu-trusted — a9260ae3 Deployed Nov 14, 2026 by ChengYao-amd via prepare-gpu / prepare #870
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.

3 participants