diff options
author | Kawrakow <iwankawrakow@gmail.com> | 2025-06-13 07:58:15 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-13 07:58:15 +0300 |
commit | 066ed4fd1158ddaab0080ef0e77bd5b7e12ec114 (patch) | |
tree | 42707c91f1e27486ffe2e3b4dc974c6694760263 /ggml/src/ggml.c | |
parent | f72983f7fe16f02cda4af40172b87ff721920b46 (diff) |
Faster CPU prompt processing for Q4_K and Q5_K (#525)
* q4_K: dequantize to q8_1_r8 for batch >= 32
We get 268 t/s, up from 186 t/s.
* q4_K: GEMM with q8_2_X4
* q5_K: GEMM with q8_2_X4 and repack to q8_1_r8
* Remove the scales, they are not needed
---------
Co-authored-by: Iwan Kawrakow <iwan.kawrakow@gmail.com>
Diffstat (limited to 'ggml/src/ggml.c')
-rw-r--r-- | ggml/src/ggml.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ggml/src/ggml.c b/ggml/src/ggml.c index 3953cd7d..069533ae 100644 --- a/ggml/src/ggml.c +++ b/ggml/src/ggml.c @@ -976,7 +976,11 @@ static const ggml_type_traits_t type_traits[GGML_TYPE_COUNT] = { .from_float = quantize_row_q4_K, .from_float_ref = (ggml_from_float_t) quantize_row_q4_K_ref, .vec_dot = ggml_vec_dot_q4_K_q8_K, +#ifdef __AVX2__ + .vec_dot_type = GGML_TYPE_Q8_2_X4, +#else .vec_dot_type = GGML_TYPE_Q8_K, +#endif .nrows = 1, .row_meta_size = 0, }, @@ -1002,7 +1006,11 @@ static const ggml_type_traits_t type_traits[GGML_TYPE_COUNT] = { .from_float = quantize_row_q5_K, .from_float_ref = (ggml_from_float_t) quantize_row_q5_K_ref, .vec_dot = ggml_vec_dot_q5_K_q8_K, +#ifdef __AVX2__ + .vec_dot_type = GGML_TYPE_Q8_2_X4, +#else .vec_dot_type = GGML_TYPE_Q8_K, +#endif .nrows = 1, .row_meta_size = 0, }, |