summaryrefslogtreecommitdiff
path: root/ggml/src/ggml-common.h
diff options
context:
space:
mode:
authorKawrakow <iwankawrakow@gmail.com>2024-12-03 12:59:22 +0100
committerGitHub <noreply@github.com>2024-12-03 12:59:22 +0100
commitc5bf589367cd609f4c0ff73a6534bbde7902abe8 (patch)
treefa17f82c717d535222c1843fc9fca2d66f4d6ea7 /ggml/src/ggml-common.h
parentccec00939a30aa7762a232ac4dcadba985ef9ee4 (diff)
Q5_0_R4 (#121)
* Adding q5_0_r4 We get PP-512(LLaMA-3.1-8B) = 256.7 t/s on a Ryzen-7950X. We even get TG-128 improvement to 11.7 t/s from 11.1 t/s. * q5_0_r4: NEON We get PP-512(LLaMA-3.1-8B) = 99.6 t/s on M2-Max, up from 71.0 t/s for Q5_0. The difference to mainline llama.cpp is no longer funny: they get 26.5 t/s for Q5_0. For TG, we are nor able to fully saturate memory bandwidth and arrive at 22.1 t/s @ 8 threads. Mainline llama.cpp gets 20.6 t/s for Q5_0. --------- Co-authored-by: Iwan Kawrakow <iwan.kawrakow@gmail.com>
Diffstat (limited to 'ggml/src/ggml-common.h')
-rw-r--r--ggml/src/ggml-common.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/ggml/src/ggml-common.h b/ggml/src/ggml-common.h
index 2af3323d..fb87a602 100644
--- a/ggml/src/ggml-common.h
+++ b/ggml/src/ggml-common.h
@@ -182,6 +182,13 @@ typedef struct {
} block_q5_0;
static_assert(sizeof(block_q5_0) == sizeof(ggml_half) + sizeof(uint32_t) + QK5_0 / 2, "wrong q5_0 block size/padding");
+typedef struct {
+ ggml_half d[4]; // delta
+ uint8_t qh[QK5_0/2]; // 5-th bit of quants
+ uint8_t qs[QK5_0*2]; // nibbles / quants
+} block_q5_0_r4;
+static_assert(sizeof(block_q5_0_r4) == 4*sizeof(ggml_half) + QK5_0*2 + QK5_0/2, "wrong q5_0_r4 block size/padding");
+
#define QK5_1 32
typedef struct {
GGML_SCALE_TYPE1(m, dm);
@@ -198,6 +205,13 @@ typedef struct {
} block_q6_0;
static_assert(sizeof(block_q6_0) == sizeof(ggml_half) + QK6_0/2 + QK6_0/4, "wrong q6_0 block size/padding");
+typedef struct {
+ ggml_half d[4]; // delta
+ uint8_t qh[QK6_0]; // 5+6-th bit of quants
+ uint8_t qs[QK6_0*2]; // nibbles / quants
+} block_q6_0_r4;
+static_assert(sizeof(block_q6_0_r4) == 4*sizeof(ggml_half) + QK6_0*2 + QK6_0, "wrong q6_0_r4 block size/padding");
+
#define QK8_0 32
typedef struct {
ggml_half d; // delta