]> git.djapps.eu Git - pkg/ggml/sources/ggml/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>
Wed, 25 Feb 2026 10:32:13 +0000 (12:32 +0200)
commit8b1828c6dfdbf169c471887cbbd3294143979cab
tree6c28f26e07fc502047d34396873458c96321803c
parenta91d90f9a408b72ba3b8f3a9d6306c0e9923700c
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
src/ggml-cuda/mmq.cuh
src/ggml-cuda/vecdotq.cuh