Details
ggml-cpu: add SVE implementation of ggml_gemv_q5_K_8x8_q8_K (#31736)
- ggml-cpu: add SVE implementation of ggml_gemv_q5_K_8x8_q8_K
Add a 256-bit SVE path for the Q5_Kx8 repacked gemv, used when
ggml_cpu_get_sve_cnt() == QK8_0 and SVE I8MM is available (the repacked
Q5_K dispatch already requires i8mm); other vector lengths fall through
to the existing NEON code.
- One 32-byte vector covers 4 interleaved columns; low and high nibbles
are dotted with svdot against the q8 chunk broadcast 8 bytes at a time. - The 5th bit is kept out of the weights: the masked high bits
(qh & (1 << bit)) are dotted with svusdot into separate accumulators,
which equal 2^bit * dot(hbit, q8), and a per-sub-block shift by
(4 - bit) recovers the 16 * dot(hbit, q8) term exactly. - uzp1/uzp2 across the two 4-column halves reduces the dot pairs and
merges all 8 columns in one step; d/dmin, bsums, 6-bit scales and mins
are applied with SVE vector ops.
Single-thread kernel is ~1.7-1.8x faster than NEON on Graviton3
(VL=256); llama-bench tg128 on Llama-3.1-8B Q5_K_S is 1.5-1.6x at 4-8
threads. Results match the generic implementation (NRMSE <= 5.4e-7).
- ggml-cpu: apply Q5_K SVE gemv scales and mins once per block
Accumulate the scaled int32 sums and the min bias across the four
sub-blocks and convert/apply them with a single fmla/fmls per block,
instead of one int->float convert plus fmla/fmls per sub-block. This
removes 6 converts and 6 float FMAs per block, and the integer part
stays exact until the block end, matching the generic implementation.
Single-thread kernel is 2.5-3.5% faster on Graviton3; token generation
is unchanged (the gemv is memory-bound at decode).
Website:
Attestations:
macOS/iOS:
- macOS Apple Silicon (arm64)
- macOS Apple Silicon (arm64, KleidiAI enabled) DISABLED
- macOS Intel (x64)
- iOS XCFramework
Linux:
- Ubuntu x64 (CPU)
- Ubuntu arm64 (CPU)
- Ubuntu 24.04 s390x (CPU)
- Ubuntu 26.04 s390x (CPU)
- Ubuntu 26.04 s390x (zDNN)
- Ubuntu x64 (Vulkan)
- Ubuntu arm64 (Vulkan)
- Ubuntu x64 (CUDA 12) - CUDA 12.8 libraries
- Ubuntu x64 (CUDA 13) - CUDA 13.5 libraries
- Ubuntu arm64 (CUDA 13) - CUDA 13.5 libraries
- Ubuntu x64 (ROCm 10.0)
- Ubuntu x64 (OpenVINO)
- Ubuntu x64 (SYCL FP32)
- Ubuntu x64 (SYCL FP16)
- Linux arm64 (Snapdragon: CPU, Adreno GPU, Hexagon NPU) - setup guide
Android:
Windows:
- Windows x64 (CPU)
- Windows arm64 (CPU)
- Windows arm64 (OpenCL Adreno)
- Windows x64 (CUDA 12) - CUDA 12.4 DLLs
- Windows x64 (CUDA 13) - CUDA 13.5 DLLs
- Windows arm64 (CUDA 13) - CUDA 13.5 DLLs
- Windows x64 (Vulkan)
- Windows arm64 (Vulkan)
- Windows x64 (OpenVINO)
- Windows x64 (SYCL)
- Windows x64 (ROCm 10.0)
openEuler:
- DISABLED
- openEuler x86 (310p)
- openEuler x86 (910b, ACL Graph)
- openEuler aarch64 (310p)
- openEuler aarch64 (910b, ACL Graph)
UI: