Skip to content

b13018

Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 05 Dec 18:08
c053e54

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:

Linux:

Android:

Windows:

openEuler:

  • DISABLED
  • openEuler x86 (310p)
  • openEuler x86 (910b, ACL Graph)
  • openEuler aarch64 (310p)
  • openEuler aarch64 (910b, ACL Graph)

UI: