ik_llama_opt/ggml-cuda
Kawrakow 2881bdf220 iq1bn(no lookup): better version
We have 4 groups of 16 in a block of 64 quants.
For each group of 16 we have 3 groups of 5, each using 8 bits.
The remaining 16'th quants of the 4 groups of 16 are encoded
with 8 bits using the same encoding as the groups of 5.
The only kernel where we have complications is the CUDA dequantize
kernel (because we are dequantizing 8 quants there, and we have
different encoding for the 1st and 2nd group of 8 in a group of 16).

Ths achieves better performance on all tested platforms than
any previous 1.625 bpw attempt. We have:

| model            |       size |     params | backend    | threads |          test |              t/s |
| ---------------- | ---------: | ---------: | ---------- | ------: | ------------: | ---------------: |
| 1.625 bpw Bitnet | 729.64 MiB |     3.32 B | CUDA       |       8 |         pp512 |  9613.02 ± 24.54 |
| 1.625 bpw Bitnet | 729.64 MiB |     3.32 B | CUDA       |       8 |         tg128 |    229.85 ± 0.33 |

| 1.625 bpw Bitnet | 729.64 MiB |     3.32 B | AVX2       |      16 |         pp512 |    322.59 ± 1.00 |
| 1.625 bpw Bitnet | 729.64 MiB |     3.32 B | AVX2       |      16 |         tg128 |     59.79 ± 0.03 |
| 1.625 bpw Bitnet | 729.64 MiB |     3.32 B | AVX2       |       8 |         tg128 |     57.62 ± 0.21 |
| 1.625 bpw Bitnet | 729.64 MiB |     3.32 B | AVX2       |       4 |         tg128 |     33.66 ± 0.29 |
| 1.625 bpw Bitnet | 729.64 MiB |     3.32 B | AVX2       |       2 |         tg128 |     18.30 ± 0.01 |

| 1.625 bpw Bitnet | 729.64 MiB |     3.32 B | Metal      |       8 |         pp512 |    698.13 ± 0.21 |
| 1.625 bpw Bitnet | 729.64 MiB |     3.32 B | Metal      |       8 |         tg128 |     68.88 ± 0.24 |

| 1.625 bpw Bitnet | 729.64 MiB |     3.32 B | NEON       |       8 |         pp512 |    196.80 ± 0.50 |
| 1.625 bpw Bitnet | 729.64 MiB |     3.32 B | NEON       |       8 |         tg128 |     51.58 ± 0.41 |
| 1.625 bpw Bitnet | 729.64 MiB |     3.32 B | NEON       |       4 |         tg128 |     30.80 ± 0.03 |
| 1.625 bpw Bitnet | 729.64 MiB |     3.32 B | NEON       |       2 |         tg128 |     16.89 ± 0.01 |

It is still slower than 2 bpw Bitnet, but the difference now is not as
dramatic.
2024-07-17 08:54:11 +03:00
..
template-instances CUDA: refactor mmq, dmmv, mmvq (#7716) 2024-06-05 16:53:00 +02:00
acc.cu cuda : refactor into multiple files (#6269) 2024-03-25 13:50:23 +01:00
acc.cuh cuda : refactor into multiple files (#6269) 2024-03-25 13:50:23 +01:00
arange.cu cuda : refactor into multiple files (#6269) 2024-03-25 13:50:23 +01:00
arange.cuh cuda : refactor into multiple files (#6269) 2024-03-25 13:50:23 +01:00
argsort.cu CUDA: faster q2_K, q3_K MMQ + int8 tensor cores (#7921) 2024-06-14 18:41:49 +02:00
argsort.cuh cuda : refactor into multiple files (#6269) 2024-03-25 13:50:23 +01:00
binbcast.cu bitnet(scale in a separate tensor): mul -> scale on CUDA 2024-06-22 12:02:52 +03:00
binbcast.cuh cuda : refactor into multiple files (#6269) 2024-03-25 13:50:23 +01:00
clamp.cu Introduction of CUDA Graphs to LLama.cpp (#6766) 2024-05-08 22:55:49 +02:00
clamp.cuh cuda : refactor into multiple files (#6269) 2024-03-25 13:50:23 +01:00
common.cuh Bitnet(1.75 bpw): higher precision fp8 scale 2024-06-22 12:02:52 +03:00
concat.cu cuda : non-cont concat support (#7610) 2024-05-29 15:38:26 +03:00
concat.cuh cuda : refactor into multiple files (#6269) 2024-03-25 13:50:23 +01:00
convert.cu iq1bn(no lookup): better version 2024-07-17 08:54:11 +03:00
convert.cuh llama : add Command R Plus support (#6491) 2024-04-09 11:16:13 +03:00
cpy.cu Introduction of CUDA Graphs to LLama.cpp (#6766) 2024-05-08 22:55:49 +02:00
cpy.cuh Introduction of CUDA Graphs to LLama.cpp (#6766) 2024-05-08 22:55:49 +02:00
dequantize.cuh llama : add Command R Plus support (#6491) 2024-04-09 11:16:13 +03:00
diagmask.cu cuda : refactor into multiple files (#6269) 2024-03-25 13:50:23 +01:00
diagmask.cuh cuda : refactor into multiple files (#6269) 2024-03-25 13:50:23 +01:00
dmmv.cu CUDA: refactor mmq, dmmv, mmvq (#7716) 2024-06-05 16:53:00 +02:00
dmmv.cuh sync : ggml (#6351) 2024-03-29 17:45:46 +02:00
fattn-common.cuh CUDA: use tensor cores for MMQ (#7676) 2024-06-10 11:45:13 +02:00
fattn-tile-f16.cu CUDA: use tensor cores for MMQ (#7676) 2024-06-10 11:45:13 +02:00
fattn-tile-f16.cuh CUDA: faster large batch FA without tensor cores (#7314) 2024-05-17 18:54:52 +02:00
fattn-tile-f32.cu CUDA: fix Pascal FA, deq. KV to FP16 for batch > 8 (#7681) 2024-06-01 15:47:04 +02:00
fattn-tile-f32.cuh CUDA: faster large batch FA without tensor cores (#7314) 2024-05-17 18:54:52 +02:00
fattn-vec-f16.cuh CUDA: use tensor cores for MMQ (#7676) 2024-06-10 11:45:13 +02:00
fattn-vec-f32.cuh CUDA: fix broken oob check for FA vec f32 kernel (#7904) 2024-06-12 17:41:51 +02:00
fattn-wmma-f16.cuh CUDA: use tensor cores for MMQ (#7676) 2024-06-10 11:45:13 +02:00
fattn.cu CUDA: fix Pascal FA, deq. KV to FP16 for batch > 8 (#7681) 2024-06-01 15:47:04 +02:00
fattn.cuh ggml : add Flash Attention (#5021) 2024-04-30 12:16:08 +03:00
getrows.cu cuda : refactor into multiple files (#6269) 2024-03-25 13:50:23 +01:00
getrows.cuh cuda : refactor into multiple files (#6269) 2024-03-25 13:50:23 +01:00
im2col.cu cuda : refactor into multiple files (#6269) 2024-03-25 13:50:23 +01:00
im2col.cuh cuda : refactor into multiple files (#6269) 2024-03-25 13:50:23 +01:00
mma.cuh CUDA: int8 tensor cores for MMQ (q4_K, q5_K, q6_K) (#7860) 2024-06-11 08:26:07 +02:00
mmq.cu CUDA: stream-k decomposition for MMQ (#8018) 2024-06-20 14:39:21 +02:00
mmq.cuh CUDA: stream-k decomposition for MMQ (#8018) 2024-06-20 14:39:21 +02:00
mmvq.cu Bitnet(2.25 bpw): CUDA 2024-06-22 12:02:52 +03:00
mmvq.cuh cuda : refactor into multiple files (#6269) 2024-03-25 13:50:23 +01:00
norm.cu ggml : fix YARN + add tests + add asserts (#7617) 2024-05-29 20:17:31 +03:00
norm.cuh cuda : refactor into multiple files (#6269) 2024-03-25 13:50:23 +01:00
pad.cu cuda : refactor into multiple files (#6269) 2024-03-25 13:50:23 +01:00
pad.cuh cuda : refactor into multiple files (#6269) 2024-03-25 13:50:23 +01:00
pool2d.cu cuda : refactor into multiple files (#6269) 2024-03-25 13:50:23 +01:00
pool2d.cuh cuda : refactor into multiple files (#6269) 2024-03-25 13:50:23 +01:00
quantize.cu CUDA: revise q8_1 data layout for mul_mat_q (#7824) 2024-06-09 09:42:25 +02:00
quantize.cuh CUDA: revise q8_1 data layout for mul_mat_q (#7824) 2024-06-09 09:42:25 +02:00
rope.cu ggml : refactor rope norm/neox (#7634) 2024-06-05 11:29:20 +03:00
rope.cuh cuda : refactor into multiple files (#6269) 2024-03-25 13:50:23 +01:00
scale.cu Introduction of CUDA Graphs to LLama.cpp (#6766) 2024-05-08 22:55:49 +02:00
scale.cuh cuda : refactor into multiple files (#6269) 2024-03-25 13:50:23 +01:00
softmax.cu CUDA: faster q2_K, q3_K MMQ + int8 tensor cores (#7921) 2024-06-14 18:41:49 +02:00
softmax.cuh cuda : refactor into multiple files (#6269) 2024-03-25 13:50:23 +01:00
sumrows.cu cuda : refactor into multiple files (#6269) 2024-03-25 13:50:23 +01:00
sumrows.cuh cuda : refactor into multiple files (#6269) 2024-03-25 13:50:23 +01:00
tsembd.cu cuda : refactor into multiple files (#6269) 2024-03-25 13:50:23 +01:00
tsembd.cuh cuda : refactor into multiple files (#6269) 2024-03-25 13:50:23 +01:00
unary.cu Add support for sqrt on CUDA (#7953) 2024-06-17 00:23:04 +02:00
unary.cuh Add support for sqrt on CUDA (#7953) 2024-06-17 00:23:04 +02:00
upscale.cu ggml : add `ggml_upscale_ext` (ggml/814) 2024-05-15 13:23:33 +03:00
upscale.cuh cuda : refactor into multiple files (#6269) 2024-03-25 13:50:23 +01:00
vecdotq.cuh iq1bn(no lookup): better version 2024-07-17 08:54:11 +03:00