From deb55fff63b33f5e0c9bcf991fc94a49d0c25bec Mon Sep 17 00:00:00 2001 From: Iwan Kawrakow Date: Wed, 27 Aug 2025 14:55:26 +0300 Subject: [PATCH] sanitize imatrix: q6_0_r4 --- ggml/src/iqk/iqk_quantize.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ggml/src/iqk/iqk_quantize.cpp b/ggml/src/iqk/iqk_quantize.cpp index 750ecccf..2bbe6b53 100644 --- a/ggml/src/iqk/iqk_quantize.cpp +++ b/ggml/src/iqk/iqk_quantize.cpp @@ -5152,8 +5152,12 @@ size_t quantize_q6_0_r4(const float * src, void * dst, int64_t nrows, int64_t n_ auto row_size_0 = ggml_row_size(GGML_TYPE_Q6_0, n_per_row); std::vector qtmp(4*row_size_0); char * qrow = (char *)dst; + QHelper helper(imatrix, n_per_row, 32); + auto q_func = [] (const float * x, void * vy, int n_per_row, const float * imatrix) { + quantize_q6_0(x, (char *)vy, 1, n_per_row, imatrix); + }; for (int row = 0; row < nrows; row += 4) { - quantize_q6_0(src, qtmp.data(), 4, n_per_row, imatrix); + helper.quantize(4, src, qtmp.data(), row_size_0, q_func); repack_q6_0(4, n_per_row, (const block_q6_0 *)qtmp.data(), (block_q6_0_r4 *)qrow, false); src += 4*n_per_row; qrow += 4*row_size_0;