From 7f61b3068e18728e5e7e2b95546ff03dd2fd41ac Mon Sep 17 00:00:00 2001 From: Kawrakow Date: Thu, 6 Feb 2025 14:08:52 +0200 Subject: IQ1_M_R4: better 1.75 bpw quants (#187) * iq1_m_r4: basics (quantize/dequantize) * iq1_m_r4: Zen4 gemm * iq1_m_r4: neon gemm * iq1_m_r4: switch to q8_0_x4 also on AVX2/Zen4 With the deltas being per group of 8, we cannot make use of the q8 sums stored in q8_1, so we get a tiny gain by using q8_0_x4. * iq1_m_r4: rename mul_mat_iq1_m_r4_q8_1 to mul_mat_iq1_m_r4_q8_0 --------- Co-authored-by: Iwan Kawrakow --- ggml/src/ggml-common.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ggml/src/ggml-common.h') diff --git a/ggml/src/ggml-common.h b/ggml/src/ggml-common.h index 14813161..679353be 100644 --- a/ggml/src/ggml-common.h +++ b/ggml/src/ggml-common.h @@ -499,6 +499,14 @@ typedef struct { } block_iq1_m; static_assert(sizeof(block_iq1_m) == QK_K/8 + QK_K/16 + QK_K/32, "wrong iq1_m block size/padding"); +// 1.75 bpw - blocks of 32 with 4 interleaved rows = 128 quants +typedef struct { + uint8_t qs[16]; // grid index, low 8 bits + uint8_t qh[ 8]; // grid index, high 3 bits + grid shift bits (for two groups of 8) + uint8_t scales[4]; // 4-bit block scales +} block_iq1_m_r4; +static_assert(sizeof(block_iq1_m_r4) == 28, "wrong iq1_m_r4 block size/padding"); + // // Bitnet and TriLM - implemented as 1.625 bpw // -- cgit v1.2.3