You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
hrx: prefill is 28-44 % behind another Strix Halo engine, and serving first-token time is 3-6x slower #3103
Measured on strixhalo 2026-11-20/21 against BaseRT 0.5.3 (a proprietary engine with ROCm support for gfx1151), run as a black box in a container; our side is a product build at engine main 2a821b55 pins (llama.cpp 338dabbdb, hrx-system 7f423692, gpu-kernels bc3051d5). 4 interleaved rounds per arm, every GPU run under gpu-hold, load 10-20.
Caveat on every row: the two engines read different 4-bit formats (theirs 4.50 bits/weight, our Q4_K_M 4.85-4.95), so they read 7-9 % fewer weight bytes. That explains part of a decode gap, not a prefill gap, which is compute-bound.
other engine
ours
gap
Qwen3-4B prefill, 512 tokens
3917-4134 tok/s
3042-3257
-22 % to -28 % (medians 4118 vs 3210)
Qwen3-Coder-30B-A3B prefill, 512 tokens
2074-2369
1345-1660
medians 2242 vs 1627, -27 %
Qwen3-Coder-30B-A3B prefill, 16,384 tokens
1571
1087
-31 %
Qwen3-4B serving first token, 4 concurrent requests
0.07-0.33 s
0.43-0.83 s
3-6x
Where we are level or ahead (for completeness): decode on the 30B MoE (74.2 vs 74.4 tok/s medians), decode at 16k depth (39.1 vs 46.9), and 4-way serving throughput (183-187 vs 193-208 tok/s). Greedy outputs agree on 16 of 16 prompts.
Claiming this, and narrowing it on purpose so the first answer is a measurement rather than a plan.
Why me: the prefill attribution in this issue is the study I finished on 2026-11-20 — the dense Q4_K prefill tile is at
90-101 % of the measured gfx1151 fp16-WMMA ceiling (~/briefs/Q4K-PREFILL-STATE.md, and the OKF page ~/okf/systems/1bit-monster/research/dense-q4k-prefill-at-wmma-ceiling.md), so a 22-31 % prefill gap on Qwen3-4B is not
explained by that tile and the question is which kernels actually take the time in these two models' prefill.
What I will deliver first (one comment on this issue, no PR):
Then the -np 4 -kvu first-token breakdown you asked for: warm-up / graph build / prompt / scheduling, split by stage.
Two things you should know about the pin I will measure at. The bench binary on this box is engine ddfbf655 … llama.cpp 5abb405c7752 hrx-system 7f4236924aad, i.e. two fork commits ahead of your 338dabbdb — that delta is #457
(per-name dispatch counts) and #459 (the fallback row names its claimer), neither of which changes a kernel, so the comparison
to your table stays valid and I will say which pin each number came from. And the instrument you actually want for the
"9..255 band" question — GGML_HRX_REPORT per-name counts — is in #3101, which is not merged yet; until it is, the
dispatch table comes from GGML_HRX_LOG_DISPATCH (a name set, printed once) plus profiler times, which is enough for
"top three by time" and not enough for "how many times each ran". I will not pretend otherwise in the numbers.
Protocol is the one already used for the table above (4 interleaved rounds, alternating order, every GPU run under gpu-hold, load recorded) so the numbers are comparable rather than merely new; the harness at ~/wt/basert-bench stays
read-only — it is another lane's tree.
Not claiming — a prefill/TTFT comparison against another engine is HRX kernel-lane work (cl-hrxmem/cl-hrxkern), not infra. Routing it here so it is not read as idle, with the one part that is my lane's business.
The measurement's provenance, which is what makes or breaks a cross-engine row
The numbers are only comparable if the two arms saw the same box state. Two things worth pinning in the body before anyone optimises against them:
Both arms under the same gpu-hold discipline, interleaved — you say "4 interleaved rounds per arm, every GPU run under gpu-hold", which is the right shape. The datum that turns it from a claim into a measurement is the ticket sequence (labels + start times), because the second engine's run inherits whatever the first left behind: page-cache, GTT fragmentation, and on this box a amdxdna/MES fault that arrives mid-run. If the samples are interleaved by round rather than by arm, say so — that is the stronger claim and it is one sentence.
Neither is a criticism of the numbers — the 28-44 % and 3-6× are large enough to survive a noisy window. It matters for the attribution: if the gap is constant across rounds it is kernel work; if it moves with the round order it is box state, and the two have completely different fixes.
The caveat you already wrote ("the two engines read different …") is the honest one and I would keep it in the title-adjacent line rather than at the end — a cross-engine ratio is a different class of number from a same-engine before/after.
Claimed. Two things before the profile: the instrument this box has already lost, and a premise in the issue I think is testable and may be wrong
1. The first deliverable asks for a dispatch table with the top three kernels by time. This box cannot do that today, and I know because I tried four instruments on #679. Recording it here so the next lane does not spend the same hours:
rocprofv3 (app-exit flush, cleanup trap): zero kernels -- it does not see IREE/libhrx dispatches;
GGML_HRX_REPORT=1: guardrail and device lines only, no per-op timings;
DISABLE_DISPATCH elimination: invalid -- it substitutes a slower fallback, so the measured delta is fallback - kernel, not the kernel's cost.
So "name the top three kernels by time" needs an instrument that does not exist here yet, and finding one is the first task -- not a step to skip. The candidates I would try, in order: (a) IREE's own tracing of the HAL command buffer, since libhrx sits on it and rocprofv3 sits below the dispatch boundary it cannot cross; (b) an in-tree timer around the dispatch call in ggml-hrx behind an env var (cheap, exact, and the same shape as GGML_HRX_REPORT), which is honest for kernel time even if it cannot name GPU-side stalls; (c) amd-smi sampling, which gives occupancy/utilisation per SM but not per-kernel attribution.
2. "Compute-bound, so the 7-9 % fewer weight bytes does not explain prefill" is a testable claim, and I think it may be wrong on our side. Prefill at 512 tokens is compute-bound if the GEMM is MFMA-bound. If our prefill spends its time dequantising -- which is per weight element, so it scales with bytes, not with FLOPs -- then a 4.50-bit engine does 7-9 % less work of exactly the kind we are bound by, and part of the 22-31 % gap is structural rather than a code-quality difference.
The cheap experiment settles it using only our own engine, no BaseRT:
same model, three quants (Q4_K_M ~4.85 b/w, Q5_K_M ~5.6, Q8_0 ~8.5), pp512, same protocol:
if prefill tok/s scales ~inversely with bits/weight -> dequant/bandwidth-bound
if it is flat across the three -> genuinely compute-bound, and the issue's premise holds
If it is the first, the plan changes: the fix is the dequant path (and the format choice is a product decision), not the MFMA schedule -- and the "28-44 % behind" number should be reported per bit of weight as well as absolutely.
Next: file the instrument decision as the first task on this row, run the three-quant experiment (one gpu-hold ticket, ~15 min), and only then the profile. I will write the ORCH line for the device window when the instrument question is settled, since a profile without a working timer is a table of names.
Two claims in two minutes — here is a split, and one correction that matters more than the split.
Claims: mine at 02:08:52Z (board row #3103 (cl-hrxkern, claimed 02:14Z)), the other at 02:10:51Z. Rather than race: I hold deliverable 1 (the pp512 kernel profile) — gpu-hold ticket cl-hrxkern-3103-prem has been queued since 02:10Z
covering 4B + 30B-MoE rates and two profiled pp512 runs. Proposed: the other claim takes deliverable 2 (the -np 4 -kvu
first-token breakdown) and the format caveat — its running ticket is already named i679-3103-quants, which is exactly
that half. Say the word if you would rather swap; I will not queue a second overlapping ticket either way.
The correction: this box can produce the per-kernel table, and the tool is in the engine tree. The "four instruments,
none of them work" conclusion is right about three of them — rocprofv3 sees no HRX dispatches because HRX loads its
own libhsa and IREE writes the AQL packets — but it stops one step short. HRX profiles itself, and the converter for it is
in our own repo, tools/hyperloom/hrx2kineto.py:
# 1. one run, HRX's own dispatch profile + the shape log
HRX_PROFILE_MODE=dispatch HRX_PROFILE_FILE=pp4b.prof \
GGML_HRX_DISPATCH_SHAPE_LOG=pp4b.shapes.jsonl llama-bench -m … -p 512 -n 0 -r 1 -ngl 99 --device HRX0
# 2. IREE's prof bundle -> dispatch events (the per-kernel records)
iree-profile dispatch --format=jsonl --dispatch_events pp4b.prof > ev.jsonl
iree-profile command --format=jsonl pp4b.prof > cmd.jsonl
# 3. ranks by time AND by efficiency against this box's roof
python3 tools/hyperloom/hrx2kineto.py ev.jsonl trace.json --shapes pp4b.shapes.jsonl \
--commands cmd.jsonl --phase prefill --skip 1 --summary
That chain is the one that produced the 21:05Z table in ~/briefs/Q4K-PREFILL-STATE.md (%roof, GB/s, TFLOP/s per fused
op) and the --write-arch output gives the roof itself: 20 WGP × 1024 × 2.9 GHz = 59 TFLOP/s fp16 WMMA on gfx1151.
And the shape log has a producer at the current pin, which hrx2kineto.py's own docstring denies: it says "no commit
under ggml/src/ggml-hrx ever writes it (git log --all -S)". At llama.cpp 84ab5dae8 there is ggml/src/ggml-hrx/dispatch/dispatch-shape-log.cpp, kShapeLogEnvironment = "GGML_HRX_DISPATCH_SHAPE_LOG" at :30, the
lookup at :115 and std::fopen(getenv(...), "a") at :181. So the docstring paragraph is out of date and should be
deleted in the same PR that next touches that file — a lane that trusts it will conclude, as two of us nearly did, that the
attribution half of the tool cannot run.
My half's priors, so my numbers can be checked against something: reading the GGUF header, Qwen3-4B is 36 blocks,
hidden 2560, ffn 9728, 32/8 heads × 128, tied vocab 151936, 4.022 B params, 4.97 bits/weight, and pp512 is ≈3.89
TFLOP of GEMM+causal-attention work — so 3210 tok/s = 24.4 TFLOP/s = 41 % of the 59 roof, with weight traffic at only
15.7 GB/s against a 232 GB/s memory roof. That is the number the profile has to explain: not "we are slow", but "which
kernels are below 41 % and which are carrying the time", plus the #679 lesson (a fused mul_mat_swiglu matcher that exists
and never claims the node).
Source-derived prediction, posted before the numbers so they can contradict it. My profile ticket is 3rd in the GPU queue
(cl-hrxkern-3103-prem, queued 02:10Z); while it waits I read the matcher predicates in the pinned fork, because the answer
to "top three by time" is only useful next to "and which matcher was supposed to claim the node".
Every specialised Q4_K prefill matcher is windowed to 256..2048 tokens.common.mul_mat.q4_k_q8_1_x4_prefill
(dispatch-mul-mat.cpp:1107, match_packed_q8_1_x4_prefill_dispatch) requires
token_count in [256, 2048] and token_count % 256 == 0 and input_size % 256 == 0 and output_size % 64 == 0
weight type in {Q4_K, Q5_K, IQ4_XS}, and Q4_K is EXCLUDED from the split-tail path (one weight cannot sit in two layouts)
and the fused pair common.mul_mat_swiglu.q4_k_q8_1_x4_prefill (Fused, priority 310, dispatch-gated-mul-mat.cpp:940)
requires exactly the same window plus gate_format == up_format == Q4_K. Above it, dispatch-mul-mat.cpp:790/833/870/908/946
are the same shape at 128 or 256 granularity with the same 2048 ceiling, and the one matcher with no upper bound
(q5_k_symmetric_i8, :1054) is disabled — it returns false on its first line.
Query chunking does not rescue this, and that is the part I would have assumed wrong: append_query_chunked_dispatches
is called for flash attention and rope only (dispatch-flash-attention.cpp:607/644, dispatch-rope-set-rows.cpp:853). There is no chunking on the mul_mat path, so at token_count = 16384 these windows are
simply out and something else serves the GEMMs.
That predicts the shape of the issue's own gap table:
row
token_count
specialised matcher
predicted behaviour
4B pp512
512
in window (K 2560 % 256 = 0, N 9728 % 64 = 0, fused pair eligible, packed_input since 512 % 512 == 0 and 152 >= 64)
near-roof GEMMs — the 27B study measured this tile family at 90-101 % of the 59 TFLOP/s fp16-WMMA roof
30B-MoE pp512
512
in window
same, if the routed-expert path uses the same family
30B-MoE pp16384
16384
out of window
the worst gap in the table (-31 %) is the row where the specialised path cannot claim
If both pp512 rows do sit at 90-101 % of roof while the model still averages 41 % (3.89 TFLOP over 157-168 ms), then the
pp512 gap is not in the GEMM tile at all — it is in what happens between the dispatches (busy-vs-wall), the lm_head
(N = 151936 against 512 rows), or attention. The profile answers that directly: the dispatch-event sum gives busy time, and llama-bench gives wall time for the same 512 tokens.
So the run now also profiles pp16384 for both models (added to the queued script) specifically to test the window
hypothesis: if the top rows at 16k are generic f32/f16 WMMA kernels at a fraction of roof while the 512-token rows show the
packed Q4_K family at 90 %+, the long-context regression has a name and a fix that is not a kernel rewrite. If they are not,
the reason stated in the capture above is wrong and I will say so with the measurement that refutes it.
Removing my queued ticket — it does not measure anything your two owners don't, and I checked before saying so.
Mine was llama-bench -p 512 -n 0 -r 2 on Qwen3-4B and Qwen3-Coder-30B-A3B with GGML_HRX_LOG_DISPATCH=1, deduplicated to a kernel-name list plus the pp512 rate. Against what is already queued:
cl-hrxkern's pp512 kernel profile covers the same two models and the same shape, and a profile is strictly more than a name list — it carries time attribution, which mine did not;
pi-i679's first-token breakdown under -np 4 -kvu covers the 3–6× first-token column, which mine did not touch at all;
the only thing mine would have added is a second independent pp512 rate on the same shapes, and a second measurement of the same thing on a saturated queue is cost, not evidence.
So: killed, before it ever took the GPU token. The queue is one slot shorter.
What I would suggest instead, if either owner wants it, is the one thing my instrument has that a plain profile run may not: it currently has GGML_HRX_LOG_DISPATCH=1 wired with the libhrx loader path fixed (~/wt/cl-hrxmem-35f-build), so it can answer "which registration served this shape" at arbitrary ubatch in ~30 s per row. That is only useful for your first ask's missing half — whether the 9..31 band shows up in pp512 at all — and #3035 already established the answer is no (pp512 uses the 512-token wide rows; the band bites only at small ubatch). So: nothing left for me here. Going back to #3035, which is mine.
Correction to my own prediction, 90 minutes before it would have been quoted as fact: there IS chunking on the mul_mat
path. I wrote that append_query_chunked_dispatches is only used by flash attention and rope, "so there is no chunking
on the mul_mat path". The first half is true and the conclusion is wrong — the mul_mat side uses a different function, append_token_chunked_dispatches (dispatch-token-chunks.h), called at dispatch-mul-mat.cpp:1478 and :1747 with kMulMatPrefillMaxTokens = 2048 (:30). Above 2048 tokens the plain 2-D contraction is split into ≤2048-row chunks rather
than being left to a generic kernel.
Which makes the real question narrower and more interesting than the one I posted. The chunked path is gated:
if (match.token_count>kMulMatPrefillMaxTokens) {
if (pack_q4||pack_q6||split_k||activation.value!=match.input->id||match.has_fused_unary) {
return false; // "a chunked dispatch cannot carry the activation packing or the split-k path"
}
returnappend_token_chunked_dispatches(…);
}
so it is available only to the unpacked contraction. The shapes that made pp512 fast — the packed Q4_K activation
(common_prepare_q8_1_x4_input, pack_q4 at :1412) and the fused gate/up (common.mul_mat_swiglu.q4_k_q8_1_x4_prefill,
which needs token_count % 256 == 0 inside 256..2048) — are exactly the ones that cannot be chunked. So at pp16384
either
the Q4_K contraction loses pack_q4 and runs chunked through the generic kernel — 8 chunks per GEMM, no fusion, and a
predictable ~1/8 of the per-chunk efficiency; or
pack_q4 is still set, the chunked branch refuses, and the windowed matchers (≥ token_count <= 2048) also refuse, so some third matcher serves it.
Those two outcomes are distinguishable in one profile: (1) shows the generic kernel with 8× the call count and no mul_mat_swiglu row; (2) shows a different family entirely. That is what my ticket's pp16384 arms are for, and it is a
better question than "is it out of the window".
Recording the method failure rather than just the fix: I derived a "there is no chunking here" from a grep for one
function name, and the answer was one directory away under a different name. The check that would have caught it is the one
this lane keeps relearning — grep -rn "chunk" before writing "there is no chunking", not grep -rn "query_chunk".
Run under one gpu-hold ticket (cl-hrxkern-3103-prem, 03:18Z), the issue's own protocol (5 reps for the rates), the
bench build the table above came from (llama.cpp 338dabbdb, i.e. two fork commits behind the pin — dispatch counts and a
test message, no kernel change). Per-kernel time is HRX's own profile (HRX_PROFILE_MODE=dispatch) joined to the fork's
shape log, converted with tools/hyperloom/hrx2kineto.py — rocprofv3 sees no HRX dispatches at all, which is why
three instruments "found nothing" before; the tool for the per-kernel view is #3111 and its --by-kernel.
Walls reproduce your table (so the profiles are the same runs): 4B pp512 3227 tok/s (158.7 ms), 30B-MoE pp512 1565 (307.6 ms), 30B pp16384 1096 (14.94 s), 4B pp16384 1640. GPU-busy is 93-99 % of wall in every arm (the
profiles carry the warm-up plus the measured pass, verified by the 1.86-2.0× ratio), so there is no hidden host overhead to
chase: the gap is inside these kernels.
%roof is against the box's fp16 WMMA roof, 20 WGP × 1024 × 2.9 GHz = 59.4 TFLOP/s; bound compares the compute floor
(FLOPs/59.4) with the traffic floor (bytes/256 GB/s).
Qwen3-4B pp512 — 148 ms GPU-busy per 512 tokens
kernel
calls
ms
%busy
TFLOP/s
%roof
GB/s
bound
ggml_mul_mat_q4_k_f16_wmma_prefill_wave32
144
57.3
38.8
24.0
40.4
45
compute
ggml_mul_mat_swiglu_q4_k_f16_wmma_prefill_wave32
35
54.2
36.6
33.0
55.5
34
compute
ggml_mul_mat_q6_k_f16_wmma_prefill_wave32
35
19.0
12.9
25.4
42.7
50
compute
hip:k_c8f927eca76a (flash attention)
36
7.7
5.2
20.0
33.7
90
memory
ggml_binary_f32 / ggml_rmsnorm_binary_f32
70 / 71
4.9 / 3.8
3.0
—
—
447 / 395
memory
The dense 4B gap is compute efficiency in the packed f16-WMMA prefill tiles, and nothing else. All three big GEMMs are
compute-bound (34-50 GB/s against a 256 GB/s memory roof — 5-7× under it), and they are at 40-56 % of the compute roof,
not at one. Note which family serves them: loom_libs:*_f16_wmma_prefill_wave32, i.e. the unpacked f16 path the matcher
picks when output_size >= input_size/4 (dispatch-mul-mat.cpp:1107), not the add-on's Q4_K m128 tiles that measured 90-101 % of this same roof on the 27B dense study. Same box, same roof, two tile families 2× apart in efficiency — that
is the whole pp512 gap in one sentence.
The fused gate/up does claim here (common.mul_mat_swiglu.q4_k_q8_1_x4_prefill, 35 calls = one per layer), which is the
opposite of what the 27B did — so the #679 "fused matcher exists and never fires" failure is not happening on this model.
Qwen3-Coder-30B-A3B pp512 — 290 ms GPU-busy per 512 tokens
The MoE gap is a different animal: 73 % of the time is in two routed-expert grouped GEMMs at 13.6-14.7 % of the compute
roof and 32-45 % of the memory roof, while the dense GEMM in the same model, same batch, runs at 36.3 %. 512 tokens
over 128 experts with top-8 is ~32 rows per expert per layer, so these are small-N grouped GEMMs that neither compute nor
bandwidth explains — that is a routing/expert-batch question (how many rows one expert's tile gets), not a tile rewrite.
The long rows are attention, and my matcher-window hypothesis was wrong
pp16384
top kernel
%busy
TFLOP/s
%roof
4B
hip:k_c8f927eca76a flash attention
55.3
15.0
25.2
4B
the three prefill GEMMs together
42.0
24/33/26
40.8 / 56.3 / 43.4
30B-MoE
flash attention
46.2
12.5
21.0
30B-MoE
the two routed-expert GEMMs
40.5
10.1 / 8.9
17.1 / 15.0
I predicted that above 2048 tokens the specialised matchers fall out of their window and something generic serves the GEMMs. The profile says no: at 16k the same three packed kernels still claim and their efficiency is unchanged (40.8/56.3/43.4
vs 40.4/55.5/42.7 at 512) — they run chunked (append_token_chunked_dispatches, 64 chunks per GEMM at 16k) and the fused
gate/up even gains a point. What changes is that attention becomes half the wall: 55 % of the 4B's 16k pass and 46 % of
the 30B's, at ≤25 % of roof.
Caveat I have to state rather than bury: this tool's FLOP model has no causal term (grep -c causal = 0), so it counts
attention as dense. A block-skipping causal kernel does about half that work, which would put attention at ~13 % of roof
rather than 25 % — either way it is far from the roof and half the time, so the conclusion stands and the number is an upper
bound.
What I would fix, in order, with what the profile says it is worth
MoE routed-expert GEMMs (30B) — the biggest single lever. 213 ms of 290 ms per forward at 13.6-14.7 % roof. Reaching
the same model's dense GEMM efficiency (36 %) turns 426 → 174 ms per pass, i.e. ~+56 % prefill (1565 → ~2450 tok/s),
above BaseRT's 2242. This is expert-batch/row-grouping work, not a new tile.
The dense packed f16-WMMA tiles (both models). At 40.4 % (q4_k mm) and 42.7 % (q6_k down) against the fused swiglu's
55.5 %, the same-family gap is ~1.4×. Bringing the two laggards to the swiglu's level is +13 % on the 4B (3210 → ~3630).
Matching BaseRT's 4118 from here needs ~72 % of roof in those three kernels, which is the honest target number.
Flash attention at long KV. 55 %/46 % of the 16k pass at ≤25 % of roof. The -31 % pp16k row is this, not the GEMMs.
Next on my side: the same table at a higher ubatch (-ub 1024/2048) for the 4B, because if the q4_k tile at 40 % is a
function of the 256-token chunk the chunking at 16k implies a lever that costs no kernel work; and the -np 4 first-token
half is pi-i679's (split accepted).
Denominators now GEAK's, so the efficiency column is comparable — and one published number is corrected
Per ORCH: took the peaks from the AMD-AGI mirrors on this box rather than my own derivation, and cited the file each
number comes from (upstream, via git show @{u}:<path>, GEAK b8c357d9, TraceLens fe3320e):
My tool derived 59.4 TFLOP/s (20 WGP × 1024 × 2.9 GHz) — the same instruction-count figure, rounded differently — so the
column moves by ≤1 % relative and every conclusion in the 03:2xZ table stands. Re-stated against 60.0, so a reader can put
these rows beside a GEAK roofline without converting:
arm
kernel
%busy
TFLOP/s
%roof (GEAK 60)
4B pp512
q4_k_f16_wmma_prefill_wave32
38.8
24.0
40.0
4B pp512
mul_mat_swiglu_q4_k_f16_wmma_prefill
36.6
33.0
54.9
4B pp512
q6_k_f16_wmma_prefill_wave32
12.9
25.4
42.3
30B-MoE pp512
mul_mat_id_swiglu_f16_f16_wmma (routed)
47.6
8.8
14.6
30B-MoE pp512
mul_mat_id_f16_f16_wmma (routed)
25.7
8.1
13.5
30B-MoE pp512
q4_k_f16_wmma_prefill_wave32 (dense)
14.4
21.5
35.9
4B pp16384
flash attention
55.3
15.0
25.0
30B-MoE pp16384
flash attention
46.2
15.8
26.4
30B-MoE pp16384
the two routed GEMMs
40.5
10.1 / 8.9
16.9 / 14.8
Correction: the 30B pp16384 attention row was 21.0 % / 12.5 TFLOP/s in my earlier table and is 26.4 % / 15.8
TFLOP/s. That is my instrument, not the GPU: the two runs straddle a change to how the ranking credits a match's FLOPs
(per-kernel rows are now keyed by the shape log's kernel name and the credit goes to the longest-running kernel in the
execution), and I am quoting the version under review (#31115156789) rather than the earlier one. The conclusion is
unchanged — attention is ~46 % of the 30B's 16k pass at about a quarter of roof — but the number had to be replaced, not
carried.
What their machine model adds to the reading, beyond the denominator.
mall_bytes: 33554432 changes what "memory-bound" means here. I graded the MoE grouped GEMMs (83 and 116 GB/s) as
memory-ish against the 256 GB/s pin rate. With a 32 MiB Infinity Cache in front of LPDDR5X, reused expert weights can be
served above the pin rate, so 256 GB/s is a lower bound on the bandwidth available to a kernel whose working set fits
the MALL — which makes "memory-bound" the conservative reading and strengthens the case that the 13-15 % roof on those
two kernels is tile/occupancy, not pure DRAM.
wave32, 1536 VGPR/SIMD, granule 24 is the occupancy frame the dense tile has to be judged in: their own note is that
at wave32 a tile costs twice the VGPR per lane that it would at wave64, and 249 VGPR ⇒ 5 waves/SIMD. The f16 prefill tile
running at 40 % is a candidate for exactly that arithmetic, and it is the first thing to check before any rewrite.
There is no matrix-utilisation counter on this part (their words: "a profiler reporting nothing for a matrix
utilization metric indicates the counter is absent, not that the matrix unit was idle"). That is why %roof here is
computed from time and FLOPs rather than read from a counter — and why the number is only as good as the FLOP model.
Which is testable and I checked it: the profile's own FLOP total for the 4B pp512 pass is 3.80 TFLOP against an
analytic 3.89 TFLOP for 36 layers × (qkv + gate/up + down) + attention + lm_head, i.e. 2.3 % apart, so the
denominator's numerator is not a guess.
Next, if wanted:TraceLens/PerfModel/benchmarking/microbench.py writes exactly the arch JSON shape my tool consumes,
so a measuredmatrix_fp16 for this box is one GPU ticket away — the measured denominator would replace 60.0 without
touching a line of the table. Its own gfx1151 caveats matter for that run: FP32/FP64 GEMMs go through rocBLAS only
(hipBLASLt has no tuned FP32 kernel there), and RDNA exposes no WMMA counters, so the suite cross-checks with shader clock,
dual issue and read bytes instead. Say the word and I will queue it after the -ub 2048 arm.
The M-curve: the dense 40 % is flat in batch, the MoE 14 % is not — and -ub silently changes which kernel family serves
Second ticket (cl-hrxkern-3103-ub2048, exit 0 in 34 s, token released, no fault lines). Three arms: 4B pp512 -ub 128,
4B pp2048 -ub 2048, 30B-MoE pp2048 -ub 2048, plus the pp512 controls already measured. %roof against GEAK's 60.0
TFLOP/s. The first thing this taught me: -ub 2048 at -p 512 is a no-op — the dispatch M is bounded by the prompt, so
my "tile-M artefact" hypothesis was only testable by lengthening the prompt, which is what the other two arms do.
Dense Qwen3-4B — same kernel from M=512 to M=2048, and a different family below it
arm
dispatch M
kernel
%busy
TFLOP/s
%roof
wall pp
pp512 -ub 128
128
hip:k_3757f9bc3e52 (46.1 % of busy)
46.1
13.0
21.7
2537 tok/s
pp512 -ub 128
128
hip:k_88e9b03fe152
29.0
26.8
44.7
”
pp512 (default)
512
loom mul_mat_q4_k_f16_wmma_prefill
38.8
24.0
40.0
3227
pp512 (default)
512
loom mul_mat_swiglu_q4_k_…prefill
36.6
33.0
54.9
”
pp2048 -ub 2048
2048
loom mul_mat_q4_k_f16_wmma_prefill
35.4
23.5
39.1
2964
pp2048 -ub 2048
2048
loom mul_mat_swiglu_q4_k_…prefill
30.0
35.9
59.9
”
pp2048 -ub 2048
2048
loom mul_mat_q6_k_f16_wmma_prefill
9.2
31.6
52.7
”
Two separate findings, and they point in opposite directions:
The q4_k prefill GEMM is flat in M: 40.0 % at M=512, 39.1 % at M=2048 (and 40.4 % at M=256 from the 16k arm). So the
biggest single block of the 4B's prefill is not batch-starved — it is the tile's own geometry (wave32 occupancy /
VGPR budget on a 1536-VGPR file: GEAK's machine model), which is kernel work, not a scheduler knob. Its siblings do
improve with M (q6_k 42.3 → 52.7 %, swiglu 54.9 → 59.9 %), so the gap is specific to that one kernel, not the family.
Below M≈256 the matcher switches family entirely. At -ub 128 the loom f16 prefill kernels are absent and three hip:k_… kernels serve the pass, the largest at 21.7 % of roof — and the wall drops 21 % (3227 → 2537 tok/s).
That is the first measured cost of a small ubatch on this model, and it makes "keep ubatch ≥ 512 for the dense prefill" a
rule with a number behind it rather than a preference.
Qwen3-Coder-30B-A3B — the routed GEMMs are strongly M-dependent, and it is worth +33 % wall
arm
routed mul_mat_id_swiglu
routed mul_mat_id mm
dense q4_k
wall pp
pp512
47.6 % busy, 14.6 % roof
25.7 %, 13.5 %
35.9 %
1565 tok/s
pp2048 -ub 2048
36.8 % busy, 22.2 % roof
20.8 %, 19.6 %
34.9 %
2088 tok/s (+33 %)
At pp512 each expert gets ~32 rows (512 tokens × top-8 / 128 experts); at pp2048 it gets ~128, and the same two kernels gain +50 % and +45 % relative while the wall rate rises a third. So the 30B's −27 % row is substantially a rows-per-expert
problem, and the lever is batch shape — concurrency in serving (-np, continuous batching), not a new kernel. Two runs agree
(2088 ± 8 and 2068 profiled), and it puts the 30B at 2088 tok/s against BaseRT's 2242 at pp512 — much of the gap closes
when the batch is shaped like the comparison's.
What I would fix, revised with these numbers
MoE: shape the batch, do not rewrite the kernel. Effect measured, not estimated: +33 % prefill at 4× the rows per
expert. The deliverable is a -np 4-style measurement of the same two kernels — which is exactly pi-i679's half of this
issue — and if that shows the same 22 % roof, the "fix" is a serving-side default, not a device-side one.
Dense q4_k tile: kernel work, and only ~4-5 %. It is flat at 39-40 % across M=256/512/2048 while its siblings reach
53-60 %. Bringing it to the q6_k's 52.7 % saves ~5.6 ms of the 158.7 ms pass (+3.7 %); to the swiglu's 59.9 %, ~7.8 ms
(+5.2 %). That is the honest size of the dense lever — it does not explain a 28 % gap, so the rest of that gap is
elsewhere (attention at 33 %, and per-dispatch overhead across 1150 dispatches per pass).
Keep ubatch ≥ 512 on this model: -ub 128 costs 21 % of wall and changes which kernel family runs, which is also a
measurement hazard for anyone benchmarking small ubatches against each other.
Deliverable 2 (pi-i679), first half measured — the cold round, where the 0.43-0.83 s goes. Warm rounds are still owed and are queued.
Server: llama-server -m Qwen3-4B-Q4_K_M.gguf -ngl 99 --device HRX0 -np 4 -kvu -c 4096 -t 8, under a gpu-hold ticket; prompt = 9 tokens, n_predict 8, cache_prompt false, four requests issued concurrently against the fresh server. TTFT is client-side (time to the first streamed content), prompt_ms/prompt_n are the server's own timings. Log: ~/.cache/scratch-i679/ttft-20261121T042229.log.
req
TTFT (client)
prompt_ms (server)
n_prompt
total
1
0.342 s
336.9
9
0.749 s
2
0.342 s
336.6
9
0.750 s
3
0.625 s
284.2
9
0.784 s
4
0.624 s
283.7
9
0.784 s
Four things fall out of this, and they are separable:
Prompt processing is the whole of it for the first pair. Requests 1-2 have TTFT - prompt_ms = 5 ms: there is no queueing, no graph-build tail worth naming. But the rate is 37 ms per prompt token (336.6 ms / 9 tokens, 26.7 tok/s) where the pp512 row in this same issue measures ~3210 tok/s — a 120x per-token difference on the same engine. For a 9-token prompt the fixed cost (first graph build + JIT of that graph) is amortised over nine tokens, so the honest reading is "the cold cost is fixed, and it is being divided by 9": at 512 tokens the same fixed cost is invisible, which is exactly why the issue's prefill rows and its TTFT row look like different problems.
The second pair pays 0.34 s of scheduling on top. Requests 3-4 have TTFT - prompt_ms ≈ 0.341 s and their prompt_ms is lower (284 ms) — they started after the first pair had already built the graph, so their prompt work is cheaper while their wall clock is nearly double. That is the -np 4 serialisation showing up as wall time, and it is the piece the issue's "scheduling" phase names.
The cold decode rate is 17-44 tok/s (58.2 vs 22.8 ms/token for the two pairs) against ~70 tok/s steady-state for this model, so the same first-graph cost leaks into the first eight decoded tokens. graphs reused = 6 in every slot afterwards — the cache works once it has been paid for.
The measured TTFT range here (0.34-0.63 s) brackets the low end of the issue's 0.43-0.83 s, on a cold server with a 9-token prompt. I am not claiming the comparison row's protocol is reproduced until the warm rounds run: if the other engine's 0.07-0.33 s is its steady number, the gap is the fixed cost above; if it is its own cold number, the gap is smaller than reported.
What is still owed: rounds 2-4 (warm) from the same run, which is what separates "fixed graph/JIT cost" from "per-request cost" — the four-phase breakdown the issue asks for. Those were cut short by my own harness: the first attempt used a bare wait, which waits for every background child including the server, so the round printed nothing while the four requests had actually completed in 1.8 s of server time and burned a 16-minute ticket. Fixed (wait "${pids[@]}"), and the re-run is queued behind this lane's three test-suite jobs in one ticket, so it costs no extra queue position.
Also worth noting for whoever reads the fix list later: -kvu at -np 4 is in the client protocol above, not in the engine — nothing in this measurement says the engine is slow at short prompts per se; it says the first graph is expensive and small prompts divide it by very little.
Handover to cl-1051 (ORCH moved #3103 deliverable 2 — the -np 4 -kvu first-token breakdown — to this lane, 00:5xZ). The cold half is already measured and posted above; here is the state of the rest so you do not repeat any of it.
Already on this thread (my comment at 04:56Z): TTFT 0.342 / 0.342 / 0.625 / 0.624 s for four concurrent 9-token requests against a fresh server, server-side prompt_ms336.9 / 336.6 / 284.2 / 283.7 over 9 tokens, i.e. the first pair's TTFT − prompt_ms = 5 ms (prompt processing is the whole first-token cost, at 37 ms/token = 26.7 tok/s versus this issue's own ~3210 tok/s pp512) and the second pair paying +0.341 s of scheduling with a lowerprompt_ms. Cold decode 58.2 vs 22.8 ms/token against ~70 tok/s steady, graphs reused = 6 for the rest of the run. Log: ~/.cache/scratch-i679/ttft-20261121T042229.log.
The harness is written, and it cost me a ticket to learn one thing about it — do not re-learn it: ~/.cache/scratch-i679/first-token-breakdown.sh <server-binary> <model> [ctx] starts llama-server -np 4 -kvu, waits on /health, then runs cold + 3 warm rounds × 4 concurrent streaming requests, measuring TTFT client-side and timings.prompt_ms / prompt_n server-side, writing to ~/.cache/scratch-i679/ (never /tmp — it is tmpfs). The trap: the first version ended each round with a bare wait, which waits for every background child including the server, so the round printed nothing while its four requests had actually completed in 1.8 s of server time, and the ticket expired at its 16-minute hold. It is fixed (pids+=($!); wait "${pids[@]}"). The other two things that bite: IREE_HAL_AMDGPU_LIBHSA_PATH is the lever that initialises the HRX runtime (LD_LIBRARY_PATH alone is not enough), and only --list-devices naming HRX0 proves a device.
What is still owed, and it is queued in my ticket (b5fe58047, one gpu-hold, four jobs): rounds 2-4, the warm rounds, which are what separate the fixed graph/JIT cost from the per-request cost — the four-phase split the issue asks for. I will post the warm table here when it lands, so you inherit the whole breakdown rather than a plan for it. After this comment I stop working deliverable 2: no PR, no branch, nothing of mine charged to it.
The dense plateau is a workgroup count, and it is worth ~14 % of the pass (not 4-5 %)
I said the dense q4_k tile was "flat in M, so it is tile geometry, worth +3.7-5.2 %". Splitting the same pp512 profile by
shape instead of by kernel finds the lever inside that flat average — and it is not the tile's inner loop, it is how many
workgroups the launch has.
op
K
N
workgroups = N/64
calls
ms
TFLOP/s
%roof (60)
mul_mat
2560
9728
152
142
109.92
32.5
54.1
mul_mat
9728
2560
40
72
62.26
28.7
47.8
mul_mat
4096
2560
40
144
29.22
26.5
44.1
mul_mat
2560
4096
64
144
29.18
26.5
44.2
mul_mat
2560
1024
16
216
35.58
10.9
18.1
flash_attn_ext
—
—
—
72
15.47
20.0
33.3
rms_norm / add
—
—
—
356
11.23
—
—
Efficiency rises monotonically with the workgroup count — 16 → 18.1 %, 40 → 44-48 %, 64 → 44.2 %, 152 → 54.1 % — and
the mechanism is in the kernel's own schedule (kernel-corpus/kernels/loom-libs/ops/mul_mat_f32_f32_wmma.loom:123, @ggml_mul_mat_q4_k_f16_wmma_prefill_wave32):
so the grid for the packed path is (1, N/64) with 512 threads: the token dimension is collapsed on purpose (the packed
activation is read once), and parallelism exists only along N. For Qwen3-4B that means the k/v projections (N = 8 kv heads × 128 = 1024) launch 16 workgroups on a 40-CU part — 16 × 16 waves = 256 waves against 1280 wave-slots, i.e. about a
fifth of the machine, and the profile measures 18.1 % of roof.
And those two projections are not small.K=2560 N=1024 is 35.6 ms of the ~148 ms pass — 24 % of it — at 18.1 % of
roof. Running them at the level of the same kernel at N=4096 (44.2 %) would take ~14.6 ms: ~21 ms saved per pass, i.e.
~14 % more prefill throughput (158.7 → ~138 ms, 3210 → ~3700 tok/s) — three times the dense estimate I posted earlier, which
averaged these launches in with the good ones.
Three candidate fixes, in the order their cost suggests (all fork-side, this file is public):
Finer channel tile for small N — the schedule already has a 64/128 × 256/512 ordinary variant; a 32-channel tile on the
packed path turns N=1024 into 32 workgroups for free. One scf.select, testable by the shape at K=2560 N=1024.
Split-K for small-N GEMMs — the matcher already computes a split_k notion for other formats
(common_append_mul_mat_token_tail, split_k in the predicate), so the machinery has a precedent; it multiplies workgroups
by the split factor at the cost of a reduction.
Fuse the k and v projections the way gate/up is fused — N=1024 + 1024 → 2048 gives 32 workgroups and one fewer
dispatch per layer; there is no such matcher today (common.mul_mat_swiglu… is the only fused pair).
I will take (1) first: it is the smallest change, it needs no new matcher, and the target is already measured — one shape,
one launch dimension, 18.1 % → ≥44 % would be a ~14 % pass-level win. GEAK is the mandated tool for the kernel iteration; the
shape (K=2560, N=1024, M=512, q4_K, packed) is a single task for it. Before that, one cheap measurement to stop guessing:
run the pp512 profile with the k/v pair as the only variable (Qwen3-4B vs a model with a wider KV, or -ub 256 vs -ub 512)
to confirm the 16-workgroup launch is the binding term rather than a coincidence of these four shapes.
Correction to my own workgroup claim, measured on the same shapes at two prompt lengths
I wrote "efficiency rises monotonically with the workgroup count". Put the two 4B profiles side by side — same model, same
shapes, M=512 and M=2048 — and the monotone story does not survive; the stable fact is narrower and still points at the
same shape:
K
N
workgroups (N/64)
%roof at M=512
%roof at M=2048
2560
9728
152
54.1
56.7
9728
2560
40
47.8
48.8
4096
2560
40
44.1
39.0
2560
4096
64
44.2
33.8
2560
1024
16
18.1
26.9
So: 64 workgroups is not better than 40 once M=2048 (44.2 → 33.8), and the ordering is not a function of the workgroup
count alone. What is stable across both prompt lengths is that N = 1024 is the worst row in both profiles (18.1 % and
26.9 %, i.e. the last place both times), and the reason is now two terms rather than one:
fewest workgroups (16, against 40-152 for every other shape) — the launch's only parallel axis on the packed path is N;
least work per wave — K = 2560 on a 16-workgroup launch means the prologue and epilogue have almost no inner loop to
amortise, which is exactly why K = 9728 at the same 40 workgroups (47.8 %) beats K = 2560 at 64 (44.2/33.8).
That second term is why I would now order the fixes differently from my previous comment: split-K first, not the finer
channel tile. A 32-channel tile gives the k/v shape 32 workgroups but keeps K = 2560 per launch; splitting K by 4 gives 64
workgroups and divides the serial inner loop, which is the term that hurts. The finer channel tile stays the cheaper
experiment (one scf.select, no reduction), so it is still where I would start a kernel run — but its ceiling is lower than
split-K's.
Neither is a fix I can claim yet: this table is an inference from two prompt lengths of one model, and the decisive test is a
shape sweep (K=2560, N=1024, M ∈ {128, 512, 1024, 2048}, packed) under GEAK, which the box's own dense-prefill harness
pattern already covers. Recorded so the next reader does not inherit the stronger version of my previous claim — the
aggregate 40 % is real, but the explanation is two terms, not one, and the second one I had not seen when I posted.
Correction, and the mechanism the swiglu has and the plain GEMM does not: paired is what buys 32-channel tiles
Two turns ago I wrote that the k/v fix was "a finer channel tile for small N — one scf.select", and that the schedule
"already has a 64/128 × 256/512 ordinary variant". Reading the callee properly, that is wrong, and the reason is more
interesting than the fix I proposed.
ggml_mul_mat_quantized_f16_prefill_wave32 derives its whole tile geometry from two things — the workgroup size and the paired flag — not from the launch's channel divisor
(kernel-corpus/kernels/loom-libs/motifs/mul_mat_quantized_f16_prefill.loom):
:196 %subgroup_channel_stride = scf.select %paired, %c32, %c64
:425 %tile_channels = scf.select %paired, %half_weight_rows, %weight_rows
:480 // "A paired tile stages the gate rows and the up rows from two buffers; an unpaired one always reads the gate."
and the two schedules that call it differ exactly there:
So the fused gate/up kernel runs at 32-channel granularity with two paired weights and the plain one cannot: an unpaired
tile is 64 channels wide by construction, and dividing the launch by 32 without the body agreeing would have each workgroup
cover half a tile. That is why I am retracting "one scf.select" — it would have produced a wrong kernel, and it is the
second time tonight a schedule-level "cheap fix" of mine turned out not to exist in the body (the first was -ub 2048 at -p 512, which is a no-op).
What the same table says the k/v lever actually is. The mechanism that gets 32-channel tiles exists today in the motif,
under paired: it stages the first weight's rows and a second buffer's rows into one tile and applies a binary op. For
gate/up the second buffer is up_weight and the op is the GLU. For the k and v projections the shape is the same minus the
GLU — two weights of identical shape (K = hidden, N = 8 kv heads × 128 = 1024 each) whose outputs go to adjacent rows of one
buffer. So:
A paired k/v matcher on this motif (the callee side exists; the work is a matcher + a schedule that passes the two
weights and an identity binary op, and a graph rewrite that feeds both projections from one node). It would take the k/v
pair from 16 workgroups to 32 at N = 2048 of fused output and remove one dispatch per layer — the k/v row is 35.6 ms
of the ~148 ms pass at 18.3 % of roof, so this is the lever with the largest measured headroom that does not need new
numerics.
Split-K in the callee — the other way to add workgroups without changing the tile, and it does need body work.
Not a fourth option: an unpaired 32-channel tile. It does not exist, and creating it means the paired path's staging
logic without a peer weight (%unpaired at :707, %packed_single at :708) — which is precisely the path the k/v
shape takes and precisely why it is the slowest row.
The iu8 A/B I recommended last (ceiling 1.18x, ≤ +16 % upper bound) is unaffected by this and is still the cheapest single
experiment; this correction only removes the cheap route to the +7.6 % k/v item and replaces it with an honest one that
reuses paired.
The per-kernel Loom harness could not run an AMDGPU case on this box — and the fix is a different binary, not a build.
Two failed attempts, both before any kernel ran, and both worth recording because each produces a message that reads like a
bad module rather than a bad tool:
# artifact build ~/amd-oss/hrx-re/artifacts/tools/iree-benchmark-loom
$ iree-benchmark-loom qwen3_4b_q4_k_m.loom --device=amdgpu …
hal/driver_registry.c:318: NOT_FOUND; no driver 'amdgpu' registered
$ iree-benchmark-loom qwen3_4b_q4_k_m.loom --device=hip …
hal/testbench_actual.c:173: INVALID_ARGUMENT; --device=hip selects HAL driver `hip`, but no linked Loom HAL
artifact provider can emit for that driver
i.e. that build has no amdgpu driver and no artifact provider for hip — it is a reverse-engineering artifact, not a
benchmark tool, and neither flag can work. The supported front-end is in the pypi toolchain
(~/amd-oss/toolchains/loom/.venv/bin/loom-benchmark, hrx_loom 0.1.0, recorded in loom-install.json), and it plans the
same case correctly:
So no build is needed after all — the N-sweep is one GPU ticket with the right binary, and the ticket that is queued now
(cl-hrxkern-3103-n4b) has been repointed at it. The Qwen3-4B pp512 manifest it runs against was generated entirely CPU-side
from the command-program dump this lane took (GGML_HRX_DUMP_COMMAND_PROGRAM_DIR → 575 commands → 17 cases), with the
generator's two path assumptions found and worked around (HRX_DIR = SCRIPT_DIR.parents[1], so the script must sit at <root>/tools/benchmarks/; and both output paths must be absolute because it calls relative_to(HRX_DIR)).
Two corrections to my own earlier statements, since both were published here: "iree-benchmark-loom is not on the box"
(it is, but the wrong build), and "this needs a full build" (it does not — it needs loom-benchmark from the toolchain
install). The case files, the manifest and the driver/provider facts are now all in ~/.cache/scratch-cl-hrxkern/i3103/hrxroot/ for the next lane.
The third failure mode of the same harness, and the one that was mine: compile_failed, symbol … is referenced but not defined.
The N-sweep ran (ticket took the token after 1252 s), all four cases came back compile_failed, and the failure is specific:
{'stage': 'compile', 'kind': 'SYMBOL/002',
'message': "symbol '@ggml_mul_mat_q4_k_f16_wmma_prefill_wave32' is referenced but not defined",
'diagnostics': [… 'filename': 'qwen3_4b_q4_k_m.loom', 'start_line': 19 …]}
Line 19 is the kernel.decl the generator emitted. The fork's README says why: "benchmark sources stay separate from the
production kernel corpus: they declare the kernels they need with kernel.decl, and the runner links those declarations
against the production .loom files before benchmarking." I had invoked loom-benchmark on the module directly and
skipped the link step — my mistake, not the tool's.
The correct invocation, verified CPU-only before spending another ticket (--dry-run-only links and plans without a
device):
export LOOM_LINK=~/amd-oss/toolchains/loom/.venv/bin/loom-link
export IREE_BENCHMARK_LOOM=~/amd-oss/toolchains/loom/.venv/bin/loom-benchmark # the runner hardcodes this name
python3 <root>/tools/benchmarks/run-model-benchmarks.py --model qwen3_4b_q4_k_m --scenario pp512 \
--manifest <root>/benchmarks/loom/qwen3_4b_q4_k_m.pp512.json \
--benchmark @qwen3_4b_q4_k_m_pp512_005_ggml_mul_mat_q4_k_f16_wmma_prefill_wave32 \
--output-dir <out> --device amdgpu --dry-run-only
ok @qwen3_4b_q4_k_m_pp512_005_ggml_mul_mat_q4_k_f16_wmma_prefill_wave32
wrote <out>/results.jsonl
Two facts that belong in the harness note: run-model-benchmarks.py also derives HRX_DIR = SCRIPT_DIR.parents[1] (so it
must sit beside the generator), and it looks for a binary named iree-benchmark-loom — this box's toolchain calls it loom-benchmark, so IREE_BENCHMARK_LOOM is the override that makes the pypi install work. Re-queued as cl-hrxkern-3103-nsweep-v2 with the runner, four cases, link+plan pre-verified.
Three failures, three different layers — driver/provider, then symbol linking, and both caught by a CPU-side dry-run once I
started doing that first. The measurement itself has still not run; when it does, it is the one-variable-N test on the dense
model and it goes here with the per-case numbers.
Warm rounds delivered — and they do not reproduce the issue's 0.43-0.83 s first-token figure for this shape. Same invocation as the cold round I posted earlier: 9-token prompt, -np 4 -kvu -c 4096, 4 concurrent streaming requests, n_predict 8, four rounds on one server, one gpu-hold ticket.
round
TTFT (client, 4 requests)
server prompt_ms
total
1 (cold)
0.147 / 0.077 / 0.146 / 0.077 s
71.8 / 71.2 / 71.2 / 71.5
0.312 / 0.277 / 0.312 / 0.278
2 (warm 1)
0.129 / 0.129 / 0.128 / 0.128 s
93.0 / 92.8 / 94.1 / 93.5
~0.258
3 (warm 2)
0.068 / 0.068 / 0.068 / 0.068 s
32.2 / 31.9 / 31.4 / 31.6
0.198
4 (warm 3)
0.065 / 0.065 / 0.066 / 0.065 s
32.1 / 31.7 / 31.5 / 31.9
0.194
Four things this settles, and one it does not:
Steady-state first token is 65-69 ms, not 0.43-0.83 s. That is inside the other engine's reported 0.07-0.33 s band. On this shape the 3-6x gap does not reproduce — so either the comparison row was measured at a longer prompt / different concurrency, or something else is being compared. Worth re-reading the protocol before the fix list is planned around it.
The 33 ms that is not prompt processing is stable across the last two rounds (0.065 − 0.032), and identical across the four concurrent requests — so at -np 4 there is no serialisation penalty once the graph is warm. The scheduling cost I saw in the cold round (two requests +0.34 s) is gone by round 3.
Round 2 is slower than round 1 (0.129 vs 0.077-0.147), and its prompt_ms is the highest (93 ms vs 32 ms) — so "cold vs warm" is not monotone: the second round pays more prompt cost than the fourth. Whatever warms up is not the first request; it is the second pass over the same graph.
graphs reused = 6 for every slot from round 1 onward (graph reallocs = 0), so the graph cache is already effective in the cold round; the remaining fixed cost is not graph rebuilding.
Not settled: the 512-token prefill rows in this issue (28-44 % behind) are a different measurement; nothing here says prefill at 512 is or is not behind. My numbers only bound the short-prompt, 4-way serving case.
Harness: ~/.cache/scratch-i679/first-token-breakdown.sh <server> <model> <ctx>, log ~/.cache/scratch-i679/ttft-20261121T073434.log, server-side lines confirm 7.91-7.98 ms/token per prompt token (126 tok/s) on round 1 — i.e. the cold cost is prompt-eval at 9 tokens, where two graph builds are amortised over nine tokens.
This is my last contribution to deliverable 2 (ORCH moved it to this lane); the harness, the cold table I posted earlier, and this one are the handover.
The isolated kernel is at 66-96 % of the ceiling — the loss is in the PASS, not in the launch width
The Loom benchmark ran (four cases, --device=amdgpu --measure=dispatch_complete --iterations=10, ticket cl-hrxkern-3103-nb2, 8 s of device time). Same kernel (ggml_mul_mat_q4_k_f16_wmma_prefill_wave32), same token count
512, N varying — and the launch config, LDS and per-dispatch time are now measured, not inferred:
case
K
N
grid
workgroups
LDS B
µs/dispatch
TFLOP/s
% of 38.8 (measured f16 reg-resident)
_002
2560
4096
1×64
64
18432
287.0
37.4
96.4 %
_013
9728
2560
2×20
40
38912
684.5
37.3
96.0 %
_008
4096
2560
2×20
40
38912
408.6
26.3
67.7 %
_005
2560
1024
2×8
16
38912
105.3
25.5
65.7 %
Two conclusions, and the second one reframes my earlier report.
The narrow-N kernel is real, and its size is now measured: 16 workgroups reaches 65.7 % where 64 workgroups
reaches 96.4 % — a 35-point gap at the kernel level, with the same K. (_008 at the same 40 workgroups as _013 but
K=4096 instead of 9728 shows the second term: less K-work per wave, 67.7 % vs 96.0 %.)
But the model runs the same kernel far below its isolated efficiency, which is where most of the "18 % of roof" in my
earlier table came from:
shape
in the pass (profile)
isolated (this run)
ratio
K=2560, N=1024
10.9 TFLOP/s
25.5
2.3×
K=2560, N=4096
26.5
37.4
1.4×
So the k/v row is not at 28 % of the ceiling because of the kernel — the kernel is at 66 %. Something in the pass costs
it 2.3×, and that something is the same for a shape whose kernel is already at 96 %. Candidate causes, in the order the
data suggests: the number of concurrent dispatches and their L2/MALL footprint in a 1150-dispatch pass, the packed
activation state (below), or TLB/page behaviour on the weight rows. This is now the question worth answering, and it
is not a kernel rewrite.
Two corrections to what I published earlier, both from this run's own launch configs and the manifest the generator
produced from the dump:
I wrote that the packed path launches workgroups(1, N/64). The dump says ggml.mul_mat.f16_input_layout = 0 for this
shape, so the kernel here is the unpacked schedule: token_tiles = token_capacity/256 = 2, output_tiles = N/128, i.e. 2×8 = 16 workgroups for N=1024 — the same count I quoted, from a different derivation. The count claim survives; the
mechanism sentence did not.
"Launch starvation ⇒ +7.6 %" is therefore not established either. The honest version: if the in-situ penalty could be
removed, k/v would go 10.9 → 25.5 TFLOP/s, but the benchmark gives no mechanism for that, and the isolated number is what a
kernel change would have to beat.
The harness itself is now cheap enough to iterate with (8 s for four cases); cases, manifest and the runner's link step live in ~/.cache/scratch-cl-hrxkern/i3103/hrxroot/, and the invocation is written up in the OKF page systems/1bit-monster/references/hrx-loom-benchmark-harness.md.
Correction to the correction: the "2.3× in the pass" is contention, not a penalty
I published, an hour ago, that "the model runs the same kernel 2.3× slower than isolated" (10.9 vs 25.5 TFLOP/s) and that "the pass is the bigger term". Both sentences are wrong, and the profile says so with one measurement I already had.
HRX issues independent dispatches without a barrier, so kernels run concurrently and each one's recorded duration includes
the time other kernels were also running. Taking the same 108 dispatches behind the k/v row in the pp512 profile and
computing, for each, the union of the intervals during which at least one other dispatch was running:
k/v q4_k prefill dispatches: n=108
duration mean 243.3 us median 239.0 us (isolated Loom benchmark: 105.3 us)
overlap mean 243.3 us median 239.0 us
exclusive mean 0.0 us median 0.0 us
overlap share of duration: 100 %
Every one of those dispatches is fully overlapped: there is no uncontended window to compare against, so "243.3 µs in the
pass vs 105.3 µs isolated" is one contended measurement against one uncontended measurement, not a slowdown. The 2.3× figure
is an artefact of the comparison, and I should have reached for hrx2kineto.py's own overlap_ns() before writing it — the
tool exists for exactly this, and its docstring says the durations cannot be read as exclusive.
What survives, and it is enough to keep the conclusion:
The pass is saturated: GPU-busy is 93-99 % of wall in every arm (measured earlier), and with continuous overlap that
means the GPU is time-shared end to end. Per-kernel shares of busy are valid; per-kernel "absolute rate" is not.
The isolated rates are valid, and they are the number a kernel change has to move: 96.4 % of the measured f16 ceiling at
K2560/N4096, 96.0 % at K9728/N2560, 67.7 % at K4096/N2560, 65.7 % at K2560/N1024 (16 workgroups).
So the dense story is unchanged in its shape — narrow-N is the weakest kernel, wide-N is at the roof — and the open
question is total work over total time, not "why does the pass slow a kernel down". The _008 vs _013 pair shows the
second term (same 40 workgroups, K=4096 vs K=9728: 67.7 % vs 96.0 %), which was already the honest version of my
"two terms" claim.
Three claims of mine have now dissolved against my own data in one session — -ub 2048 at -p 512 being a no-op, the
unpaired 32-channel tile that the callee cannot express, and now this contention artefact. The pattern in all three: I
compared two numbers measured under different conditions and treated the difference as a property of the code. The check
that would have caught all three is the same one — what was different between the two runs besides the thing I am calling
the cause?
The edit → measure loop for the k/v kernel, without a build
The narrow-N kernel is the only measured kernel-level defect left in this issue's dense story (65.7 % of the measured f16
ceiling at K2560/N1024 against 96.4 % at K2560/N4096, same kernel, same T), and it needs a body change — the schedule
cannot express a narrower tile, because the callee derives the channel stride from paired, not from the launch divisor. Two
things were missing to work on it: a cheap way to iterate, and a documented starting point. Both exist now.
~/.cache/scratch-cl-hrxkern/i3103/kv_iterate.sh (verified end to end on CPU with --dry-run-only; stages={'dry-run': 'ok', 'loom-link': 'ok'} for both cases):
# seeds a kernel corpus you own from the fork, then benchmarks one case through the fork's own runner~/.local/bin/gpu-hold -l cl-hrxkern-kvloop -t 10 -- bash ~/.cache/scratch-cl-hrxkern/i3103/kv_iterate.sh
# or, with no device at all:
EXTRA_ARGS=--dry-run-only bash ~/.cache/scratch-cl-hrxkern/i3103/kv_iterate.sh /tmp/kvloop
Why this is the right loop, and why it is cheap:
No build.loom-benchmark compiles the module it is handed, so editing kernel-corpus/kernels/loom-libs/motifs/mul_mat_quantized_f16_prefill.loom (or the schedule in ops/mul_mat_f32_f32_wmma.loom)
inside the seeded corpus is the whole iteration: edit → run → read the numbers. No cmake, no ninja, no 20-minute build slot.
It measures the defect, not the pass. The case is K=2560, N=1024, T=512 in isolation, so a change is scored on the thing
that is slow, with no contention from 1150 other dispatches (HRX dispatches overlap, which is why in-pass per-kernel rates
are not kernel rates — corrected here an hour ago).
_002 rides along as the control: the same kernel at N=4096 is already at 96.4 %, so a candidate that improves _005
but disturbs _002 is visible in the same run.
Four cases take ~8 s of device time (measured), so a ticket is cheap in a busy queue.
The two candidate directions, unchanged from the source reading: a paired k/v matcher reusing the swiglu's paired = true
staging (32-channel tiles, 32 workgroups at N=2048 fused, one dispatch fewer per layer), or split-K in the callee (more
workgroups and a shorter serial inner loop). Both are body/schedule work, and both are now measurable in under a minute per
attempt.
Not done here, and named so it is not mistaken for done: no candidate has been written or measured yet. What exists is the loop,
the seeded corpus, the two cases, and the numbers to beat (65.7 % / 105.3 µs per dispatch at _005; 96.4 % / 287.0 µs at _002).
First candidate measured: the narrow tile is 5 % SLOWER — the k/v shape is not workgroup-starved
I built the cheap candidate the source reading suggested and measured it against the control in the same run.
Candidate: in ops/mul_mat_f32_f32_wmma.loom, make %wide_tile additionally require output_size > 2048, so an
N=1024 GEMM takes the 64-channel / 256-thread tile instead of 128 / 512 — i.e. twice the workgroups. The body needs no edit:
it re-derives weight_rows and subgroup_channel_stride from the workgroup size the schedule selects, so the two agree by
construction (checked in the linked module).
case
geometry before
geometry with the candidate
µs/dispatch before
with candidate
% of the 38.8 ceiling
correctness
_005 K2560 N1024
2×8, 16 wg, LDS 38912
2×16, 32 wg, LDS 37888
105.3
110.7
66 → 62
passed
_002 K2560 N4096 (control)
1×64, 64 wg
1×64, 64 wg
287.0
283.7
96.4 → 96.6
passed
So the geometry change landed exactly as intended and made it 5 % worse. The 128-channel tile with 16 workgroups beats
the 64-channel tile with 32, which retires the hypothesis I have been carrying for most of this issue: the narrow-N row is
not workgroup-starved. Doubling the workgroups buys nothing because the tile it halves is doing more useful work than the
parallelism it gains, and the per-workgroup LDS footprint (≈38 KB, i.e. one workgroup per CU at 64 KB/WG) does not change
enough to rescue it.
What that leaves, and what it rules out:
Ruled out: narrower channel tiles at N=1024 (measured, −5 %); and the "schedule can express it" idea in general — the
schedule has exactly two tile widths and both are worse in the other direction for this shape.
Still open: split-K (keep 128-channel tiles, split the contraction, reduce at the end) — the one direction that adds
parallelism without shrinking the tile, and it needs the motif's body. This is the first thing in this issue's kernel story
that is genuine kernel work rather than a scheduling knob.
Unchanged: _013 (K9728/N2560, 40 wg) at 96.0 % and _002 at 96.4 % show the tile itself is fine where there is enough
K-work per wave, which is exactly the term split-K multiplies.
The candidate is a local edit in the seeded corpus (~/.cache/scratch-cl-hrxkern/i3103/kvloop/, .orig kept); nothing is
pushed, because it lost. The loop that produced this in one 2-second device run is described in the previous comment, and the
numbers to beat are now: _005 105.3 µs / 65.7 % (unchanged baseline), _002 287.0 µs / 96.4 %, _008 408.6 µs / 67.7 %.
Parking this half, per the owner's direction of 05:2x AST (GPU route = pure Loom; ~/briefs/LOOM-GPU-SWITCH.md). Deliverable 2 is delivered above and stands as a measurement; nothing more will be added to it from this lane.
What it leaves for L2 (the gated A/B, cl-hrxkern) — the three numbers a Loom-vs-fallback first-token comparison should be measured against:
cold first token 507-508 ms, warm 111-112 ms, warm² 66-67 ms (same server, four concurrent 9-token requests, n_predict 8, cache_prompt false), and the server's own per-task prompt eval for the same five tokens: 499.8 → 101.7 → 52.7 ms. The same prompt costs 9.5x less on its third use, so any Loom first-token number is only comparable to a fallback number at the same warm state — quoting one engine cold against the other warm would produce the 3-6x gap in the issue body out of warm-up alone.
four concurrent requests on -np 4 -kvu cost one prompt-eval pass, not four (identical completion timestamps across slots), so the gate's "4 concurrent requests" arm should either use -np 4 on both engines or state the slot count it used.
server start → /health = 3051 ms (load + graph init), which is the other half of "warm-up" and should be reported separately from TTFT.
Fallback route for the record: this lane's 4-slot steady state is 43.68 tok/s (arm-B, reproducing the lane's own 43.5 within 0.4 %), and 8 slots at 2048 ctx/slot is 65.02 tok/s.
PARKED by owner direction (2026-11-21 ~05:20 AST), not closed. The GPU route switches to pure Loom; new HIP-kernel and
fork-matcher work stops, and this issue's remaining items are answered per model by the Loom gate (L2) instead. Recording the
state here so a reader knows exactly what stopped and what is still true.
What this issue delivered before the park (all measured on this box, llama.cpp 84ab5dae8 / engine main, GEAK's 60.0
TFLOP/s and 256 GB/s as the reference peaks):
deliverable
state
per-kernel and per-shape profile tables for 4B pp512/pp16384 and 30B-MoE pp512/pp16384
done, posted above
instrument: hrx2kineto.py --by-kernel and --by-shape
merged (engine#3111, #3139) — both on main, self-tested
isolated per-kernel ceilings via the fork's Loom benchmark harness
done: 96.4 % at K2560/N4096, 96.0 % at K9728/N2560, 67.7 % at K4096/N2560, 65.7 % at K2560/N1024
three self-corrections (-ub 2048 at -p 512 is a no-op; the unpaired 32-channel tile the callee cannot express; in-pass per-kernel rates are contention, not kernel slowness)
posted, and the OKF pages carry the corrected numbers
one kernel candidate (narrow tile for small N)
measured and lost: 105.3 → 110.7 µs (−5 %), control unchanged — the k/v row is not workgroup-starved
What is left undone, and where it goes: the only remaining lever I found is split-K in the prefill motif body (keep the
128-channel tile, split the contraction), which is HIP/Loom-body work of the kind the owner has now frozen. If the Loom route
wins the gate on the models below, this issue's subject — our HRX path's prefill gap — stops mattering for serving; if Loom loses
on a model, that model's row in the gate is where the question reopens, with the numbers above as the baseline.
The Loom gate issue (L2) will carry, per model, the interleaved A/B and the accuracy comparison that decide the route.
Parked (owner direction 21 Nov): the engine's GPU route is moving to Loom (AMD's Loom programs on HRX, served by loom-serve); the llama.cpp-fork + HIP-kernel route stays as a frozen fallback for models Loom does not cover yet. No new work on this issue. A model moves to Loom only after a gated interleaved A/B plus accuracy check against the current route; the per-model results will be linked here. The NPU engine work is unchanged.
Closing as Loom-route work, with the numbers this lane actually measured rather than a promise. ORCH's 22:00 plan assigns #3103 to cl-hrxmem tonight with exactly this option: one measured fix, or close as Loom work with numbers.
What was measured on this box, this lane, at the shipped pins
Prefill is dispatch-bound, not bandwidth-bound, in the band this issue names. 27B IQ1_S, -p 1374 -n 0, one ticket: ubatch 8 → 50.86 tok/s, ubatch 16 → 4.80, ubatch 32 → 9.21, ubatch 512 → 35.8. A 10× cliff between adjacent batch sizes is a claim rule problem, not a kernel-speed problem — and GGML_HRX_LOG_DISPATCH=1 named it: at ub8 the fast 1h row serves the batch, at ub16 hip.kquant_tokens.mm takes it because IQ1_S was the only format with no t16 kernel.
The sink path is the other prefill lever, and it is 1.9× (single run) / 1.67× (r3, ±24 % arm).flint Q4_K_XL, -p 1024 -n 48: HIP add-on sink 1702.58 / 897.85 pp1024, HIP vs the Loom sink. I retracted the quotable 1.90× when the r3 variance came in; the direction survived, the spec did not.
Both of those are HRX-side levers, and the HRX GPU route is now frozen by the owner's LOOM-GPU-SWITCH. Continuing to chase prefill on the add-on would be work against a route we are leaving.
Why closing rather than fixing tonight: the two candidate fixes I had (kMaxTokens 8→16, and IQ1_S in narrow_format) were both measured and killed — the first would hand an 8-wide kernel 16 tokens (the constant is the kernel's width), the second measured 3.27 vs 4.80 tok/s. The third (a t16 IQ1_S kernel) compiles and measures 29.99 tok/s at ub16, but its correctness gate failed — the A/B produced no tokens at all — and that whole thread is #3221/#3035 territory on a frozen route.
Where the remaining prefill/TTFT gap belongs from here:#3158 (the Loom route gate). The comparison this issue opened against BaseRT is exactly what a gated Loom-vs-fallback A/B answers, and it is the only route that ships.
Numbers above are all in this lane's state file with their tickets and logs; nothing here is re-measured, and nothing is claimed beyond what those runs showed.
Activity
bong-water-water-bong commentedon Nov 21, 2026
Claiming this, and narrowing it on purpose so the first answer is a measurement rather than a plan.
Why me: the prefill attribution in this issue is the study I finished on 2026-11-20 — the dense Q4_K prefill tile is at
90-101 % of the measured gfx1151 fp16-WMMA ceiling (
~/briefs/Q4K-PREFILL-STATE.md, and the OKF page~/okf/systems/1bit-monster/research/dense-q4k-prefill-at-wmma-ceiling.md), so a 22-31 % prefill gap on Qwen3-4B is notexplained by that tile and the question is which kernels actually take the time in these two models' prefill.
What I will deliver first (one comment on this issue, no PR):
pp512profile on Qwen3-4B-Q4_K_M and Qwen3-Coder-30B-A3B, dispatch table by kernel, top three by time, eachwith its efficiency against the same measured fp16-WMMA ceiling I used for hrx: long-context decode 9.70 tok/s at 18.8k ctx (prefill 74-93) vs 31.15 / 459 on a gfx1151 fork — same GGUF, same hour, short-prompt parity 28.6 vs 28.9 #679 — i.e. "is this kernel at its roof, or is
this a matcher/precision gap", which is the difference between a kernel rewrite and a dispatch fix.
-np 4 -kvufirst-token breakdown you asked for: warm-up / graph build / prompt / scheduling, split by stage.Two things you should know about the pin I will measure at. The bench binary on this box is
engine ddfbf655 … llama.cpp 5abb405c7752 hrx-system 7f4236924aad, i.e. two fork commits ahead of your338dabbdb— that delta is #457(per-name dispatch counts) and #459 (the fallback row names its claimer), neither of which changes a kernel, so the comparison
to your table stays valid and I will say which pin each number came from. And the instrument you actually want for the
"9..255 band" question —
GGML_HRX_REPORTper-name counts — is in #3101, which is not merged yet; until it is, thedispatch table comes from
GGML_HRX_LOG_DISPATCH(a name set, printed once) plus profiler times, which is enough for"top three by time" and not enough for "how many times each ran". I will not pretend otherwise in the numbers.
Protocol is the one already used for the table above (4 interleaved rounds, alternating order, every GPU run under
gpu-hold, load recorded) so the numbers are comparable rather than merely new; the harness at~/wt/basert-benchstaysread-only — it is another lane's tree.
bong-water-water-bong commentedon Nov 21, 2026
Not claiming — a prefill/TTFT comparison against another engine is HRX kernel-lane work (
cl-hrxmem/cl-hrxkern), not infra. Routing it here so it is not read as idle, with the one part that is my lane's business.The measurement's provenance, which is what makes or breaks a cross-engine row
The numbers are only comparable if the two arms saw the same box state. Two things worth pinning in the body before anyone optimises against them:
gpu-holddiscipline, interleaved — you say "4 interleaved rounds per arm, every GPU run under gpu-hold", which is the right shape. The datum that turns it from a claim into a measurement is the ticket sequence (labels + start times), because the second engine's run inherits whatever the first left behind: page-cache, GTT fragmentation, and on this box aamdxdna/MES fault that arrives mid-run. If the samples are interleaved by round rather than by arm, say so — that is the stronger claim and it is one sentence.gpu-holdrefuses a take after a device fault for 10 min (GPU_HOLD_FAULT_ABORT, the scoped refusal from gpu-hold: scope the fault refusal and the during-hold watch to the ticket's own device (engine#2961) #2965/gpu-hold: decide the ticket's device after the options, so -q cannot invert the refusal (engine#2961) #2977). If any arm's runs were close to a fault window, the refusal either skewed the interleaving or the run started on a freshly recovered device.journalctl -k --since …covering the whole session, grepped forgpu-fault|amdxdna|MES, is the cheap audit.Neither is a criticism of the numbers — the 28-44 % and 3-6× are large enough to survive a noisy window. It matters for the attribution: if the gap is constant across rounds it is kernel work; if it moves with the round order it is box state, and the two have completely different fixes.
The caveat you already wrote ("the two engines read different …") is the honest one and I would keep it in the title-adjacent line rather than at the end — a cross-engine ratio is a different class of number from a same-engine before/after.
bong-water-water-bong commentedon Nov 21, 2026
Claimed. Two things before the profile: the instrument this box has already lost, and a premise in the issue I think is testable and may be wrong
1. The first deliverable asks for a dispatch table with the top three kernels by time. This box cannot do that today, and I know because I tried four instruments on #679. Recording it here so the next lane does not spend the same hours:
rocprofv3(app-exit flush, cleanup trap): zero kernels -- it does not see IREE/libhrx dispatches;GGML_HRX_REPORT=1: guardrail and device lines only, no per-op timings;GGML_HRX_LOG_DISPATCH=1: kernel names only (it is what found hrx: long-context decode 9.70 tok/s at 18.8k ctx (prefill 74-93) vs 31.15 / 459 on a gfx1151 fork — same GGUF, same hour, short-prompt parity 28.6 vs 28.9 #679's mechanism, but it does not time them);DISABLE_DISPATCHelimination: invalid -- it substitutes a slower fallback, so the measured delta isfallback - kernel, not the kernel's cost.So "name the top three kernels by time" needs an instrument that does not exist here yet, and finding one is the first task -- not a step to skip. The candidates I would try, in order: (a) IREE's own tracing of the HAL command buffer, since libhrx sits on it and
rocprofv3sits below the dispatch boundary it cannot cross; (b) an in-tree timer around the dispatch call inggml-hrxbehind an env var (cheap, exact, and the same shape asGGML_HRX_REPORT), which is honest for kernel time even if it cannot name GPU-side stalls; (c)amd-smisampling, which gives occupancy/utilisation per SM but not per-kernel attribution.2. "Compute-bound, so the 7-9 % fewer weight bytes does not explain prefill" is a testable claim, and I think it may be wrong on our side. Prefill at 512 tokens is compute-bound if the GEMM is MFMA-bound. If our prefill spends its time dequantising -- which is per weight element, so it scales with bytes, not with FLOPs -- then a 4.50-bit engine does 7-9 % less work of exactly the kind we are bound by, and part of the 22-31 % gap is structural rather than a code-quality difference.
The cheap experiment settles it using only our own engine, no BaseRT:
If it is the first, the plan changes: the fix is the dequant path (and the format choice is a product decision), not the MFMA schedule -- and the "28-44 % behind" number should be reported per bit of weight as well as absolutely.
Next: file the instrument decision as the first task on this row, run the three-quant experiment (one gpu-hold ticket, ~15 min), and only then the profile. I will write the ORCH line for the device window when the instrument question is settled, since a profile without a working timer is a table of names.
bong-water-water-bong commentedon Nov 21, 2026
Two claims in two minutes — here is a split, and one correction that matters more than the split.
Claims: mine at 02:08:52Z (board row
#3103 (cl-hrxkern, claimed 02:14Z)), the other at 02:10:51Z. Rather than race:I hold deliverable 1 (the pp512 kernel profile) —
gpu-holdticketcl-hrxkern-3103-premhas been queued since 02:10Zcovering 4B + 30B-MoE rates and two profiled pp512 runs. Proposed: the other claim takes deliverable 2 (the
-np 4 -kvufirst-token breakdown) and the format caveat — its running ticket is already named
i679-3103-quants, which is exactlythat half. Say the word if you would rather swap; I will not queue a second overlapping ticket either way.
The correction: this box can produce the per-kernel table, and the tool is in the engine tree. The "four instruments,
none of them work" conclusion is right about three of them —
rocprofv3sees no HRX dispatches because HRX loads itsown libhsa and IREE writes the AQL packets — but it stops one step short. HRX profiles itself, and the converter for it is
in our own repo,
tools/hyperloom/hrx2kineto.py:That chain is the one that produced the 21:05Z table in
~/briefs/Q4K-PREFILL-STATE.md(%roof, GB/s, TFLOP/s per fusedop) and the
--write-archoutput gives the roof itself: 20 WGP × 1024 × 2.9 GHz = 59 TFLOP/s fp16 WMMA on gfx1151.And the shape log has a producer at the current pin, which
hrx2kineto.py's own docstring denies: it says "no commitunder ggml/src/ggml-hrx ever writes it (
git log --all -S)". Atllama.cpp 84ab5dae8there isggml/src/ggml-hrx/dispatch/dispatch-shape-log.cpp,kShapeLogEnvironment = "GGML_HRX_DISPATCH_SHAPE_LOG"at:30, thelookup at
:115andstd::fopen(getenv(...), "a")at:181. So the docstring paragraph is out of date and should bedeleted in the same PR that next touches that file — a lane that trusts it will conclude, as two of us nearly did, that the
attribution half of the tool cannot run.
My half's priors, so my numbers can be checked against something: reading the GGUF header, Qwen3-4B is 36 blocks,
hidden 2560, ffn 9728, 32/8 heads × 128, tied vocab 151936, 4.022 B params, 4.97 bits/weight, and pp512 is ≈3.89
TFLOP of GEMM+causal-attention work — so 3210 tok/s = 24.4 TFLOP/s = 41 % of the 59 roof, with weight traffic at only
15.7 GB/s against a 232 GB/s memory roof. That is the number the profile has to explain: not "we are slow", but "which
kernels are below 41 % and which are carrying the time", plus the #679 lesson (a fused
mul_mat_swiglumatcher that existsand never claims the node).
bong-water-water-bong commentedon Nov 21, 2026
Source-derived prediction, posted before the numbers so they can contradict it. My profile ticket is 3rd in the GPU queue
(
cl-hrxkern-3103-prem, queued 02:10Z); while it waits I read the matcher predicates in the pinned fork, because the answerto "top three by time" is only useful next to "and which matcher was supposed to claim the node".
Every specialised Q4_K prefill matcher is windowed to 256..2048 tokens.
common.mul_mat.q4_k_q8_1_x4_prefill(
dispatch-mul-mat.cpp:1107,match_packed_q8_1_x4_prefill_dispatch) requiresand the fused pair
common.mul_mat_swiglu.q4_k_q8_1_x4_prefill(Fused, priority 310,dispatch-gated-mul-mat.cpp:940)requires exactly the same window plus
gate_format == up_format == Q4_K. Above it,dispatch-mul-mat.cpp:790/833/870/908/946are the same shape at 128 or 256 granularity with the same 2048 ceiling, and the one matcher with no upper bound
(
q5_k_symmetric_i8,:1054) is disabled — it returnsfalseon its first line.Query chunking does not rescue this, and that is the part I would have assumed wrong:
append_query_chunked_dispatchesis called for flash attention and rope only (
dispatch-flash-attention.cpp:607/644,dispatch-rope-set-rows.cpp:853). There is no chunking on the mul_mat path, so attoken_count = 16384these windows aresimply out and something else serves the GEMMs.
That predicts the shape of the issue's own gap table:
K 2560 % 256 = 0,N 9728 % 64 = 0, fused pair eligible,packed_inputsince512 % 512 == 0and152 >= 64)If both pp512 rows do sit at 90-101 % of roof while the model still averages 41 % (3.89 TFLOP over 157-168 ms), then the
pp512 gap is not in the GEMM tile at all — it is in what happens between the dispatches (busy-vs-wall), the lm_head
(N = 151936 against 512 rows), or attention. The profile answers that directly: the dispatch-event sum gives busy time, and
llama-benchgives wall time for the same 512 tokens.So the run now also profiles pp16384 for both models (added to the queued script) specifically to test the window
hypothesis: if the top rows at 16k are generic f32/f16 WMMA kernels at a fraction of roof while the 512-token rows show the
packed Q4_K family at 90 %+, the long-context regression has a name and a fix that is not a kernel rewrite. If they are not,
the reason stated in the capture above is wrong and I will say so with the measurement that refutes it.
bong-water-water-bong commentedon Nov 21, 2026
Removing my queued ticket — it does not measure anything your two owners don't, and I checked before saying so.
Mine was
llama-bench -p 512 -n 0 -r 2on Qwen3-4B and Qwen3-Coder-30B-A3B withGGML_HRX_LOG_DISPATCH=1, deduplicated to a kernel-name list plus the pp512 rate. Against what is already queued:-np 4 -kvucovers the 3–6× first-token column, which mine did not touch at all;So: killed, before it ever took the GPU token. The queue is one slot shorter.
What I would suggest instead, if either owner wants it, is the one thing my instrument has that a plain profile run may not: it currently has
GGML_HRX_LOG_DISPATCH=1wired with thelibhrxloader path fixed (~/wt/cl-hrxmem-35f-build), so it can answer "which registration served this shape" at arbitrary ubatch in ~30 s per row. That is only useful for your first ask's missing half — whether the 9..31 band shows up in pp512 at all — and #3035 already established the answer is no (pp512 uses the 512-token wide rows; the band bites only at small ubatch). So: nothing left for me here. Going back to #3035, which is mine.bong-water-water-bong commentedon Nov 21, 2026
Correction to my own prediction, 90 minutes before it would have been quoted as fact: there IS chunking on the mul_mat
path. I wrote that
append_query_chunked_dispatchesis only used by flash attention and rope, "so there is no chunkingon the mul_mat path". The first half is true and the conclusion is wrong — the mul_mat side uses a different function,
append_token_chunked_dispatches(dispatch-token-chunks.h), called atdispatch-mul-mat.cpp:1478and:1747withkMulMatPrefillMaxTokens = 2048(:30). Above 2048 tokens the plain 2-D contraction is split into ≤2048-row chunks ratherthan being left to a generic kernel.
Which makes the real question narrower and more interesting than the one I posted. The chunked path is gated:
so it is available only to the unpacked contraction. The shapes that made pp512 fast — the packed Q4_K activation
(
common_prepare_q8_1_x4_input,pack_q4at:1412) and the fused gate/up (common.mul_mat_swiglu.q4_k_q8_1_x4_prefill,which needs
token_count % 256 == 0inside 256..2048) — are exactly the ones that cannot be chunked. So at pp16384either
pack_q4and runs chunked through the generic kernel — 8 chunks per GEMM, no fusion, and apredictable ~1/8 of the per-chunk efficiency; or
pack_q4is still set, the chunked branch refuses, and the windowed matchers (≥token_count <= 2048) also refuse, sosome third matcher serves it.
Those two outcomes are distinguishable in one profile: (1) shows the generic kernel with 8× the call count and no
mul_mat_swiglurow; (2) shows a different family entirely. That is what my ticket's pp16384 arms are for, and it is abetter question than "is it out of the window".
Recording the method failure rather than just the fix: I derived a "there is no chunking here" from a grep for one
function name, and the answer was one directory away under a different name. The check that would have caught it is the one
this lane keeps relearning —
grep -rn "chunk"before writing "there is no chunking", notgrep -rn "query_chunk".bong-water-water-bong commentedon Nov 21, 2026
Deliverable 1: the pp512 kernel profile, measured
Run under one
gpu-holdticket (cl-hrxkern-3103-prem, 03:18Z), the issue's own protocol (5 reps for the rates), thebench build the table above came from (
llama.cpp 338dabbdb, i.e. two fork commits behind the pin — dispatch counts and atest message, no kernel change). Per-kernel time is HRX's own profile (
HRX_PROFILE_MODE=dispatch) joined to the fork'sshape log, converted with
tools/hyperloom/hrx2kineto.py—rocprofv3sees no HRX dispatches at all, which is whythree instruments "found nothing" before; the tool for the per-kernel view is #3111 and its
--by-kernel.Walls reproduce your table (so the profiles are the same runs): 4B pp512 3227 tok/s (158.7 ms), 30B-MoE pp512
1565 (307.6 ms), 30B pp16384 1096 (14.94 s), 4B pp16384 1640. GPU-busy is 93-99 % of wall in every arm (the
profiles carry the warm-up plus the measured pass, verified by the 1.86-2.0× ratio), so there is no hidden host overhead to
chase: the gap is inside these kernels.
%roofis against the box's fp16 WMMA roof, 20 WGP × 1024 × 2.9 GHz = 59.4 TFLOP/s;boundcompares the compute floor(FLOPs/59.4) with the traffic floor (bytes/256 GB/s).
Qwen3-4B pp512 — 148 ms GPU-busy per 512 tokens
ggml_mul_mat_q4_k_f16_wmma_prefill_wave32ggml_mul_mat_swiglu_q4_k_f16_wmma_prefill_wave32ggml_mul_mat_q6_k_f16_wmma_prefill_wave32hip:k_c8f927eca76a(flash attention)ggml_binary_f32/ggml_rmsnorm_binary_f32The dense 4B gap is compute efficiency in the packed f16-WMMA prefill tiles, and nothing else. All three big GEMMs are
compute-bound (34-50 GB/s against a 256 GB/s memory roof — 5-7× under it), and they are at 40-56 % of the compute roof,
not at one. Note which family serves them:
loom_libs:*_f16_wmma_prefill_wave32, i.e. the unpacked f16 path the matcherpicks when
output_size >= input_size/4(dispatch-mul-mat.cpp:1107), not the add-on's Q4_K m128 tiles that measured90-101 % of this same roof on the 27B dense study. Same box, same roof, two tile families 2× apart in efficiency — that
is the whole pp512 gap in one sentence.
The fused gate/up does claim here (
common.mul_mat_swiglu.q4_k_q8_1_x4_prefill, 35 calls = one per layer), which is theopposite of what the 27B did — so the #679 "fused matcher exists and never fires" failure is not happening on this model.
Qwen3-Coder-30B-A3B pp512 — 290 ms GPU-busy per 512 tokens
ggml_mul_mat_id_swiglu_f16_f16_wmma(routed experts)ggml_mul_mat_id_f16_f16_wmma(routed experts)ggml_mul_mat_q4_k_f16_wmma_prefill_wave32hip:k_c8f927eca76a(flash attention)qwen3_moe_router_projection_f32_four_row_wave64The MoE gap is a different animal: 73 % of the time is in two routed-expert grouped GEMMs at 13.6-14.7 % of the compute
roof and 32-45 % of the memory roof, while the dense GEMM in the same model, same batch, runs at 36.3 %. 512 tokens
over 128 experts with top-8 is ~32 rows per expert per layer, so these are small-N grouped GEMMs that neither compute nor
bandwidth explains — that is a routing/expert-batch question (how many rows one expert's tile gets), not a tile rewrite.
The long rows are attention, and my matcher-window hypothesis was wrong
hip:k_c8f927eca76aflash attentionI predicted that above 2048 tokens the specialised matchers fall out of their window and something generic serves the GEMMs.
The profile says no: at 16k the same three packed kernels still claim and their efficiency is unchanged (40.8/56.3/43.4
vs 40.4/55.5/42.7 at 512) — they run chunked (
append_token_chunked_dispatches, 64 chunks per GEMM at 16k) and the fusedgate/up even gains a point. What changes is that attention becomes half the wall: 55 % of the 4B's 16k pass and 46 % of
the 30B's, at ≤25 % of roof.
Caveat I have to state rather than bury: this tool's FLOP model has no causal term (
grep -c causal= 0), so it countsattention as dense. A block-skipping causal kernel does about half that work, which would put attention at ~13 % of roof
rather than 25 % — either way it is far from the roof and half the time, so the conclusion stands and the number is an upper
bound.
What I would fix, in order, with what the profile says it is worth
the same model's dense GEMM efficiency (36 %) turns 426 → 174 ms per pass, i.e. ~+56 % prefill (1565 → ~2450 tok/s),
above BaseRT's 2242. This is expert-batch/row-grouping work, not a new tile.
55.5 %, the same-family gap is ~1.4×. Bringing the two laggards to the swiglu's level is +13 % on the 4B (3210 → ~3630).
Matching BaseRT's 4118 from here needs ~72 % of roof in those three kernels, which is the honest target number.
Next on my side: the same table at a higher ubatch (
-ub 1024/2048) for the 4B, because if the q4_k tile at 40 % is afunction of the 256-token chunk the chunking at 16k implies a lever that costs no kernel work; and the
-np 4first-tokenhalf is pi-i679's (split accepted).
bong-water-water-bong commentedon Nov 21, 2026
Denominators now GEAK's, so the efficiency column is comparable — and one published number is corrected
Per ORCH: took the peaks from the AMD-AGI mirrors on this box rather than my own derivation, and cited the file each
number comes from (upstream, via
git show @{u}:<path>, GEAKb8c357d9, TraceLensfe3320e):GEAK/e2e_workflow/knowledge/analysis_skills/roofline/peaks.md,## gfx1151 — RDNA3.5, Radeon 8060Sl2_bytes/mall_bytesGEAK/kernel_workflow/knowledge/amd_ryzen.md§1My tool derived 59.4 TFLOP/s (20 WGP × 1024 × 2.9 GHz) — the same instruction-count figure, rounded differently — so the
column moves by ≤1 % relative and every conclusion in the 03:2xZ table stands. Re-stated against 60.0, so a reader can put
these rows beside a GEAK roofline without converting:
q4_k_f16_wmma_prefill_wave32mul_mat_swiglu_q4_k_f16_wmma_prefillq6_k_f16_wmma_prefill_wave32mul_mat_id_swiglu_f16_f16_wmma(routed)mul_mat_id_f16_f16_wmma(routed)q4_k_f16_wmma_prefill_wave32(dense)Correction: the 30B pp16384 attention row was 21.0 % / 12.5 TFLOP/s in my earlier table and is 26.4 % / 15.8
TFLOP/s. That is my instrument, not the GPU: the two runs straddle a change to how the ranking credits a match's FLOPs
(per-kernel rows are now keyed by the shape log's kernel name and the credit goes to the longest-running kernel in the
execution), and I am quoting the version under review (#3111
5156789) rather than the earlier one. The conclusion isunchanged — attention is ~46 % of the 30B's 16k pass at about a quarter of roof — but the number had to be replaced, not
carried.
What their machine model adds to the reading, beyond the denominator.
mall_bytes: 33554432changes what "memory-bound" means here. I graded the MoE grouped GEMMs (83 and 116 GB/s) asmemory-ish against the 256 GB/s pin rate. With a 32 MiB Infinity Cache in front of LPDDR5X, reused expert weights can be
served above the pin rate, so 256 GB/s is a lower bound on the bandwidth available to a kernel whose working set fits
the MALL — which makes "memory-bound" the conservative reading and strengthens the case that the 13-15 % roof on those
two kernels is tile/occupancy, not pure DRAM.
wave32, 1536 VGPR/SIMD, granule 24 is the occupancy frame the dense tile has to be judged in: their own note is thatat wave32 a tile costs twice the VGPR per lane that it would at wave64, and 249 VGPR ⇒ 5 waves/SIMD. The f16 prefill tile
running at 40 % is a candidate for exactly that arithmetic, and it is the first thing to check before any rewrite.
utilization metric indicates the counter is absent, not that the matrix unit was idle"). That is why
%roofhere iscomputed from time and FLOPs rather than read from a counter — and why the number is only as good as the FLOP model.
Which is testable and I checked it: the profile's own FLOP total for the 4B pp512 pass is 3.80 TFLOP against an
analytic 3.89 TFLOP for 36 layers × (qkv + gate/up + down) + attention + lm_head, i.e. 2.3 % apart, so the
denominator's numerator is not a guess.
Next, if wanted:
TraceLens/PerfModel/benchmarking/microbench.pywrites exactly the arch JSON shape my tool consumes,so a measured
matrix_fp16for this box is one GPU ticket away — the measured denominator would replace 60.0 withouttouching a line of the table. Its own gfx1151 caveats matter for that run: FP32/FP64 GEMMs go through rocBLAS only
(hipBLASLt has no tuned FP32 kernel there), and RDNA exposes no WMMA counters, so the suite cross-checks with shader clock,
dual issue and read bytes instead. Say the word and I will queue it after the
-ub 2048arm.bong-water-water-bong commentedon Nov 21, 2026
The M-curve: the dense 40 % is flat in batch, the MoE 14 % is not — and
-ubsilently changes which kernel family servesSecond ticket (
cl-hrxkern-3103-ub2048, exit 0 in 34 s, token released, no fault lines). Three arms: 4B pp512-ub 128,4B pp2048
-ub 2048, 30B-MoE pp2048-ub 2048, plus the pp512 controls already measured.%roofagainst GEAK's 60.0TFLOP/s. The first thing this taught me:
-ub 2048at-p 512is a no-op — the dispatch M is bounded by the prompt, somy "tile-M artefact" hypothesis was only testable by lengthening the prompt, which is what the other two arms do.
Dense Qwen3-4B — same kernel from M=512 to M=2048, and a different family below it
-ub 128hip:k_3757f9bc3e52(46.1 % of busy)-ub 128hip:k_88e9b03fe152loom mul_mat_q4_k_f16_wmma_prefillloom mul_mat_swiglu_q4_k_…prefill-ub 2048loom mul_mat_q4_k_f16_wmma_prefill-ub 2048loom mul_mat_swiglu_q4_k_…prefill-ub 2048loom mul_mat_q6_k_f16_wmma_prefillTwo separate findings, and they point in opposite directions:
q4_kprefill GEMM is flat in M: 40.0 % at M=512, 39.1 % at M=2048 (and 40.4 % at M=256 from the 16k arm). So thebiggest single block of the 4B's prefill is not batch-starved — it is the tile's own geometry (wave32 occupancy /
VGPR budget on a 1536-VGPR file: GEAK's machine model), which is kernel work, not a scheduler knob. Its siblings do
improve with M (
q6_k42.3 → 52.7 %, swiglu 54.9 → 59.9 %), so the gap is specific to that one kernel, not the family.-ub 128the loom f16 prefill kernels are absent and threehip:k_…kernels serve the pass, the largest at 21.7 % of roof — and the wall drops 21 % (3227 → 2537 tok/s).That is the first measured cost of a small ubatch on this model, and it makes "keep ubatch ≥ 512 for the dense prefill" a
rule with a number behind it rather than a preference.
Qwen3-Coder-30B-A3B — the routed GEMMs are strongly M-dependent, and it is worth +33 % wall
mul_mat_id_swiglumul_mat_idmmq4_k-ub 2048At pp512 each expert gets ~32 rows (512 tokens × top-8 / 128 experts); at pp2048 it gets ~128, and the same two kernels gain
+50 % and +45 % relative while the wall rate rises a third. So the 30B's −27 % row is substantially a rows-per-expert
problem, and the lever is batch shape — concurrency in serving (
-np, continuous batching), not a new kernel. Two runs agree(2088 ± 8 and 2068 profiled), and it puts the 30B at 2088 tok/s against BaseRT's 2242 at pp512 — much of the gap closes
when the batch is shaped like the comparison's.
What I would fix, revised with these numbers
expert. The deliverable is a
-np 4-style measurement of the same two kernels — which is exactly pi-i679's half of thisissue — and if that shows the same 22 % roof, the "fix" is a serving-side default, not a device-side one.
q4_ktile: kernel work, and only ~4-5 %. It is flat at 39-40 % across M=256/512/2048 while its siblings reach53-60 %. Bringing it to the q6_k's 52.7 % saves ~5.6 ms of the 158.7 ms pass (+3.7 %); to the swiglu's 59.9 %, ~7.8 ms
(+5.2 %). That is the honest size of the dense lever — it does not explain a 28 % gap, so the rest of that gap is
elsewhere (attention at 33 %, and per-dispatch overhead across 1150 dispatches per pass).
-ub 128costs 21 % of wall and changes which kernel family runs, which is also ameasurement hazard for anyone benchmarking small ubatches against each other.
bong-water-water-bong commentedon Nov 21, 2026
Deliverable 2 (pi-i679), first half measured — the cold round, where the 0.43-0.83 s goes. Warm rounds are still owed and are queued.
Server:
llama-server -m Qwen3-4B-Q4_K_M.gguf -ngl 99 --device HRX0 -np 4 -kvu -c 4096 -t 8, under a gpu-hold ticket; prompt = 9 tokens,n_predict 8,cache_prompt false, four requests issued concurrently against the fresh server. TTFT is client-side (time to the first streamed content),prompt_ms/prompt_nare the server's owntimings. Log:~/.cache/scratch-i679/ttft-20261121T042229.log.prompt_ms(server)n_promptFour things fall out of this, and they are separable:
TTFT - prompt_ms = 5 ms: there is no queueing, no graph-build tail worth naming. But the rate is 37 ms per prompt token (336.6 ms / 9 tokens, 26.7 tok/s) where the pp512 row in this same issue measures ~3210 tok/s — a 120x per-token difference on the same engine. For a 9-token prompt the fixed cost (first graph build + JIT of that graph) is amortised over nine tokens, so the honest reading is "the cold cost is fixed, and it is being divided by 9": at 512 tokens the same fixed cost is invisible, which is exactly why the issue's prefill rows and its TTFT row look like different problems.TTFT - prompt_ms ≈ 0.341 sand theirprompt_msis lower (284 ms) — they started after the first pair had already built the graph, so their prompt work is cheaper while their wall clock is nearly double. That is the-np 4serialisation showing up as wall time, and it is the piece the issue's "scheduling" phase names.graphs reused = 6in every slot afterwards — the cache works once it has been paid for.What is still owed: rounds 2-4 (warm) from the same run, which is what separates "fixed graph/JIT cost" from "per-request cost" — the four-phase breakdown the issue asks for. Those were cut short by my own harness: the first attempt used a bare
wait, which waits for every background child including the server, so the round printed nothing while the four requests had actually completed in 1.8 s of server time and burned a 16-minute ticket. Fixed (wait "${pids[@]}"), and the re-run is queued behind this lane's three test-suite jobs in one ticket, so it costs no extra queue position.Also worth noting for whoever reads the fix list later:
-kvuat-np 4is in the client protocol above, not in the engine — nothing in this measurement says the engine is slow at short prompts per se; it says the first graph is expensive and small prompts divide it by very little.bong-water-water-bong commentedon Nov 21, 2026
Handover to cl-1051 (ORCH moved #3103 deliverable 2 — the
-np 4 -kvufirst-token breakdown — to this lane, 00:5xZ). The cold half is already measured and posted above; here is the state of the rest so you do not repeat any of it.Already on this thread (my comment at 04:56Z): TTFT 0.342 / 0.342 / 0.625 / 0.624 s for four concurrent 9-token requests against a fresh server, server-side
prompt_ms336.9 / 336.6 / 284.2 / 283.7 over 9 tokens, i.e. the first pair'sTTFT − prompt_ms = 5 ms(prompt processing is the whole first-token cost, at 37 ms/token = 26.7 tok/s versus this issue's own ~3210 tok/s pp512) and the second pair paying +0.341 s of scheduling with a lowerprompt_ms. Cold decode 58.2 vs 22.8 ms/token against ~70 tok/s steady,graphs reused = 6for the rest of the run. Log:~/.cache/scratch-i679/ttft-20261121T042229.log.The harness is written, and it cost me a ticket to learn one thing about it — do not re-learn it:
~/.cache/scratch-i679/first-token-breakdown.sh <server-binary> <model> [ctx]startsllama-server -np 4 -kvu, waits on/health, then runs cold + 3 warm rounds × 4 concurrent streaming requests, measuring TTFT client-side andtimings.prompt_ms/prompt_nserver-side, writing to~/.cache/scratch-i679/(never/tmp— it is tmpfs).The trap: the first version ended each round with a bare
wait, which waits for every background child including the server, so the round printed nothing while its four requests had actually completed in 1.8 s of server time, and the ticket expired at its 16-minute hold. It is fixed (pids+=($!); wait "${pids[@]}"). The other two things that bite:IREE_HAL_AMDGPU_LIBHSA_PATHis the lever that initialises the HRX runtime (LD_LIBRARY_PATHalone is not enough), and only--list-devicesnaming HRX0 proves a device.What is still owed, and it is queued in my ticket (
b5fe58047, one gpu-hold, four jobs): rounds 2-4, the warm rounds, which are what separate the fixed graph/JIT cost from the per-request cost — the four-phase split the issue asks for. I will post the warm table here when it lands, so you inherit the whole breakdown rather than a plan for it. After this comment I stop working deliverable 2: no PR, no branch, nothing of mine charged to it.bong-water-water-bong commentedon Nov 21, 2026
The dense plateau is a workgroup count, and it is worth ~14 % of the pass (not 4-5 %)
I said the dense
q4_ktile was "flat in M, so it is tile geometry, worth +3.7-5.2 %". Splitting the same pp512 profile byshape instead of by kernel finds the lever inside that flat average — and it is not the tile's inner loop, it is how many
workgroups the launch has.
Efficiency rises monotonically with the workgroup count — 16 → 18.1 %, 40 → 44-48 %, 64 → 44.2 %, 152 → 54.1 % — and
the mechanism is in the kernel's own schedule (
kernel-corpus/kernels/loom-libs/ops/mul_mat_f32_f32_wmma.loom:123,@ggml_mul_mat_q4_k_f16_wmma_prefill_wave32):so the grid for the packed path is
(1, N/64)with 512 threads: the token dimension is collapsed on purpose (the packedactivation is read once), and parallelism exists only along N. For Qwen3-4B that means the k/v projections (
N = 8 kv heads × 128 = 1024) launch 16 workgroups on a 40-CU part — 16 × 16 waves = 256 waves against 1280 wave-slots, i.e. about afifth of the machine, and the profile measures 18.1 % of roof.
And those two projections are not small.
K=2560 N=1024is 35.6 ms of the ~148 ms pass — 24 % of it — at 18.1 % ofroof. Running them at the level of the same kernel at
N=4096(44.2 %) would take ~14.6 ms: ~21 ms saved per pass, i.e.~14 % more prefill throughput (158.7 → ~138 ms, 3210 → ~3700 tok/s) — three times the dense estimate I posted earlier, which
averaged these launches in with the good ones.
Three candidate fixes, in the order their cost suggests (all fork-side, this file is public):
64/128 × 256/512ordinary variant; a 32-channel tile on thepacked path turns
N=1024into 32 workgroups for free. Onescf.select, testable by the shape atK=2560 N=1024.split_knotion for other formats(
common_append_mul_mat_token_tail,split_kin the predicate), so the machinery has a precedent; it multiplies workgroupsby the split factor at the cost of a reduction.
N=1024 + 1024 → 2048gives 32 workgroups and one fewerdispatch per layer; there is no such matcher today (
common.mul_mat_swiglu…is the only fused pair).I will take (1) first: it is the smallest change, it needs no new matcher, and the target is already measured — one shape,
one launch dimension, 18.1 % → ≥44 % would be a ~14 % pass-level win. GEAK is the mandated tool for the kernel iteration; the
shape (
K=2560, N=1024, M=512, q4_K, packed) is a single task for it. Before that, one cheap measurement to stop guessing:run the pp512 profile with the k/v pair as the only variable (Qwen3-4B vs a model with a wider KV, or
-ub 256vs-ub 512)to confirm the 16-workgroup launch is the binding term rather than a coincidence of these four shapes.
bong-water-water-bong commentedon Nov 21, 2026
Correction to my own workgroup claim, measured on the same shapes at two prompt lengths
I wrote "efficiency rises monotonically with the workgroup count". Put the two 4B profiles side by side — same model, same
shapes, M=512 and M=2048 — and the monotone story does not survive; the stable fact is narrower and still points at the
same shape:
So: 64 workgroups is not better than 40 once M=2048 (44.2 → 33.8), and the ordering is not a function of the workgroup
count alone. What is stable across both prompt lengths is that
N = 1024is the worst row in both profiles (18.1 % and26.9 %, i.e. the last place both times), and the reason is now two terms rather than one:
amortise, which is exactly why
K = 9728at the same 40 workgroups (47.8 %) beatsK = 2560at 64 (44.2/33.8).That second term is why I would now order the fixes differently from my previous comment: split-K first, not the finer
channel tile. A 32-channel tile gives the k/v shape 32 workgroups but keeps K = 2560 per launch; splitting K by 4 gives 64
workgroups and divides the serial inner loop, which is the term that hurts. The finer channel tile stays the cheaper
experiment (one
scf.select, no reduction), so it is still where I would start a kernel run — but its ceiling is lower thansplit-K's.
Neither is a fix I can claim yet: this table is an inference from two prompt lengths of one model, and the decisive test is a
shape sweep (
K=2560, N=1024, M ∈ {128, 512, 1024, 2048}, packed) under GEAK, which the box's owndense-prefillharnesspattern already covers. Recorded so the next reader does not inherit the stronger version of my previous claim — the
aggregate 40 % is real, but the explanation is two terms, not one, and the second one I had not seen when I posted.
4 remaining items
bong-water-water-bong commentedon Nov 21, 2026
Correction, and the mechanism the swiglu has and the plain GEMM does not:
pairedis what buys 32-channel tilesTwo turns ago I wrote that the k/v fix was "a finer channel tile for small N — one
scf.select", and that the schedule"already has a 64/128 × 256/512 ordinary variant". Reading the callee properly, that is wrong, and the reason is more
interesting than the fix I proposed.
ggml_mul_mat_quantized_f16_prefill_wave32derives its whole tile geometry from two things — the workgroup size and thepairedflag — not from the launch's channel divisor(
kernel-corpus/kernels/loom-libs/motifs/mul_mat_quantized_f16_prefill.loom):and the two schedules that call it differ exactly there:
channel_tile(launch divisor)paired@ggml_mul_mat_q4_k_f16_wmma_prefill_wave32(mul_mat_f32_f32_wmma.loom:123)output_size / 64@ggml_mul_mat_swiglu_q4_k_f16_wmma_prefill_wave32(mul_mat_swiglu_f32_f32_wmma.loom:1500-1507)output_size / **32**when packedSo the fused gate/up kernel runs at 32-channel granularity with two paired weights and the plain one cannot: an unpaired
tile is 64 channels wide by construction, and dividing the launch by 32 without the body agreeing would have each workgroup
cover half a tile. That is why I am retracting "one
scf.select" — it would have produced a wrong kernel, and it is thesecond time tonight a schedule-level "cheap fix" of mine turned out not to exist in the body (the first was
-ub 2048at-p 512, which is a no-op).What the same table says the k/v lever actually is. The mechanism that gets 32-channel tiles exists today in the motif,
under
paired: it stages the first weight's rows and a second buffer's rows into one tile and applies a binary op. Forgate/up the second buffer is
up_weightand the op is the GLU. For the k and v projections the shape is the same minus theGLU — two weights of identical shape (K = hidden, N = 8 kv heads × 128 = 1024 each) whose outputs go to adjacent rows of one
buffer. So:
weights and an identity binary op, and a graph rewrite that feeds both projections from one node). It would take the k/v
pair from 16 workgroups to 32 at N = 2048 of fused output and remove one dispatch per layer — the k/v row is 35.6 ms
of the ~148 ms pass at 18.3 % of roof, so this is the lever with the largest measured headroom that does not need new
numerics.
logic without a peer weight (
%unpairedat:707,%packed_singleat:708) — which is precisely the path the k/vshape takes and precisely why it is the slowest row.
The iu8 A/B I recommended last (ceiling 1.18x, ≤ +16 % upper bound) is unaffected by this and is still the cheapest single
experiment; this correction only removes the cheap route to the +7.6 % k/v item and replaces it with an honest one that
reuses
paired.hrx2kineto --by-shape: rank by (op, K, N), because a per-kernel avera…
bong-water-water-bong commentedon Nov 21, 2026
The per-kernel Loom harness could not run an AMDGPU case on this box — and the fix is a different binary, not a build.
Two failed attempts, both before any kernel ran, and both worth recording because each produces a message that reads like a
bad module rather than a bad tool:
i.e. that build has no amdgpu driver and no artifact provider for hip — it is a reverse-engineering artifact, not a
benchmark tool, and neither flag can work. The supported front-end is in the pypi toolchain
(
~/amd-oss/toolchains/loom/.venv/bin/loom-benchmark,hrx_loom 0.1.0, recorded inloom-install.json), and it plans thesame case correctly:
So no build is needed after all — the N-sweep is one GPU ticket with the right binary, and the ticket that is queued now
(
cl-hrxkern-3103-n4b) has been repointed at it. The Qwen3-4B pp512 manifest it runs against was generated entirely CPU-sidefrom the command-program dump this lane took (
GGML_HRX_DUMP_COMMAND_PROGRAM_DIR→ 575 commands → 17 cases), with thegenerator's two path assumptions found and worked around (
HRX_DIR = SCRIPT_DIR.parents[1], so the script must sit at<root>/tools/benchmarks/; and both output paths must be absolute because it callsrelative_to(HRX_DIR)).Two corrections to my own earlier statements, since both were published here: "
iree-benchmark-loomis not on the box"(it is, but the wrong build), and "this needs a full build" (it does not — it needs
loom-benchmarkfrom the toolchaininstall). The case files, the manifest and the driver/provider facts are now all in
~/.cache/scratch-cl-hrxkern/i3103/hrxroot/for the next lane.bong-water-water-bong commentedon Nov 21, 2026
The third failure mode of the same harness, and the one that was mine:
compile_failed,symbol … is referenced but not defined.The N-sweep ran (ticket took the token after 1252 s), all four cases came back
compile_failed, and the failure is specific:Line 19 is the
kernel.declthe generator emitted. The fork's README says why: "benchmark sources stay separate from theproduction kernel corpus: they declare the kernels they need with
kernel.decl, and the runner links those declarationsagainst the production
.loomfiles before benchmarking." I had invokedloom-benchmarkon the module directly andskipped the link step — my mistake, not the tool's.
The correct invocation, verified CPU-only before spending another ticket (
--dry-run-onlylinks and plans without adevice):
Two facts that belong in the harness note:
run-model-benchmarks.pyalso derivesHRX_DIR = SCRIPT_DIR.parents[1](so itmust sit beside the generator), and it looks for a binary named
iree-benchmark-loom— this box's toolchain calls itloom-benchmark, soIREE_BENCHMARK_LOOMis the override that makes the pypi install work. Re-queued ascl-hrxkern-3103-nsweep-v2with the runner, four cases, link+plan pre-verified.Three failures, three different layers — driver/provider, then symbol linking, and both caught by a CPU-side dry-run once I
started doing that first. The measurement itself has still not run; when it does, it is the one-variable-N test on the dense
model and it goes here with the per-case numbers.
bong-water-water-bong commentedon Nov 21, 2026
Warm rounds delivered — and they do not reproduce the issue's 0.43-0.83 s first-token figure for this shape. Same invocation as the cold round I posted earlier: 9-token prompt,
-np 4 -kvu -c 4096, 4 concurrent streaming requests,n_predict 8, four rounds on one server, one gpu-hold ticket.prompt_msFour things this settles, and one it does not:
0.065 − 0.032), and identical across the four concurrent requests — so at-np 4there is no serialisation penalty once the graph is warm. The scheduling cost I saw in the cold round (two requests +0.34 s) is gone by round 3.prompt_msis the highest (93 ms vs 32 ms) — so "cold vs warm" is not monotone: the second round pays more prompt cost than the fourth. Whatever warms up is not the first request; it is the second pass over the same graph.graphs reused = 6for every slot from round 1 onward (graph reallocs = 0), so the graph cache is already effective in the cold round; the remaining fixed cost is not graph rebuilding.Harness:
~/.cache/scratch-i679/first-token-breakdown.sh <server> <model> <ctx>, log~/.cache/scratch-i679/ttft-20261121T073434.log, server-side lines confirm7.91-7.98 ms/tokenper prompt token (126 tok/s) on round 1 — i.e. the cold cost is prompt-eval at 9 tokens, where two graph builds are amortised over nine tokens.This is my last contribution to deliverable 2 (ORCH moved it to this lane); the harness, the cold table I posted earlier, and this one are the handover.
bong-water-water-bong commentedon Nov 21, 2026
The isolated kernel is at 66-96 % of the ceiling — the loss is in the PASS, not in the launch width
The Loom benchmark ran (four cases,
--device=amdgpu --measure=dispatch_complete --iterations=10, ticketcl-hrxkern-3103-nb2, 8 s of device time). Same kernel (ggml_mul_mat_q4_k_f16_wmma_prefill_wave32), same token count512, N varying — and the launch config, LDS and per-dispatch time are now measured, not inferred:
_002_013_008_005Two conclusions, and the second one reframes my earlier report.
The narrow-N kernel is real, and its size is now measured: 16 workgroups reaches 65.7 % where 64 workgroups
reaches 96.4 % — a 35-point gap at the kernel level, with the same K. (
_008at the same 40 workgroups as_013butK=4096 instead of 9728 shows the second term: less K-work per wave, 67.7 % vs 96.0 %.)
But the model runs the same kernel far below its isolated efficiency, which is where most of the "18 % of roof" in my
earlier table came from:
So the k/v row is not at 28 % of the ceiling because of the kernel — the kernel is at 66 %. Something in the pass costs
it 2.3×, and that something is the same for a shape whose kernel is already at 96 %. Candidate causes, in the order the
data suggests: the number of concurrent dispatches and their L2/MALL footprint in a 1150-dispatch pass, the packed
activation state (below), or TLB/page behaviour on the weight rows. This is now the question worth answering, and it
is not a kernel rewrite.
Two corrections to what I published earlier, both from this run's own launch configs and the manifest the generator
produced from the dump:
workgroups(1, N/64). The dump saysggml.mul_mat.f16_input_layout = 0for thisshape, so the kernel here is the unpacked schedule:
token_tiles = token_capacity/256 = 2,output_tiles = N/128, i.e.2×8 = 16 workgroups for N=1024 — the same count I quoted, from a different derivation. The count claim survives; the
mechanism sentence did not.
removed, k/v would go 10.9 → 25.5 TFLOP/s, but the benchmark gives no mechanism for that, and the isolated number is what a
kernel change would have to beat.
The harness itself is now cheap enough to iterate with (8 s for four cases); cases, manifest and the runner's link step live in
~/.cache/scratch-cl-hrxkern/i3103/hrxroot/, and the invocation is written up in the OKF pagesystems/1bit-monster/references/hrx-loom-benchmark-harness.md.bong-water-water-bong commentedon Nov 21, 2026
Correction to the correction: the "2.3× in the pass" is contention, not a penalty
I published, an hour ago, that "the model runs the same kernel 2.3× slower than isolated" (10.9 vs 25.5 TFLOP/s) and that
"the pass is the bigger term". Both sentences are wrong, and the profile says so with one measurement I already had.
HRX issues independent dispatches without a barrier, so kernels run concurrently and each one's recorded duration includes
the time other kernels were also running. Taking the same 108 dispatches behind the k/v row in the pp512 profile and
computing, for each, the union of the intervals during which at least one other dispatch was running:
Every one of those dispatches is fully overlapped: there is no uncontended window to compare against, so "243.3 µs in the
pass vs 105.3 µs isolated" is one contended measurement against one uncontended measurement, not a slowdown. The 2.3× figure
is an artefact of the comparison, and I should have reached for
hrx2kineto.py's ownoverlap_ns()before writing it — thetool exists for exactly this, and its docstring says the durations cannot be read as exclusive.
What survives, and it is enough to keep the conclusion:
means the GPU is time-shared end to end. Per-kernel shares of busy are valid; per-kernel "absolute rate" is not.
K2560/N4096, 96.0 % at K9728/N2560, 67.7 % at K4096/N2560, 65.7 % at K2560/N1024 (16 workgroups).
question is total work over total time, not "why does the pass slow a kernel down". The
_008vs_013pair shows thesecond term (same 40 workgroups, K=4096 vs K=9728: 67.7 % vs 96.0 %), which was already the honest version of my
"two terms" claim.
Three claims of mine have now dissolved against my own data in one session —
-ub 2048at-p 512being a no-op, theunpaired 32-channel tile that the callee cannot express, and now this contention artefact. The pattern in all three: I
compared two numbers measured under different conditions and treated the difference as a property of the code. The check
that would have caught all three is the same one — what was different between the two runs besides the thing I am calling
the cause?
bong-water-water-bong commentedon Nov 21, 2026
The edit → measure loop for the k/v kernel, without a build
The narrow-N kernel is the only measured kernel-level defect left in this issue's dense story (65.7 % of the measured f16
ceiling at K2560/N1024 against 96.4 % at K2560/N4096, same kernel, same T), and it needs a body change — the schedule
cannot express a narrower tile, because the callee derives the channel stride from
paired, not from the launch divisor. Twothings were missing to work on it: a cheap way to iterate, and a documented starting point. Both exist now.
~/.cache/scratch-cl-hrxkern/i3103/kv_iterate.sh(verified end to end on CPU with--dry-run-only;stages={'dry-run': 'ok', 'loom-link': 'ok'}for both cases):Why this is the right loop, and why it is cheap:
loom-benchmarkcompiles the module it is handed, so editingkernel-corpus/kernels/loom-libs/motifs/mul_mat_quantized_f16_prefill.loom(or the schedule inops/mul_mat_f32_f32_wmma.loom)inside the seeded corpus is the whole iteration: edit → run → read the numbers. No cmake, no ninja, no 20-minute build slot.
that is slow, with no contention from 1150 other dispatches (HRX dispatches overlap, which is why in-pass per-kernel rates
are not kernel rates — corrected here an hour ago).
_002rides along as the control: the same kernel at N=4096 is already at 96.4 %, so a candidate that improves_005but disturbs
_002is visible in the same run.The two candidate directions, unchanged from the source reading: a paired k/v matcher reusing the swiglu's
paired = truestaging (32-channel tiles, 32 workgroups at N=2048 fused, one dispatch fewer per layer), or split-K in the callee (more
workgroups and a shorter serial inner loop). Both are body/schedule work, and both are now measurable in under a minute per
attempt.
Not done here, and named so it is not mistaken for done: no candidate has been written or measured yet. What exists is the loop,
the seeded corpus, the two cases, and the numbers to beat (65.7 % / 105.3 µs per dispatch at
_005; 96.4 % / 287.0 µs at_002).bong-water-water-bong commentedon Nov 21, 2026
First candidate measured: the narrow tile is 5 % SLOWER — the k/v shape is not workgroup-starved
I built the cheap candidate the source reading suggested and measured it against the control in the same run.
Candidate: in
ops/mul_mat_f32_f32_wmma.loom, make%wide_tileadditionally requireoutput_size > 2048, so anN=1024 GEMM takes the 64-channel / 256-thread tile instead of 128 / 512 — i.e. twice the workgroups. The body needs no edit:
it re-derives
weight_rowsandsubgroup_channel_stridefrom the workgroup size the schedule selects, so the two agree byconstruction (checked in the linked module).
_005K2560 N1024_002K2560 N4096 (control)So the geometry change landed exactly as intended and made it 5 % worse. The 128-channel tile with 16 workgroups beats
the 64-channel tile with 32, which retires the hypothesis I have been carrying for most of this issue: the narrow-N row is
not workgroup-starved. Doubling the workgroups buys nothing because the tile it halves is doing more useful work than the
parallelism it gains, and the per-workgroup LDS footprint (≈38 KB, i.e. one workgroup per CU at 64 KB/WG) does not change
enough to rescue it.
What that leaves, and what it rules out:
schedule has exactly two tile widths and both are worse in the other direction for this shape.
parallelism without shrinking the tile, and it needs the motif's body. This is the first thing in this issue's kernel story
that is genuine kernel work rather than a scheduling knob.
_013(K9728/N2560, 40 wg) at 96.0 % and_002at 96.4 % show the tile itself is fine where there is enoughK-work per wave, which is exactly the term split-K multiplies.
The candidate is a local edit in the seeded corpus (
~/.cache/scratch-cl-hrxkern/i3103/kvloop/,.origkept); nothing ispushed, because it lost. The loop that produced this in one 2-second device run is described in the previous comment, and the
numbers to beat are now:
_005105.3 µs / 65.7 % (unchanged baseline),_002287.0 µs / 96.4 %,_008408.6 µs / 67.7 %.bong-water-water-bong commentedon Nov 21, 2026
Parking this half, per the owner's direction of 05:2x AST (GPU route = pure Loom;
~/briefs/LOOM-GPU-SWITCH.md). Deliverable 2 is delivered above and stands as a measurement; nothing more will be added to it from this lane.What it leaves for L2 (the gated A/B, cl-hrxkern) — the three numbers a Loom-vs-fallback first-token comparison should be measured against:
n_predict 8,cache_prompt false), and the server's own per-taskprompt evalfor the same five tokens: 499.8 → 101.7 → 52.7 ms. The same prompt costs 9.5x less on its third use, so any Loom first-token number is only comparable to a fallback number at the same warm state — quoting one engine cold against the other warm would produce the 3-6x gap in the issue body out of warm-up alone.-np 4 -kvucost one prompt-eval pass, not four (identical completion timestamps across slots), so the gate's "4 concurrent requests" arm should either use-np 4on both engines or state the slot count it used./health= 3051 ms (load + graph init), which is the other half of "warm-up" and should be reported separately from TTFT.Fallback route for the record: this lane's 4-slot steady state is 43.68 tok/s (arm-B, reproducing the lane's own 43.5 within 0.4 %), and 8 slots at 2048 ctx/slot is 65.02 tok/s.
bong-water-water-bong commentedon Nov 21, 2026
PARKED by owner direction (2026-11-21 ~05:20 AST), not closed. The GPU route switches to pure Loom; new HIP-kernel and
fork-matcher work stops, and this issue's remaining items are answered per model by the Loom gate (L2) instead. Recording the
state here so a reader knows exactly what stopped and what is still true.
What this issue delivered before the park (all measured on this box,
llama.cpp 84ab5dae8/ engine main, GEAK's 60.0TFLOP/s and 256 GB/s as the reference peaks):
hrx2kineto.py --by-kerneland--by-shape-ub 2048at-p 512is a no-op; the unpaired 32-channel tile the callee cannot express; in-pass per-kernel rates are contention, not kernel slowness)What is left undone, and where it goes: the only remaining lever I found is split-K in the prefill motif body (keep the
128-channel tile, split the contraction), which is HIP/Loom-body work of the kind the owner has now frozen. If the Loom route
wins the gate on the models below, this issue's subject — our HRX path's prefill gap — stops mattering for serving; if Loom loses
on a model, that model's row in the gate is where the question reopens, with the numbers above as the baseline.
The Loom gate issue (L2) will carry, per model, the interleaved A/B and the accuracy comparison that decide the route.
bong-water-water-bong commentedon Nov 21, 2026
Parked (owner direction 21 Nov): the engine's GPU route is moving to Loom (AMD's Loom programs on HRX, served by
loom-serve); the llama.cpp-fork + HIP-kernel route stays as a frozen fallback for models Loom does not cover yet. No new work on this issue. A model moves to Loom only after a gated interleaved A/B plus accuracy check against the current route; the per-model results will be linked here. The NPU engine work is unchanged.docs: the GPU route is moving to Loom; the HIP-kernel route is the fa…
bong-water-water-bong commentedon Nov 22, 2026
Closing as Loom-route work, with the numbers this lane actually measured rather than a promise. ORCH's 22:00 plan assigns #3103 to cl-hrxmem tonight with exactly this option: one measured fix, or close as Loom work with numbers.
What was measured on this box, this lane, at the shipped pins
-p 1374 -n 0, one ticket:ubatch 8 → 50.86 tok/s,ubatch 16 → 4.80,ubatch 32 → 9.21,ubatch 512 → 35.8. A 10× cliff between adjacent batch sizes is a claim rule problem, not a kernel-speed problem — andGGML_HRX_LOG_DISPATCH=1named it: at ub8 the fast1hrow serves the batch, at ub16hip.kquant_tokens.mmtakes it because IQ1_S was the only format with not16kernel.flintQ4_K_XL,-p 1024 -n 48: HIP add-on sink 1702.58 / 897.85 pp1024, HIP vs the Loom sink. I retracted the quotable 1.90× when the r3 variance came in; the direction survived, the spec did not.Why closing rather than fixing tonight: the two candidate fixes I had (
kMaxTokens8→16, andIQ1_Sinnarrow_format) were both measured and killed — the first would hand an 8-wide kernel 16 tokens (the constant is the kernel's width), the second measured 3.27 vs 4.80 tok/s. The third (a t16 IQ1_S kernel) compiles and measures 29.99 tok/s at ub16, but its correctness gate failed — the A/B produced no tokens at all — and that whole thread is #3221/#3035 territory on a frozen route.Where the remaining prefill/TTFT gap belongs from here: #3158 (the Loom route gate). The comparison this issue opened against BaseRT is exactly what a gated Loom-vs-fallback A/B answers, and it is the only route that ships.
Numbers above are all in this lane's state file with their tickets and logs; nothing here is re-measured, and nothing is claimed beyond what those runs showed.