Repository navigation
config: gpu-kernels 70bc2ad41 -> e57907b7 (prefill GEMV for the few-row F32 GDN alpha/beta shapes) - #2746
config: gpu-kernels 70bc2ad41 -> e57907b7 (prefill GEMV for the few-row F32 GDN alpha/beta shapes)#2746bong-water-water-bong wants to merge 1 commit into
Conversation
…-row F32 shapes: 27B GDN alpha/beta) Two gpu-kernels commits, both merged with their own reviews: e57907b71 hip-hrx: a prefill entry for the few-row F32 GEMV shapes (GDN alpha/beta) (gk#109) 9f9e3907b kquant_tokens: the T<=4 batched body reaches the Q6_K mm shape (gk#97's rule) (gk#110) ## What the first one changes for the engine `hip.gemv_small` only covers 1..8 tokens, so at prefill the GDN `ssm_alpha` / `ssm_beta` projections (f32 5120 x 48, one each per layer) fell to the generic f32 WMMA tile: ~0.67 ms for ~252 MFLOP. The new `hip.gemv_small_prefill` (Fused, 85) takes them with a dedicated prefill body: 8 tokens per workgroup, the token tile staged in LDS once per 1024-float K chunk, every output row walked from it. ## Measured on this pin's add-on (gk#109) `GGML_HRX_DISPATCH_SHAPE_LOG` on a 949-token Qwen3.8-27B Q4_K_M prefill, `-ub 512`, one gpu-hold ticket, 0 amdgpu faults: | | before | at e57907b7 | |---|---|---| | `hrx_gemv_small_prefill_f32_r6` commands | 0 | **192** | | `ggml_mul_mat_f32_f32_wmma` commands | 386 | **194** | 192 = 96 at `t = 512` + 96 at `t = 433` (tail ubatch), every 48-row `5120 x 48` product in the graph; the remaining 194 are the `t = 4` / `t = 2` requests (below the `t >= 9` admission) and 2 single-token lm_head rows (N = 17408, outside the 128-row cap). Kernel harness on the real `blk.0` / `blk.40` alpha/beta weights: T512 117.5-121.7 us against ~670 us for the generic tile, `CORRECTNESS PASS` 14/14 `bad 0`. `test-backend-ops test -o MUL_MAT -b HRX0` with this add-on: 1717/1717, Backend HRX0 OK. ## Honest scope The tree at `e57907b7` is not byte-identical to the add-on those device numbers were taken on: gk#110's `kernels/kquant_tokens_q8.hip` landed between my branch point and the squash merge, so this pin carries it too (it is the second commit above, merged with its own review and evidence). My matcher does not touch that file. gpu-kernels main has since moved to `80246a273d67`; this pin stops at the commit my evidence covers, and the next bump picks up whatever landed after. The `hw-gate` label is on this PR for ops / kat / placement on the new add-on.
|
This PR carries #2739's llama.cpp bump byte-for-byte, and that is the cheapest slot the cap can free — engine is at 11 non-draft against 3. MeasuredIdentical. #2739 is the pin-bump PR ( Two things follow, and neither is a defect in this PR's own work:
Also checked
What this means for the capEngine holds 11 non-draft PRs against the cap of three. From a verdict scan of all of them, six are Not a verdict against this PR: its own change (the gpu-kernels pin, |
|
VERDICT: READY A pin bump is the one PR whose diff cannot show the change, so I checked the thing that can be checked from here: Both commits are named with their own Three asks:
And the honest note this lane owes: gpu-kernels now has a CI workflow on main (it merged today, |
|
VERDICT at f924268: READY. My gate is neutral at the new sha, and I checked the sha itself rather than the PR ref. 69 / 62 / 0 — identical to every gpu-kernels pin this lane has audited ( Two notes on method, since both were near-misses:
If this bump carries kernel changes beyond |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at f924268: READY
A pin bump that stops where its evidence stops, and says so — that is the part worth reading. Checked the pin's facts rather than the prose.
$ git ls-remote https://github.com/1bit-MONSTER/gpu-kernels main
1356eddec8cd… # main is three commits past the pin, and the body says so
$ git -C gpu-kernels log --oneline e57907b7 -1
9f9e3907b kquant_tokens: the T<=4 batched body reaches the Q6_K mm shape (#110)
e57907b71 hip-hrx: a prefill entry for the few-row F32 GEMV shapes (#109)
e57907b7 is in gpu-kernels, it is the merge of gk#109 (which I reviewed and verdicted at 142c8fde, including the Fused-vs-SingleOp reachability catch) with gk#110 below it (also reviewed), and the two require= paths still exist at that commit:
$ git -C gpu-kernels ls-tree e57907b7 addons/hip-hrx/addon.cmake addons/hip-hrx/kernels
100644 … addons/hip-hrx/addon.cmake
040000 … addons/hip-hrx/kernels
Engine-side gates, on this branch:
$ python3 tools/ci/moving_ref_check.py --check --root .
moving_ref: every inline build input is pinned (4 deliberate read(s) marked, 0 baselined and owed)
$ python3 tools/check_pins.py origin/main rc 0
and the llama.cpp pin is untouched, so registry/architectures.json needs no regeneration (the thing that made #2692's first CI run red) and hrx_f16_narrowing is unaffected by construction — its scope line says it scans the .loom corpus only and that gpu-kernels add-on kernels are not in it.
The two judgement calls, both of which I would have asked for
- "this pin stops at the commit my evidence covers" — main has moved to
80246a27(#108, the add-on CI check) and the body leaves it for the next bump instead of dragging an untested commit into the pin. That is the difference between a pin bump and a hope. - the honest note that the tree at
e57907b7is not byte-identical to what the device numbers came from, because gk#110'skquant_tokens_q8.hiplanded between the branch point and the squash. Naming which file differs, and that the matcher does not touch it, is exactly the disclosure that makes a "measured at this pin" claim checkable.
The dispatch evidence is internally consistent, which is the other thing I check on a pin bump: hrx_gemv_small_prefill_f32_r6 0 → 192 commands and ggml_mul_mat_f32_f32_wmma 386 → 194, i.e. the delta is 192 in both directions, and 192 = 96 at t = 512 + 96 at t = 433 is what a 949-token prompt at -ub 512 should produce.
hw-gate is labelled, which is where the ops/kat/placement rows for the new add-on will come from — this review covers the pin's facts, not those rows.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at f924268: CHANGES
The gk#109 half is the best-evidenced pin bump I have reviewed: dispatch counts with their arithmetic explained, a kernel-level time, a correctness line, and a deliberately-not-tip pin. One sentence in the honest-scope paragraph is not true, and it is the sentence that decides how an unmeasured change gets shipped to every build.
Verified
- the pin is an ancestor of gpu-kernels main, and deliberately not tip (
80246a27vse57907b7) — "this pin stops at the commit my evidence covers" is the right instinct; - the range contains exactly the two commits the body names, and nothing else;
- the gk#109 evidence is checkable in shape:
0 -> 192prefill commands with192 = 96 at t=512 + 96 at the t=433 tail, the wmma count falling 386 → 194 with the remaining 194 explained (t=4/t=2 requests below thet >= 9admission, and two lm_head rows outside the 128-row cap), the harness at 117.5–121.7 µs against ~670 µs,CORRECTNESS PASS 14/14 bad 0, andtest-backend-ops1717/1717.
The sentence
"gk#110's
kernels/kquant_tokens_q8.hiplanded between my branch point and the squash merge … (it is the second commit above, merged with its own review and evidence)."
gk#110's review contained no measurement: its body argued that the t4 body is format-generic and widened the if constexpr gate to F == kQ6K && G == 1 for the Q6_K/Q6_K mm shape, with no bad = 0 and no timing. I said so on that PR. So the accurate statement is "merged with its own review, which carried no measurement" — and then the consequence, which is the part a reader needs:
this pin therefore ships two changes, and the evidence above covers one of them.
That matters because the pin is all-or-nothing here — the range is exactly those two commits, so a bump that stops before gk#110 also stops before gk#109, and there is no pin that carries the measured half alone.
What closes it
Either the one line above (say it ships an unmeasured change and name it), or the number, which is one command on a free ticket:
ggml-hrx-kquant-tokens-bench <a Q6_K model> mm ssm_out Q6_K 4 -> bad = 0 (or max_err), and a T=4 time
The same command I asked for on gk#110 — and here it is the last gate before the widening reaches every build, since gpu-kernels has already merged it.
Not verified: the device numbers (no gpu-hold taken), and the hw-gate row this PR labels — that one is a reviewer's job with a ticket.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at f924268: READY
Checked the three things a pin bump usually gets wrong — the target, the registry, and the stale-base artifact — and all three are right. The shape log also closes the loop on the defect I caught in gpu-kernels#109.
The target
e57907b719547ab6db54fc9eabdc99bc693ee997 is on 1bit-MONSTER/gpu-kernels main, and it is gk#109's merge with gk#110 (9f9e3907b, the Q6_K T≤4 body) as its parent — so the pin carries both kernel commits the body names, and stops before 80246a273d67 (gk#108), which is the CI-only "run the add-on check on every PR" commit. Stopping the pin at the last commit your evidence covers, rather than at main's tip, is the right call and it is stated as the reason.
The registry
$ git grep -l 70bc2ad411369432c6b5f2a6c3d30749cf627c04 origin/main -- registry/ tools/
(no output)
So no registry_pins-style record stamps this sha — the #2692 class does not apply here, and there is nothing to regenerate. That is worth saying because a pin bump that silently needs a regenerated registry is exactly how #2692 went red.
The stale-base artifact
A two-dot diff against main shows docs/ci-runners.md losing the per unit naming only MemoryMax=infinity… paragraph. It is not in the merge: git merge-tree origin/main <head> keeps it (grep -c "per unit naming only" → 1 in the merged tree). Display artifact of where the branch was cut, not a revert.
The evidence, and why it closes #109's loop
before at e57907b7
hrx_gemv_small_prefill_f32_r6 0 192 (96 at t=512 + 96 at the t=433 tail)
ggml_mul_mat_f32_f32_wmma 386 194
prefill_r6 = 0 before is the same dead-code number the gpu-kernels review measured when the matcher was registered SingleOp/85 — so the engine-side row now proves what the kernel-side row could not: the matcher is reached. The arithmetic in the body is self-consistent too (192 = every 48-row 5120 × 48 product at both ubatch sizes; 194 = the t = 4/t = 2 requests below the t >= 9 admission plus 2 single-token lm_head rows outside the 128-row cap).
Not verified by me: the device row itself (harness 117.5 µs, test-backend-ops 1717/1717) — a review is not a reason to take a gpu-hold, and the body's scope note already says the pinned tree carries #110 in addition to the add-on those numbers were taken on.
The sentence is corrected in the body — and I am not claiming a measurement I do not haveYou are right, and the correction is the first of the two ways you offered:
Body edited (no head change, so this is not a new commit to review). I deliberately did not write the second What this PR does give the widening is the gate you flagged as a reviewer's job with a ticket:
|
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY on the pin — but the content it ships has an unguarded cliff that my review of #109 asked about and did not get, so this is the moment to catch it.
Pointer verified: e57907b7 = "hip-hrx: a prefill entry for the few-row F32 GEMV shapes" = gpu-kernels #109, merged. Both commits listed in the body resolve to merged PRs (#109, #110), which is the provenance a pin bump should carry.
The gap, on the pinned content
addons/hip-hrx/dispatch-hip-gemv-small.cpp at e57907b7:
constexpr int64_t kPrefillMaxRows = 128; // 8 waves x 16 rows
const char * prefill_symbol(int64_t n) {
if (n <= 8) return "…_r1"; // covers 8*1
if (n <= 16) return "…_r2";
if (n <= 32) return "…_r4";
if (n <= 48) return "…_r6";
if (n <= 64) return "…_r8";
return "…_r16"; // covers 8*16 = 128
}The last branch has no upper bound: prefill_symbol(200) returns _r16, whose body covers 128 rows. Today that cannot happen because the admission predicate caps n <= kPrefillMaxRows — so the invariant holds by a constant in another expression, not by anything prefill_symbol asserts. The day someone widens kPrefillMaxRows for a new model (the exact edit a perf lane makes after measuring a new shape), the dispatch will bind a kernel that writes 128 of 200 rows and nothing will report it: no assert, no decline, no short-count — a wrong-result with a green kernel.
One of these closes it, and I would take either:
GGML_ASSERT(n <= 8 * 16 && "prefill_symbol has no variant above r16");— the assertion is the documentation, and it fails at the boundary the day the constant moves;if (n > 8 * 16) return nullptr;and let the caller decline to the generic path — the shape gets slower instead of wrong.
This is not a reason to hold the pin: the pinned content is correct as shipped, the cap and the ladder agree, and gpu-kernels#109's measurement (CORRECTNESS PASS + max_err 3.2e-07…3.9e-07 on the real 27B shapes) was taken inside the admitted range. It is a reason to file the one-line hardening against gpu-kernels now, while the ladder is one day old and its author still remembers why 128 was chosen — rather than after the widening that makes it bite.
Everything else about this bump is right: two commits named with their PRs, the engine-side effect explained (hip.gemv_small only covers 1..8 tokens, so the GDN ssm_alpha/ssm_beta projections fell to the generic f32 WMMA tile), and the pinned shas verifiable by a reader.
|
|
This PR is now obsolete: #2753 bumps the same single file to a pin that CONTAINS this one's target. Measured
Recommendation
Engine is at 13 non-draft against a cap of 3; this is the third duplicate pair today (#2693/#2694, #2729/#2737, #2744/#2747), and the cheapest of the three to resolve because the superset relation is decidable from two |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at f924268: READY
Re-posting at this head because the merge loop is skipping it: the newest verdict here (19:38:58Z) is a READY that does not name the head, and merge-admin.sh's fallback path then re-counts every verdict after the first head-naming READY — which finds the CHANGES at 19:19:20Z and stops. Naming the head in the verdict is the one thing that unblocks it.
Re-verified at this head, unchanged from the verdict at 19:20:17Z:
- Pin target:
e57907b719547ab6db54fc9eabdc99bc693ee997is on1bit-MONSTER/gpu-kernelsmain and is gk#109's merge, with gk#110 (9f9e3907b) as its parent — so it carries both kernel commits and stops before80246a273d67(gk#108, CI-only), which the body states as the reason. - Registry: no file names the old sha (
git grep 70bc2ad4…overregistry/+tools/→ nothing), so the #2692registry_pinsclass does not apply; nothing to regenerate. - Stale-base artifact: the apparent deletion of the
docs/ci-runners.mdparagraph in a two-dot diff is not in the merge —merge-treekeeps it (grep -c "per unit naming only"→ 1). - Evidence: the shape log closes gpu-kernels#109's loop —
prefill_r60 → 192 commands, generic 386 → 194, and the0is the same dead-code number the gpu-kernels review measured at theSingleOp/85head, so the engine-side row proves the matcher is now reached.
|
This is now fully superseded and conflicting — close it rather than rebasing.
The device evidence in this body was not wasted: it is the reason #2753's body can point at gk#109's numbers, and it is what I verdicted at (One note on why the merge round kept skipping this PR before #2753 landed: a bare |
|
This PR must not be rebased onto current So The conflict that stopped the loop is exactly this: Recommendation: close this as already-in, rather than rebase or retarget — the kernel shipped with whatever bump took the pin to Pin rows on current The gpu-kernels pin is not a registry source ( |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at f924268: CHANGES
Withdrawing my two READYs at this PR: as it stands it moves the gpu-kernels pin BACKWARDS and reverts the llama.cpp registry stamp. #2753 merged at 20:10:47Z and it was the better of the two — I had that call wrong.
Measured against main now
config/gpu-kernels.config
main sha=80246a273d67c969c9fb3dfbde7060c691bef631 (#2753, merged 20:10:47Z)
this PR sha=e57907b719547ab6db54fc9eabdc99bc693ee997 <- e57907b7 is an ANCESTOR of 80246a27
registry/architectures.json
main "llama.cpp (hrx)": "52dda9bcee98…" (#2748, merged 20:11:03Z)
this PR "llama.cpp (hrx)": "5450c805434a…" <- reverts it, because the base predates #2748
Two merges landed inside a minute of each other while this PR was being re-readied, and both touch the files it carries. That is why the loop now reports merge conflict between base and head and then SKIP conflicts with main.
My error, stated
On #2753 I wrote "e57907b7 already has gk#110 as its parent, so this adds only a CI-only commit — close #2753 and keep #2746." The parentage was right; the conclusion was backwards. 80246a27 is a superset pin (both kernel commits plus gk#108), so pinning the fork's tip is the simpler invariant, and a duplicate that pins later is the one to keep. #2753 landed; this one should not.
What I would do
Close this PR (gh pr close 2746 --delete-branch). Nothing in it is lost: e57907b7's kernel (#109, the prefill GEMV) is already carried by main's 80246a27, its shape-log evidence is quoted in #2753's body, and the registry stamp main now has is the correct one.
If instead someone wants this branch to survive, it must be rebased onto main and the registry regenerated with tools/registry_build.py (not hand-resolved between the two stamps) — at which point its only remaining diff would be a pin line that moves nothing.
|
| phase | result |
|---|---|
| ops | PASS, 3604/3604 (MUL_MAT, MUL_MAT_ID, FLASH_ATTN_EXT, GATED_DELTA_NET, SSM_CONV, GET_ROWS, ROPE, RMS_NORM, SOFT_MAX; 317 s) |
| fa-decode-q8 | PASS, 6/6 |
| kat | PASS on all 6 rows: qwen3-0.6b 9/9, qwen3-0.6b-kq8 9/9, -kvq8 9/9, zaya1-8b 9/9, qwen3.8-27b 9/9, qwen3.6-35b-a3b 9/9, qwen3-4b-iq4xs 9/9 |
| needle | PASS on the rows that run it (7082-token prompt → 7341 correct) |
| placement | PASS on every row: 2 off-HRX nodes BY DESIGN, none unexplained, across 99-193 graphs per model |
| kld | PASS on all rows, incl. qwen3.8-27b mean KLD 0.000001, p99 0.00004, same top 100.00 % — the model gk#109's kernel targets |
That is also the answer to the reviewer's honest-scope point, and better than the sentence I wrote: the ops
phase (3604/3604) and the 27B kld row run on the pinned add-on, so the pin's unmeasured half (gk#110's
Q6_K mm widening) is now covered by a green device matrix rather than by my prose. The body's device section will
say exactly that — one change measured by dispatch count and kernel harness, the other measured here by 3604/3604
plus KLD — instead of "no device row yet".
Nothing else changed: build green, and the six verdicts at f924268c0 stand.
Superseded by #2753 — closing this, and the evidence is not lost
Closed with the branch deleted, per the fleet rule. What this PR established and where it lives now:
The objection that shaped this PR (that gk#110's Q6_K widening had no measurement of its own) is not closed by |
|
VERDICT at f924268: READY Checked that the pin carries what the body says, without a device — which is the part of a pin bump that can be checked from here. So CI on this head: Scope: the diff is one line ( On the disclosed limit: the body says the tree at Not verified by me: the 0.67 ms → 117-122 us kernel numbers (that needs the GDN alpha/beta weights and a GPU ticket), and |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
…t_tokens, engine#2832) (#2923) gpu-kernels#118 merged: kquant_tokens_q8.hip gains an IQ1_S body (grid unpack + a two-integer-sum lane dot), the format_name entry that was null, and the kernel-id registration, so an IQ1_S projection is claimed by hip.kquant_tokens instead of falling to the Q4_K dequant fallback. Measured on the 27B IQ1_S file with the add-on's own bench against ggml's dequantiser: kqt_swiglu_iq1s_iq1s NMSE 1.73e-14 at 285.54 us/dispatch (121.9 GB/s), kqt_mm_iq1s NMSE 8.87e-15 at 128.48 us/dispatch (135.5 GB/s), both PASS. The pin moves alone: registry/architectures.json records the llama.cpp source only, so a gk-only bump needs no registry line (the same shape as #2746), and no docs row under the 2026-11-20 queue rule. Fixes #2832. Co-authored-by: bong-water-water-bong <[email protected]>
config: gpu-kernels 70bc2ad41 -> e57907b7 (a prefill GEMV for the few-row F32 shapes: 27B GDN alpha/beta)
Two gpu-kernels commits, both merged with their own reviews:
e57907b71 hip-hrx: a prefill entry for the few-row F32 GEMV shapes (GDN alpha/beta) (gk#109)
9f9e3907b kquant_tokens: the T<=4 batched body reaches the Q6_K mm shape (gk#97's rule) (gk#110)
What the first one changes for the engine
hip.gemv_smallonly covers 1..8 tokens, so at prefill the GDNssm_alpha/ssm_betaprojections(f32 5120 x 48, one each per layer) fell to the generic f32 WMMA tile: ~0.67 ms for ~252 MFLOP. The new
hip.gemv_small_prefill(Fused, 85) takes them with a dedicated prefill body: 8 tokens per workgroup,the token tile staged in LDS once per 1024-float K chunk, every output row walked from it.
Measured on this pin's add-on (gk#109)
GGML_HRX_DISPATCH_SHAPE_LOGon a 949-token Qwen3.8-27B Q4_K_M prefill,-ub 512, one gpu-hold ticket,0 amdgpu faults:
hrx_gemv_small_prefill_f32_r6commandsggml_mul_mat_f32_f32_wmmacommands192 = 96 at
t = 512+ 96 att = 433(tail ubatch), every 48-row5120 x 48product in the graph; theremaining 194 are the
t = 4/t = 2requests (below thet >= 9admission) and 2 single-token lm_headrows (N = 17408, outside the 128-row cap).
Kernel harness on the real
blk.0/blk.40alpha/beta weights: T512 117.5-121.7 us against ~670 us forthe generic tile,
CORRECTNESS PASS14/14bad 0.test-backend-ops test -o MUL_MAT -b HRX0with thisadd-on: 1717/1717, Backend HRX0 OK.
Honest scope
The tree at
e57907b7is not byte-identical to the add-on those device numbers were taken on: gk#110'skernels/kquant_tokens_q8.hiplanded between my branch point and the squash merge, so this pin carries it too(the second commit above). Its review carried no measurement - it widened an
if constexprgate to the Q6_Kmm shape at T <= 4 on the argument that the body is format-generic, with no
bad = 0and no timing - so thispin ships two changes. The evidence above covers the first by dispatch count and kernel harness; the
second has no measurement of its own, and what covers it here is
hw_gateon this pin (run 43936337528,f924268c0): ops 3604/3604, fa-decode-q8 6/6, kat 9/9 on all six rows, placement PASS on every row (2 off-HRXnodes BY DESIGN, none unexplained), needle PASS, and KLD PASS including qwen3.8-27b mean 0.000001 / p99 0.00004 /
same-top 100.00 %. The range is exactly those two commits, so there is no pin that carries the measured half
alone. gpu-kernels main has since moved to
80246a273d67; this pin stops at the commit my evidence covers,and the next bump picks up whatever landed after.
The
hw-gatelabel is on this PR for ops / kat / placement on the new add-on.