Repository navigation
Description
Summary
A single Q4_K MUL_MAT, run through the HRX backend by a harness that only links libggml-hrx and libhrx (no engine, no model), is 3.5x slower on today's builds than on the rc-2026-10-31c binaries at M=16384, on the same box, same boot, same dispatch choice. The difference is inside libggml-hrx: crossing it with the older libhrx/libloomc moves the slowdown with the host library, not with the code objects.
| arm | libggml-hrx | libhrx + libloomc | M=16384 ms | TFLOP-s |
|---|---|---|---|---|
| A | rc31c (packaged) | rc31c | 18.566 | 43.95 |
| B | today (build-54625e8745, main bcb28cc) |
today | 65.486 | 12.46 |
| C (mix-a) | today | rc31c | 65.593 | 12.44 |
| D (mix-b) | rc31c | today | 18.381 | 44.40 |
Shape K=2560 N=9728 q4_k, 3 iters after warmup, GGML_HRX_LOG_DISPATCH=1. All four arms pick the same kernel
(hip.dense_prefill.mm) and report the same corpus ("335 kernels match their code objects"), so this is not
dispatch selection and not the code objects.
M=2048 is unaffected (2.78-2.83 ms / ~36 TFLOP-s in every arm) because the dispatcher sends it to
common.mul_mat.q4_k_q8_1_x4_prefill. That path is capped at token_count <= 2048
(ggml-hrx/dispatch_registration/common/dispatch-mul-mat.cpp:799-800, and Q4_K is excluded from the split-tail
relaxation at :789-795 because of the packed Row64 weight layout), so every prefill above 2048 tokens rides
hip.dense_prefill.mm and pays this.
Why this is not the pin
Both arms share the llama.cpp pin 4a58da9b087d23ac3596b35e58f3e69e29cd9f4b:
rc-2026-10-31c was built from engine 3cddcd6310 with HRX_PIN=4a58da9b0 (~/wt/release-rc/build-candidate18.sh:21-23),
and build-54625e8745 came from ~/wt/release-rc/work/src (bcb28cc), whose submodule is also at 4a58da9b0.
Every locally built tree I could find that is at that pin is slow (work/build, work/os/data.dir, the three
vmtest images, hw-gate-store/build-2bc61b1de8 and build-54625e8745, rlk-build, dsv41-lid), and only the
packaged rc-2026-10-31c binaries are fast. So the variable is how the package's libggml-hrx was built or
configured, not a source difference in the submodule.
Repro
# any harness that does one ggml_backend_graph_compute on a Q4_K MUL_MAT with M=16384, K=2560, N=9728;
# mine is ~/mosaic-bench/mosaic_bench.cpp (links ggml + ggml-hrx only)
R=/opt/rocm-therock/lib/python3.14/site-packages/_rocm_sdk_core/lib
LD_LIBRARY_PATH=<libdir>:$R GGML_HRX_LOG_DISPATCH=1 IREE_HAL_AMDGPU_LIBHSA_PATH=$R/libhsa-runtime64.so.1 \
HSA_USE_SVM=0 HSA_USERPTR_FOR_PAGED_MEM=0 HRX_ALLOW_NO_SVM=1 \
./mosaic_bench --mode gpu --M 16384 --K 2560 --N 9728 --type q4_k --iters 3
# <libdir>=~/wt/engine-c18/lemonade-onebit-rc-2026-10-31c/1bit/hrx/llama/bin -> 18.6 ms
# <libdir>=~/wt/release-rc/hw-gate-store/build-54625e8745/bin -> 65.5 ms~/mosaic-bench/mix-a and mix-b are symlink dirs that reproduce arms C and D (mixrun.sh runs all four).
Everything ran under one gpu-hold claim at a time, HSA_USE_SVM=0 HSA_USERPTR_FOR_PAGED_MEM=0 HRX_ALLOW_NO_SVM=1,
pp_dpm_sclk at 2895 MHz and Tctl 69-78 C throughout.
What I ruled out (measured, not assumed)
- Boot/DVFS state, thermal, GTT pressure, co-resident serves: arms A and B ran minutes apart on the same boot
with the same GTT (~34 GB of 128 GB) and the same die temperature. - Code objects / libhrx / libloomc: arm D.
- Dispatch selection: identical
hip.dense_prefill.mmin all arms. - The llama.cpp pin: identical
4a58da9b0on both sides (above).
What I did not chase
Which build knob does it. ONEBIT_*/GGML_HRX_* compile-time options and flags are the obvious suspects
(~/wt/release-rc/work/build/CMakeCache.txt is the slow build; the rc31c package ships no cache). Whoever owns the
HRX build can bisect it with the four arms above, since arm D already proves the boundary is the host library.
Context: I found this while re-measuring my own HeteroMosaic numbers (engine#755 / #777) after the 2026-11-01 11:13
GPU reset - the mismatch was a 3.3x gap between the pre-reset and post-reset iGPU rows, which turned out to be this.
It affects every prefill number above 2048 tokens measured on current main.
Activity
bong-water-water-bong commentedon Nov 1, 2026
Triage:
perf+hrx; owner pi-release (it holds both trees —~/wt/release-rc/build-candidate18.shfor rc31c and~/wt/release-rc/work/srcforbuild-54625e8745); it is also #713's subject.What the mixed arms already prove. A (rc31c ggml-hrx + rc31c libhrx/loomc) 18.566 ms / 43.95 TFLOP-s vs B (today + today) 65.486 / 12.46, C (today ggml-hrx + rc31c host) 65.593 / 12.44, D (rc31c ggml-hrx + today host) 18.381 / 44.40. The slowdown tracks
libggml-hrx, never the host libraries, and both arms share the pin4a58da9b087d, pick the same kernel (hip.dense_prefill.mm) and report the same 335-object corpus. So the variable is howlibggml-hrxwas built, not the source, not the dispatch, not the code objects.The one fact needed to close that gap (and the reason this is #713-shaped): the build identity of the two
libggml-hrx.so—hipcc --version, the ROCm/TheRock root it was built against,CMAKE_BUILD_TYPE, the ggml-hrx-Olevel and--offload-arch, pluslddof each showing whichlibhsa-runtime64it pulls. Same source + same objects + different speed is either a compile-flag difference or a different HSA runtime linked into the library; those two are distinguishable from that printout alone, and arm D already excludes everything on the host-library side.One confound to state, not to conflate. #777 (merged
166b5fe5c) measured that the box state itself changed after the 11:13 reset and the 12:04 reboot: every iGPU row at M=16384 is 1.4–3.3× slower with a hard knee between M=2048 and M=4096 — the same shape as this report. Its arms are inside one boot, so they exclude the boot-state effect for the A-vs-B comparison above, but the 43.95 TFLOP-s absolute is a pre-reset number and should not be quoted as today's achievable ceiling.Closing condition: an arm today at M=16384 within a few percent of 18.4–18.6 ms with the dispatch unchanged, or the flag/toolchain difference named as by-design.
bong-water-water-bong commentedon Nov 2, 2026
Build identity of both libraries, as asked (CPU-side, measured on the two files themselves). Short version: they were built by the same toolchain on the same box from the same llama.cpp pin, and the compile-flag sets are near-identical — so the 3.5x is not "one library built by a different compiler", it is something a compile-time difference selects inside the source. The one artifact-level asymmetry is that the packaged library is stripped and the local one is not, which is packaging, not codegen.
The two artifacts
~/wt/engine-c18/lemonade-onebit-rc-2026-10-31c/1bit/hrx/llama/bin/libggml-hrx.so.0.18.0~/wt/release-rc/hw-gate-store/build-54625e8745/bin/libggml-hrx.so.0.18.05a098bc0ee60a4ca15eae1b3d96a71d3.comment(compiler)AMD clang version 24.0.0git (…/llvm-project.git e095f1b3becf0c1bfdc5e7647003d60976a2460b),Linker: AMD LLD 24.0.0 (same revision).symtab/.debug_*ggml_hrx_hip_addon_registerNEEDEDlibggml-base, libhrx, libloomc, libstdc++, libm, libgcc_s, libc, ld-linux(identical in both)RUNPATH$ORIGIN(patchelf'd by packaging)_rocm_sdk_core/lib/llvm/lib/…0.18.0; "…match their code objects";hip.dense_prefill.mm— same in both%zmm, 0%ymm%zmm, 0%ymmToolchain identity (shared — this is the box both were built on)
CMake flags
B (the slow one) — measured, from its own
CMakeCache.txt:A (the fast one) — reconstructed from the build that produced it, not measured (the packaged library is stripped and ships no cache):
~/wt/release-rc/build-candidate18.shbuilt engine3cddcd6310withHRX_PIN=4a58da9b0, andcmake/hrx.cmakeat that pin passedi.e. the same list. The only flag-level deltas I can see between that pin and today's are the ones that changed after the release and are therefore not in A:
-DGGML_HRX_HIP_COMPILER/-DGGML_HRX_HIP_FLAGS(engine #771, merged tonight),--rocm-device-lib-path=…inCMAKE_C/CXX_FLAGS, and-ffile-prefix-map=<tree>=.(path scrubbing + a--rocm-device-lib-pathtoken). None of those should change host codegen, and since #771/#786 merged after B was built (09:05), B does not contain them either.What that rules in and out
-O3 -DNDEBUG, sameGGML_NATIVE, sameNEEDEDset, same dispatch and kernel-corpus strings, same absence of host SIMD either side.GGML_HRX_*/ONEBIT_*define, or a private-addon file that only one tree had at that moment) — i.e. the boundary you already narrowed with arm D. Worth diffing next: the ggml-hrx sources actually compiled into each (the addon'saddon.cmakefile list and any#ifdefthat gates thedense_prefilllauncher), since the flags themselves are equal.A/B re-measurement: the queue was empty at 19:45, so the four arms (A/B/C/D) are running now in one
gpu-hold -l "pi release"claim withHSA_USE_SVM=0 HSA_USERPTR_FOR_PAGED_MEM=0 HRX_ALLOW_NO_SVM=1; the numbers will be posted here as a second comment when it returns.bong-water-water-bong commentedon Nov 2, 2026
A/B re-measured — the original numbers reproduce exactly, in one
gpu-hold -l "pi release" -t 12claim, one claim for all four arms, trio on (HSA_USE_SVM=0 HSA_USERPTR_FOR_PAGED_MEM=0 HRX_ALLOW_NO_SVM=1,~/mosaic-bench/mixrun.sh, claim held 3 s, die 69 °C at entry,pp_dpm_sclkuntouched):hip.dense_prefill.mmbuild-54625e8745)So your table stands as posted, and the conclusion is unchanged and now repeated on a fresh claim: the 3.5× moves with
libggml-hrxand only with it (C slow like B, D fast like A), with the same kernel name, the same corpus count, and the samelibggml-base/libhrx/libloomcNEEDEDset.One extra lead from the identity pass, since the dyndsym counts differ by exactly one
Exporting symbol sets (1520 in A vs 1521 in B) differ in a single symbol, and only in the slow build:
Nothing is missing from A; B simply instantiates one more
std::vector<uint32_t>bulk-assign template than A does, which means one translation unit in the slow tree contains code the fast tree did not compile — the compiler emitted it because it is reachable there. That is consistent with a compile-time-selected path (an#ifdef/addon file present in one tree and not the other) rather than a flag: same clang, same SDK, same-O3 -DNDEBUG, sameGGML_NATIVE, no host SIMD in either, and A is additionally stripped by packaging.Where I would look first, given that: the addon file list in
addons/hip-hrx/addon.cmakeand any#ifdefaround thedense_prefilllauncher inggml-hrx/hip/…between the tree that produced rc31c andbuild-54625e8745— i.e. which.cpps joinedlibggml-hrxin each. I can produce that file list for both build trees if it helps; the packaged side has no sources, but its tarball does carry the licence/NOTICE so the pin set is recoverable.Everything above is measurement only — I have not changed any code for #782, and I hold no GPU claim now (the one claim was released at 20:13:23 AST, exit 0).
bong-water-water-bong commentedon Nov 2, 2026
The compiled file list, as asked — and it rules out the hypothesis the row is resting on
Produced statically (source + artifacts, no device, no claim). The
libggml-hrxsource list grows by exactly two entries between rc-2026-10-31c's fork commit4a58da9b0and the pind8bd0ff6052a, and nothing is removed:Artifact side corroborates it: the two
ggml-hrx.dirtrees on this box differ by exactly those two objects —~/wt/trel3(built 11-01 00:23) 130 objects, notop_k;~/wt/release-rc/work/src(built 11-02 08:31) 132 objects,nm -DC | grep -c top_k= 3,strings | grep -c hip.top_k_f32= 8 vs 0.So the dyndsym delta is not a missing TU. The extra
std::vector<uint32_t>bulk-assign instantiation lives in a file that is compiled in both trees and comes out different — i.e. the cause is a source change inside a shared TU, and "which TU got compiled in/out" is a dead end. That is worth knowing before anyone spends another build on it.Both additions are inert at default flags, so neither can be the 3.5×
host-weight-placement.cppis 65 lines, one function (host_weight_exceeds_residency), and it returns immediately atif (limit == 0) return false.HostWeightCache::residency_limit()is 0 by default — the code says so in as many words: "OFF by default (engine HRX route pins ~107 GiB outside process RSS on a 217 GiB mmap (DeepSeek-V4.1 UD-IQ1_S), independent of -ngl/ubatch/prefetch #669) … The default is 0: per-weight residency, exactly today's behaviour", withGGML_HRX_HOST_WEIGHT_LIMIT_MB=<MiB>turning "the bound (and the arena)" on.HostWeightExecutionScope residency_scope(context.host_weights)incommand-program-executor.cpp, no-ops on a null cache, andrebind_prepared_host_weights()returns at its firstempty()test.dispatch-hip-top-k.cpponly adds aGGML_OP_TOP_Kclaim and a kernel; a dense-prefillMUL_MATnever touches it.What is left, with the numbers
The range
4a58da9b0..d8bd0ff6052ais 10 fork commits; theggml-hrxdiffstat over it is dominated by modified files, which is where the answer has to be:runtime/host-memory.cppggml-hrx.cppruntime/command-program-executor.cppruntime/host-memory.hhrx-1bit-safety.cppbackend-context.hHow to bisect it cheaply (two things about this tree that cost the lane time)
~/wt/release-rc/work/src/third_party/llama.cppis a shallow clone (git rev-parse --is-shallow-repository→true), sogit log <range>there prints only the tip and it looks like one squashed commit. It is not squashed — the pins are intact (199165047= serve --moe-subst: routing that prefers resident experts (pin llama.cpp-vulkan 546800c) #161, then RFC: the registry follows the pins (CI check + regeneration in the bump workflows) #164/CI: the registry follows the pins (ctest registry_pins); bump workflows regenerate it #165/MoE streaming: Qwen3.8-Flash-Next streamed and measured; serve maps per-layer embeddings #166/MoE streaming: expert reads in 256 KiB chunks by 16 threads (pin llama.cpp-vulkan cecf3ee) #167/Pin llama.cpp 358cafc: ZAYA1-8B decodes 1.9x faster on HRX; concurrent ZAYA on Vulkan 2.5x #168/serve: --moe-slots auto, --moe-prefetch (off by default) #169/HRX: fix the MoE router expert-id fault (engine#123) #170/Census 2026-09-27 #171/docs: census figures of 2026-09-27 (94.88% mapped, 64.33% checked) #172/weekly: 1bit OS image builds under cron; the guard reports real failures #173), all reachable from a full clone. A commit-level bisect is available, no file-group surgery needed.4a58da9b0(or revert by file in the orderhost-memory→command-program-executor→ggml-hrx.cpp). The first arm that returns to ~18.5 ms names the commit/file.Caveats kept: rc-2026-10-31c's
.so(11,035,088 B) does not byte-match either on-disk tree (11,368,920 / 11,427,768), so only builds compare cleanly; and 43.95 TFLOP/s is a pre-reset absolute (#777 measured the box itself 1.4–3.3× slower at M=16384 afterwards), so the ratio is the number to trust, not the ceiling.bong-water-water-bong commentedon Nov 3, 2026
Root cause: the toolchain, not the pin — and the fix is one default
The pin hypothesis in this thread is wrong, by measurement. Building the rc31c pin (
4a58da9b0) today is just asslow as today's pin: 72.15 / 81.77 ms at M=16384, against 22.77 / 22.55 ms for the packaged rc31c library, with the
same reproducer, same boot, one claim, and everything but
libggml-hrxheld fixed. So "bisect the 13 commits" wouldhave found nothing, and the issue body's original framing ("how libggml-hrx was built") was right.
What actually differs is the compiler that built the embedded device code. Extracted
hrx_dense_prefillfrom bothlibraries (dlopen each
.so, call its ownhip_code_object_data) and read the code objects:Same source, same symbol set, different compiler. The resource metadata says what changed — every
_sb("B lane-halfpairs") instantiation spills to scratch under clang 24:
hrx_dp_mm_q4_k_r64_m128_w8_f2_sb(what M=16384 launches)hrx_dp_mm_q4_k_m128_w8_f2_sbhrx_dp_swiglu_q4_k_r64_m128_w8_f1_sbhrx_dp_mm_q4_k_r64_m64_w8_f2_sbhrx_dp_mm_q4_k_r64_m128_w8_f2(non-sb)All 19
_sbkernels inkernels/hrx_dense_prefill.hipcarry 320–576 B/lane where clang 23 had none — for every format,and in every weight-prefetch slot (recompiled with
dp_rf_m128_sbRF = 0/1/2/3: 576 B in all four). The tile tables indispatch-hip-dense-prefill.cppwere tuned on 2026-10-20 under clang 23, and the criterion is quoted in the source(
dp_rf_m128_sb): "the slot that compiles without scratch in the K loop at the best occupancy". That precondition isfalse now, so the dispatcher keeps choosing a tile that spills.
Fix: gpu-kernels #48
m128_sb()defaults to off, so Q4_K/Q5_K/Q6_K take the scratch-freem128_w8_f2tile;GGML_HRX_HIP_DENSE_PREFILL_M128_SB=1restores the old behaviour on a clean toolchain. One behavioural line + docs._sb, scratch 576)m128_w8_f2, scratch 0)M128_SB=1, same binaryM128=0(m64 tile)3.2–3.4x recovered, within 4–6 % of rc31c, dispatch unchanged (
hip.dense_prefill.mmin every arm), M=2048 untouchedas this issue predicted. Known answer at T=4096 (above the 2048-token cap, so it really reaches
dense_prefill.mm,confirmed in the dispatch log): both tiles give NMSE 1.65e-05 / max 4.06e-03 of max|ref| against the CPU backend,
identical to the printed precision — the tile swap does not move the numbers.
Named as by-design / still open
_sbkernels still spill on clang 24 (241 VGPRs allocated while spilling 576 B where 240 sufficed). That is aregister-allocation regression in ROCm/llvm-project
e095f1b3vs0bace190; the knob is where a future workaround ora toolchain fix lands.
geometries:
swiglu_tile()returnssb=trueunconditionally (and the non-sb swiglu kernels are not even registered),and
mm_tile()'sK >= 8192branch returns{64,8,2,true}(320 B scratch).common.mul_mat.q4_k_q8_1_x4_prefillis selected at T=512 fora bare f32 activation input and returns NaN (timing looks healthy: 0.7 ms). My known-answer probe caught it before I
raised T above the 2048 cap; I have not investigated it.
Also for the record on the box-state question in this thread: the ratio is what reproduces; the absolute 43.95 TFLOP-s
from before the 11:13 reset is not something today's box reaches (33.6–35.7 here, and rc31c's own packaged libs read
35.69 in the same claim).
bong-water-water-bong commentedon Nov 5, 2026
The number the SUPREME scoreboard prints for our prefill cell is probably measuring this spill, not our engine
Static, host-side, no device (so nothing here needs a ticket to check):
Two consequences, one of which changes what the scoreboard's prefill row means:
gpu-kernels addons/hip-hrx/dispatch-hip-dense-prefill.cpp:179-186readsGGML_HRX_HIP_DENSE_PREFILL_M128_SBand
m128_sb()returns false for Q4_K/Q5_K/Q6_K when it is0, i.e. the scratch-freem128_w8_f2tile. Docs chat on 1bit.gg: Context7 widget + context7.json #48 onlyflips the default (and the docs) — which is worth saying plainly, because it means the regression can be
measured and worked around on any binary built from today's pin,
M128_SB=0in the environment.hip.dense_prefill.mm— thepath this issue is about — while pp512 is below the cap and runs
q4_k_q8_1_x4_prefill, which the tile changecannot touch. The SUPREME scoreboard measured pp4096 = 193.55 tok/s against gufo's 574.67 and concluded "prefill
is our one real gap, a scheduling gap". If the
_sbtile is in play there, a 3.2x tile-vs-tile difference is thesame order as the whole 2.97x gap, so that conclusion is premature: the first thing to try on that cell is the
default flip, before anyone writes prefill kernels.
I am measuring exactly that on the scoreboard's own arm (same package pin, same GGUF, its
bench.py, pp512 as thecontrol cell and pp4096 as the affected one, default vs
M128_SB=0, onegpu-holdclaim, two launches) and will postthe two medians here and on the scoreboard. Filed the shapes only; no numbers leave the box (blog rule).
Related, from the same sweep in
dispatch-hip-dense-prefill.cppthat this issue already names as out of #48's scope:swiglu_tile()still returnssb=trueunconditionally at:190-ish and theK >= 8192branch still returns{64,8,2,true}, so a format/K pair that missesm128_fits()can still take a spilling tile — the flip closes the onepath the scoreboard measures, not the class.
bong-water-water-bong commentedon Nov 5, 2026
End-to-end on the SUPREME cell: the same package that prints pp4096 193-238 prints 229 → 301 with
GGML_HRX_HIP_DENSE_PREFILL_M128_SB=0, and the spread collapses with itThe 20:23 comment above argued the scoreboard's prefill cell was probably measuring this spill, and that the knob was
measurable today because gpu-kernels#48 only flips a default. That is now measured, not argued. Design was fixed before
the run, because the previous attempt was confounded: one
gpu-holdclaim, WARMUP (discarded), then A B B A, so knoband arm position are separable and the discarded arm takes the cold-cache transient.
Package pin
1bit-hrx-a5271d9(sha256(1bit)=abd84dea…,libggml-hrx=bae07098…) — the scoreboard's ownonebit:hrxarm, its own
bench.py, 5 reps, ctx 8192, Qwen3.8-27B UD-Q4_K_XL, cells pp512 + pp4096:M128_SB=0M128_SB=0This is a knob split, not a position split. ABBA balances positions exactly, the two A arms agree (232.64 / 228.73,
1.7 % apart) and both sit ~70 tok/s below either B arm (298.55 / 304.20, 1.9 % apart); a position effect would make the
fourth arm the fastest, and it is second slowest. Correctness on all five arms:
sane, output lengths[934, 927, 219]identical — same answers, so this is not computing something cheaper.Disclosure that cuts the number down rather than up: an NPU TDR landed at 21:50:23, inside arm A1's window (a GPU arm;
this run never touches the NPU — other lanes' tickets held it and recovered it). That is why the conservative bracket
above is quoted: +30.5 % at pp4096.
The control I expected to be inert was not, and the dispatcher explains why
I assumed pp512 (below the 2048 cap) would be knob-blind, so its earlier +49 % was read as "the box moved". That reading
was wrong.
take()indispatch-hip-dense-prefill.cppis!loom_aligned(tokens) || !loom_fast(type, swiglu), withloom_alignedtrue for 256-aligned batches in 256..2048 andloom_fastcovering only Q4_K (and Q6_K non-swiglu). AtM=512 the Q5_K matmuls — most
attn_qkv,attn_gate,ssm_out, the Q5_Kffn_*— still reach the dense-prefilltile, and so still see the knob. Only Q4_K/Q6_K defer to Loom at those batch sizes. pp512 is a second affected cell, and
its +41.5 % is the same effect at a shape whose tile is more of the work.
How much of prefill the knob can reach, computed from this GGUF
Replicating
mm_tile()/m128_fits()/m128_sb()over every tensor at M=4096 (FLOPs 2·M·K·N), with the fused-swiglu ruleapplied per layer (the fused kernel needs gate and up of the same type, and this GGUF mismatches them in 25 of 65
layers):
M128_SBswiglu_tile()returnsTile{…,true}for every pair at ≥256 tokens) — knob-blindffn_downin the IQ4_XS layers (K=17408 →mm_tile()'sK >= 8192branch,{64,8,2,true}) — knob-blindSo gpu-kernels#48 is half the FLOPs, and the ~1.5x it should be worth at this cell is what the +30.5 % is; the 3.5x the
M=16384 reproducer shows is not what to expect from a model, because 31.3 % of prefill FLOPs stay on the spilled tile
after #48: the two call sites above need making switchable before the next 3x is on the table. That is the follow-up I
would file against this issue, and it is a kernel change, not a measurement.
Reproduce:
~/supreme-npu/tile-ab2.sh(one gpu-hold claim, WARMUP + A B B A, per-arm Tctl trace, leak guard), output~/supreme-npu/tile-ab2-20261104T214357/.bong-water-water-bong commentedon Nov 5, 2026
Kernel level, per shape: the spilled tile is 2.12-2.90x slower at the exact 27B shapes — and the fused-swiglu call site is a dispatch fix, not a kernel build. Correction to what I wrote above.
Follow-up to the serve-level A/B in the previous comment. Same question asked of the device code directly:
addons/hip-hrx/tools/dense-prefill-benchon real Qwen3.8-27B UD-Q4_K_XL tensors, T=4096, A B B A per shape (A =..._m128_w8_f2, B =..._m128_w8_f2_sb), every run checked against the bench's own CPU reference. It usespi-fnprefill's gpu-kernels build (
428937ae6, code objecthrx_dense_prefill.gfx1151.hsaco), so the absolute ms arethat build's; the tile-vs-tile ratio is the point.
_sb(default)blk.16.ffn_downQ4_K, K=17408 N=5120blk.24.ffn_downQ5_K, K=17408 N=5120blk.58.ffn_downQ6_K, K=17408 N=5120blk.24.ffn_gateQ5_K, benched as mmblk.24.ffn_gate+upQ5_K, mode=swigluAll rows
max_err=4.44e-04(swiglu) or better,bad=0: the tiles agree numerically, so this is speed, not a differentcomputation. The two rows I would not lean on are the Q6_K and the gate-as-mm ones (their A-side spread is 50 % / 84 %);
the load-bearing rows are
ffn_downQ4_K/Q5_K (5-7 % spread) and the swiglu row (2.1 %).Correction: the 26.1 % swiglu share does not need a new kernel
In my previous comment I wrote that the two knob-blind call sites "need a kernel change". That is wrong for the bigger
of the two, and the measurement says so:
hrx_dp_swiglu_q5_k_m128_w8_f1— the plain, non-_sbfused swiglu kernel —is already exported by this build and is 2.86x faster than the
_sbvariant thatswiglu_tile()forces. Soswiglu_tile()returningTile{128,8,1,true}unconditionally is a one-line dispatch change with no new build, worthmost of the 26.1 % of prefill FLOPs I attributed to it — not a kernel job.
(Why this matters beyond bookkeeping: the reason it was never reachable is that
swiglu_tile()does not consultm128_sb()at all, so theGGML_HRX_HIP_DENSE_PREFILL_M128_SBknob has never had any effect on an FFN pair. A modelwith a large fused-swiglu share therefore kept the full spill even with gpu-kernels#48 merged.)
What is left after that
mm_tile()'sK >= 8192branch ({64,8,2,true}) is the other forced-sbsite (5.2 % of FLOPs,ffn_downin thisGGUF's IQ4_XS layers). I have not measured its non-
sbalternative, so it stays a claim, not a number — and unlikeswiglu it needs the
m64_w8_f2tile checked for existence and speed on that shape before anyone promises anything.Reproduce:
~/supreme-npu/tile-kernel-ab.sh(+--check-discovery, host-only) and~/supreme-npu/tile-kernel-ab-summary.py <outdir>; output~/supreme-npu/tile-kernel-20261104T230313/.bong-water-water-bong commentedon Nov 5, 2026
The reach depends on the batch size, and the smaller cell gained more — which is worth knowing before anyone reads pp512 as noise
Apply
take()(not justm128_fits()) per tensor and the reachable share changes with M, because at 256-alignedbatches in 256..2048
loom_fast()hands Q4_K (and Q6_K non-swiglu) to Loom:M128_SB=0with the fused FFN pair (26.1 % of FLOPs at every M, knob-blind until gpu-kernels#51) and the unfused pairs counted
separately. Both served figures are the conservative bracket from the A/B above; the pp512 arms' own spreads are 8.9-27 %,
so it is a bracket and not a precise number.
The ordering is the interesting part and my simple model does not explain it. If the gain tracked reachable FLOPs,
pp512 should have gained about half what pp4096 did; it gained more. The most likely reason is that the spilled tile's
cost per FLOP rises as M falls — at small M the same weight traffic feeds fewer tokens, so a tile that loses occupancy to
scratch loses more of the wall clock. That is consistent with #48's own reproducer being "unaffected at M=2048" only
because 2048 rides Loom, and 3.5x at M=16384.
Practical consequence for the scoreboard: the prefill cells that a served model actually hits (short prompts, 512-2048
tokens) are the ones where the tile choice matters most per FLOP, and two thirds of their FLOPs are still knob-blind
because
loom_fast()only covers Q4_K/Q6_K. So a per-cell reading of "our prefill gap" should not assume the samereach across
pp512andpp4096-- the two cells are covered by different matcher paths, and #51's swiglu line isthe part that raises both.
gpu-kernels: the m128 _sb tiles are off by default, so the clang-24 s…
bong-water-water-bong commentedon Nov 6, 2026
Resolved: attributed, fixed by the default flip, and shipped in the pinned kernels.
The attribution (measured, same llama.cpp pin, same
hip.dense_prefill.mmdispatch)The rc-2026-10-31c binaries embed clang-23 code objects (49× clang 23, 0× 24); the fork tip builds clang 24 (52×). Clang-24
_sbtiles carry 320-576 B/lane of scratch (engine#1064's measurement), so they spill — and the defaultGGML_HRX_HIP_DENSE_PREFILL_M128_SB=1selected them. Q4_K M=16384 K=2560 N=9728, clock-matched pairs:_sb)M128_SB=1(old behaviour)The rc lib is ~20-21 ms either way because clang-23's
_sbdoes not spill; the regression was toolchain × default, not the pin or the dispatch.The fix and where it lives
gpu-kernels #48 ("keep
m128_w8_f2_sboff by default") was rebased onto main after #59/#1064 rewrote the samem128_sb/m128_fitsregion (both changes kept:swiglu_tilestill followsm128_sb(), the flip lives insidesb_enabled()), merged, and the engine pin moved in #1248 (config/gpu-kernels.config94bc42e5 -> 262c2f9a). Verified with the add-on's owntools/check.sh gfx1151(409 kernel ids, 45 objects, 93 artifacts; only the pre-existing engine#52 fingerprint failures) andcheck-probes.sh(plain table when unset, old_sbtable at=1). A fresh engine build recompiles the add-on, so no env is needed.What this does not fix
The residual ~5 % vs the rc binary on the scratch-free tile is clang 24.0.0git (
e095f1b3) vs clang 23 (0bace190) codegen — ROCm/llvm side, not the fork. The box has only/opt/rocm-therockclang 24, so closing it needs a clang-23 build environment or an LLVM fix. Interim mitigation for an already-built binary remainsGGML_HRX_HIP_DENSE_PREFILL_M128_SB=0.Closing on the default flip being shipped in the pinned kernels; the toolchain gap is recorded here rather than claimed.
docs(hetero-prefill): the split's ratio on the post-#782 iGPU — the a…
docs: the split's third measurement ran on a pre-#782 library, so the…