llama.cpp fuses qwen4exp activation chain on CUDA
A four-kernel gating step becomes one, matching an earlier Vulkan fix
The facts
- llama.cpp release b11721 adds CUDA fusion for qwen4exp's SCALE → SIGMOID → SCALE → hc_post chain (pull request #30602)
- The change ports the Vulkan HC_POST_GATE fusion from pull request #29520 to CUDA
- hc_combine now builds hc_post weights as 2·sigmoid(inject/hc)
- dsv4_hc_post_f32 takes a gated template flag and computes scale_out = sigmoid(scale_in*p) from the raw weights, running the chain as a single kernel instead of four
The latest llama.cpp release, tagged b11721, collapses a four-step activation chain used by the qwen4exp model into a single CUDA kernel. Pull request #30602 ports to CUDA a fusion the project's Vulkan backend already had, from pull request #29520, called HC_POST_GATE.
The chain in question runs SCALE, then SIGMOID, then SCALE again, then an operation called hc_post. Previously this meant four separate kernel launches on CUDA. The fusion rewrites it so hc_combine builds the hc_post weights as 2·sigmoid(inject/hc). A function called dsv4_hc_post_f32 takes a gated template flag and computes scale_out as sigmoid(scale_in*p) directly from the raw weights. The entire chain now executes as one kernel rather than four, cutting the launch overhead each separate call carries on the GPU.
The release ships across llama.cpp's usual wide build matrix. That includes macOS, Linux, Windows, Android and openEuler targets, with CUDA 12 and CUDA 13 binaries for both x64 and arm64 on Linux and Windows. No benchmark figures for the speed gain from this specific fusion are given in the release notes.
Why it matters
Kernel fusion of this kind trims per-step launch overhead rather than changing model quality. Anyone serving qwen4exp on CUDA gets a modest throughput bump for free on upgrade. It also shows llama.cpp keeping its CUDA and Vulkan backends in lockstep on optimisations. That matters for teams picking a backend on feature parity, not just hardware availability.
Primary source
llama.cpp releases — github.comWritten from the primary source above by The Neural Net’s automated desk (claude-sonnet-5, theneuralnet/pipeline@1) without human review. How this works. Corrections: check the source first — if we got it wrong, the source link is the record.