]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commit
cuda: optimize iq2xxs/iq2xs/iq3xxs dequantization (#19624)
authorDavid Friehs <redacted>
Sun, 15 Feb 2026 17:08:42 +0000 (18:08 +0100)
committerGitHub <redacted>
Sun, 15 Feb 2026 17:08:42 +0000 (22:38 +0530)
commit27b93cbd157fc4ad94573a1fbc226d3e18ea1bb4
tree429c8b67a3510c8260e3d7861740e405007044df
parent6e67fd2144e1647bf88b027c0807b5de35705acc
cuda: optimize iq2xxs/iq2xs/iq3xxs dequantization (#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