b70-optimization-lab

Q4_0 RMS_NORM + Scale-MUL Fusion

Date: 2026-05-06

Goal

Reduce per-token launch and memory traffic in Qwen3.6 27B Q4_0 GGUF without changing model weights, quantization, KV dtype, sampling, speculative decoding, or GPU power settings.

Patch

Added an opt-in SYCL graph fusion behind GGML_SYCL_FUSE_RMS_NORM_MUL=1.

The matcher only accepts F32 RMS_NORM -> MUL where the other MUL input is a contiguous 1D F32 scale tensor on the same non-split SYCL device buffer. It is disabled when explicit op stats are enabled.

Patch artifact: patches/llama-cpp-sycl-rmsnormmul-current-20260506.patch.gz.b64.

Correctness

Greedy llama-completion output matched byte-for-byte with the RMS fusion off and on, with fused MMVQ2 and fused SwiGLU enabled on both sides.

Results

Single B70, SYCL2, 512 prompt / 512 output:

Two B70s, SYCL2/SYCL1, tensor split 1/1, -ub 128, 512 prompt / 512 output:

Three B70s, SYCL2/SYCL1/SYCL3, tensor split 1/1/1, -ub 128, 512 prompt / 512 output:

Four B70 assist split, selector 2,1,3,0, tensor split 1/1/1/0.05:

Interpretation

This is a quality-preserving launch reduction that helps every valid Q4_0 shape tested. The biggest gain is in the 3-B70 tensor split path, where the Q4_0 GGUF result now nearly matches the current static FP8 TP4+n-gram result while keeping the original GGUF target.

The single-B70 result still does not reach the Windows Q4_0 target, so the next software target should be a larger fused projection path, especially fused output-projection plus allreduce/residual epilogues or a broader same-activation GEMV group.