Skip to content

Keep dense GGUF rows through GLU and RMSNorm fusions - #194

Merged
kvark merged 7 commits into
perf/attention-autotune-2026-09-19from
perf/native-projection-fusion-2026-09-19
Sep 20, 2026
Merged

kvark merged 7 commits into
perf/attention-autotune-2026-09-19from
perf/native-projection-fusion-2026-09-19

Conversation

@kvark

@kvark kvark commented Sep 19, 2026

Copy link
Copy Markdown
Owner

Stacked on #193; ordinary command recording only.

  • Keep dense F32/F16 GGUF projections in native [N,K] rows and use MatMulBT. Block formats retain their existing layout.
  • Reuse the transposed GEMV shader for fused residual adds and preserve RMSNorm folding. Both forms enter the existing qualified workgroup-width/reduction search.
  • Share gate/up packing across orientations, SwiGLU/GeGLU, and greedy/egglog rewrites. Row updates preserve current destination bytes, including unaligned f16 ranges.
  • Use a portable two-dimensional dispatch grid for wide output vocabularies. This respects B570's 65,535-workgroup X limit without changing the common-case geometry.

No device/model thresholds, expanded tuning budget, precision changes, or command-buffer replay.

Matched ordinary-recording results

Source 69bbb48450fee8f9957b682ffec95733ca50c1f4; control 861d87b9a85f666a5a131f82d07c0b66d9131e16 includes attention tuning. Median of three fresh-process medians, with rotated engine order:

GPU Phase Control (ms) This PR (ms) llama.cpp (ms)
RTX 5070 Prefill 8.777 8.479 7.087
RTX 5070 Decode/token 3.002 2.514 1.385
Arc B570 Prefill 21.337 21.251 15.610
Arc B570 Decode/token 5.561 5.129 3.425

Decode improves in all three trials: approximately 16% on NVIDIA and 8% on Intel. NVIDIA's new process medians span 2.475–2.748 ms; Intel's span 5.107–5.133 ms. Decode remains 1.82×/1.50× llama.cpp. CPU/GPU clocks were not fixed.

This is one SmolLM2-135M sequence with 128-token prefill and 32 cached decode steps, including full-logit host copies, not batched-throughput evidence. Both sessions visit all seven eligible tuning classes, qualify all comparisons and finish within their existing budgets. All 18 saved logit sets are finite and retain 33/33 independent CPU-reference next-token choices; this is a fixed-token numerical check, not language-quality evidence.

Protocol, ranges, preparation times and limitations.

Verification

452 CPU tests pass. The full 22-test GGUF suite and 17-test GEMV group pass on both NVIDIA and Intel, including normalized tuning, both activations/storage types, source restaging, odd f16 dimensions and a wide-vocabulary grid. All-target/all-feature Clippy, formatting and rustdoc with warnings denied pass. No new test executable or relaxed tolerance. The known Naga Workgroup ArrayStride warning remains unchanged.

CI for the measured code: all six jobs passed, including Linux coverage, macOS, Windows and MSRV. Rust host line coverage is 83.6% overall (WGSL execution is not instrumented). The final follow-up is documentation only.

No raw data or binaries in Git. The submitted paper and frozen Inferena cohort are unchanged.

Rebased after #192 merged into main. The file tree is unchanged from the pre-rebase head; the measured revisions remain on experiment/llama-gemv-2026-09-19. Fresh post-rebase CI is running.

@kvark
kvark marked this pull request as ready for review September 19, 2026 21:24
@kvark
kvark force-pushed the perf/attention-autotune-2026-09-19 branch from 050f8a3 to 37a3e52 Compare September 19, 2026 22:04
@kvark
kvark force-pushed the perf/native-projection-fusion-2026-09-19 branch from 62cc50a to e21ed76 Compare September 19, 2026 22:04
@kvark
kvark merged commit 3ad9ae3 into perf/attention-autotune-2026-09-19 Sep 20, 2026
6 checks passed
@kvark
kvark deleted the perf/native-projection-fusion-2026-09-19 branch September 20, 2026 01:50
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