summaryrefslogtreecommitdiff
path: root/ggml/src/ggml-common.h
diff options
context:
space:
mode:
authorKawrakow <iwankawrakow@gmail.com>2024-12-10 18:13:47 +0100
committerGitHub <noreply@github.com>2024-12-10 18:13:47 +0100
commita63a96b5aea031f9dabf1e7c8d5ee28af170e9e7 (patch)
tree01e5c72689e8daa72a53bbe069c8669655187a34 /ggml/src/ggml-common.h
parentc819fa651beb20c559f692801819e0447d0ead85 (diff)
Q5_K_R4 (#132)
* q5_k_r4: WIP * q5_k_r4: Zen4 and AVX2 We get PP-512(LLaMA-3.1-8B) = 248.3 t/s on Zen4. Q5_K_S has PP-512 = 190 t/s. * q5_k_r4: NEON We get PP-512(LLaMA-3.1-8B) = 96.1 t/s. --------- Co-authored-by: Iwan Kawrakow <iwan.kawrakow@gmail.com>
Diffstat (limited to 'ggml/src/ggml-common.h')
-rw-r--r--ggml/src/ggml-common.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/ggml/src/ggml-common.h b/ggml/src/ggml-common.h
index 8ace3d6f..2d73d3f8 100644
--- a/ggml/src/ggml-common.h
+++ b/ggml/src/ggml-common.h
@@ -319,6 +319,15 @@ typedef struct {
} block_q5_K;
static_assert(sizeof(block_q5_K) == 2*sizeof(ggml_half) + K_SCALE_SIZE + QK_K/2 + QK_K/8, "wrong q5_K block size/padding");
+typedef struct {
+ ggml_half d[8];
+ uint8_t scales_h[QK_K/16];// scales and mins, quantized with 6 bits
+ uint8_t scales_l[QK_K/8]; // scales and mins, quantized with 6 bits
+ uint8_t qh[QK_K/2]; // quants, high bit
+ uint8_t qs[QK_K*2]; // quants, low 4 bits
+} block_q5_k_r4;
+static_assert(sizeof(block_q5_k_r4) == 8*sizeof(ggml_half) + QK_K/16 + QK_K/8 + QK_K/2 + QK_K*2, "wrong q5_k_r4 block size/padding");
+
// 6-bit quantization
// weight is represented as x = a * q
// 16 blocks of 16 elements each