]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commit
cuda: optimize iq2xxs/iq2xs/iq3xxs dequantization (llama/19624)
authorDavid Friehs <redacted>
Sun, 15 Feb 2026 17:08:42 +0000 (18:08 +0100)
committerGeorgi Gerganov <redacted>
Fri, 27 Feb 2026 18:57:58 +0000 (20:57 +0200)
commit02a9f660b8e05d0fd5afae17c0316f16df667a81
treecbc360eb593fff15e1e557ae7bbccd80e649ae73
parentdf2f8d3bc44015e1cf174b61accfea4a564ddd6d
cuda: optimize iq2xxs/iq2xs/iq3xxs dequantization (llama/19624)

* cuda: optimize iq2xxs/iq2xs/iq3xxs dequantization

- load all 8 int8 for a grid position in one load
- calculate signs via popcnt instead of fetching from ksigns table
- broadcast signs to drop individual shift/mask

* cuda: iq2xxs: simplify sum scaling

express `(sum * scale + sum / 2) / 4` as `(sum * (scale * 2 + 1)) / 8`
express `((aux32 >> 28) * 2 + 1)` as `(aux32 >> 27 | 1)`

saves 3 registers for mul_mat_vec_q (152 -> 149) according to nsight
AFAICT no overflow can occur here as iq2xxs values are far too small

* uint -> uint32_t

error: identifier "uint" is undefined
ggml/src/ggml-cuda/mmq.cuh
ggml/src/ggml-cuda/vecdotq.cuh