Skip to content

llama-graph: make norm inputs contiguous for qwen4exp only (qwen35 one-token decode back on the fused GDN kernel) - #152

Merged
bong-water-water-bong merged 1 commit into
1bit/hrx-vulkan-patchedfrom
1bit/norm-cont-qwen4exp
Oct 25, 2026
Merged

bong-water-water-bong merged 1 commit into
1bit/hrx-vulkan-patchedfrom
1bit/norm-cont-qwen4exp

Conversation

@bong-water-water-bong

Copy link
Copy Markdown

Base: 1bit/hrx-vulkan-patched at 6ded110 (#147). One commit, 278997f.

Fork #142 (a25b4b8, Flash-Next on HRX) added a contiguous copy in front of every norm input for all architectures. On qwen35 models (Qwen3.8-27B, Bonsai-2-27B) that copy broke the match for the fused one-token GDN kernel (q36_gdn_decode): decode fell back to the Loom GDN path plus 112 extra copy dispatches per token. This restricts the copy to qwen4exp, which is the architecture #142 needed it for.

Measured (loom agent, strixhalo, gpu-kernels 2b626798a + hrx-system 82804197, performance mode):

main with fix
dispatches per token (Bonsai PQ2_0) 1608 1432
profiled decode step 50.2 ms 48.05 ms
Bonsai-2-27B PQ2_0 tg128, 3 interleaved rounds 20.17 / 20.36 / 20.46 20.94 / 21.31 / 21.31
Qwen3.8-27B tg128, 3 interleaved rounds 11.70 / 11.79 / 11.78 12.13 / 11.89 / 12.11

KLD vs the F16 reference at -ub 1 unchanged (0.000000). hw-gate ops + kat on qwen3.8-27b: PASS on a build carrying this commit. Flash-Next (qwen4exp) keeps the copy and is unaffected.

Full log: strixhalo ~/wt/loom-bonsai/REPORT.md (section "Bonsai one-token decode profile").

🤖 Generated with Claude Code

…e-token decode back on the fused GDN kernel)

#142 (a25b4b8) made build_norm wrap every view / reshape input in a CONT for all arches. On qwen35
(Qwen3.5 / 3.8, Ternary-Bonsai) the CONT before RMS_NORM(VIEW(gated-delta-net output)) broke the HRX
add-on's fused one-token GDN match (hip.q36.gdn_decode): decode fell back to the Loom
llm_gated_delta_net_f32_wmma_head128 path plus 112 copies, 1432 -> 1608 dispatches per token. The CONT
now applies to LLM_ARCH_QWEN4EXP only, the arch it was added for.

HRX dispatch profile, Ternary-Bonsai-2-27B PQ2_0, one-token decode, 31 steps, medians (fork 6ded110 +
gpu-kernels 2b626798a -> this): 1608 -> 1432 dispatches, step period 50.20 -> 48.05 ms (GDN 1.24 ms Loom ->
0.51 ms q36_gdn_decode_f32; state get_rows 2.18 -> 1.06 ms; copy_f32 0.51 ms -> gone).
llama-bench tg128 -r 3, three interleaved rounds (performance mode): PQ2_0 20.17 / 20.36 / 20.46 ->
20.94 / 21.31 / 21.31 tok/s; Qwen3.8-27B UD-Q4_K_XL 11.70 / 11.79 / 11.78 -> 12.13 / 11.89 / 12.11.
KLD vs the Bonsai F16 CPU logits (8 x 512): -ub 1 0.000000 (same top 100%, as before); -ub 8 0.000074.
No kernel changed (gpu-kernels 2b626798a in both builds).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant