mirror of
https://github.com/ikawrakow/ik_llama.cpp.git
synced 2026-02-23 22:54:10 +00:00
sanitize imatrix: iq4_ks
This commit is contained in:
@@ -4047,18 +4047,16 @@ void quantize_row_iq4_ks(const float * x, void * y, int64_t k) {
|
||||
}
|
||||
|
||||
size_t quantize_iq4_ks(const float * src, void * dst, int64_t nrows, int64_t n_per_row, const float * imatrix) {
|
||||
//printf("============ %s(%d, %d)\n", __func__, int(nrows), int(n_per_row));
|
||||
constexpr int kBlockSize = 32; //128;
|
||||
constexpr int kBlockSize = 32;
|
||||
GGML_ASSERT(n_per_row%QK_K == 0);
|
||||
auto row_size = ggml_row_size(GGML_TYPE_IQ4_KS, n_per_row);
|
||||
char * qrow = (char *)dst;
|
||||
float weight[kBlockSize];
|
||||
std::vector<float> all_scales(n_per_row/kBlockSize);
|
||||
for (int64_t row = 0; row < nrows; ++row) {
|
||||
quantize_row_iq4_k_impl_bs128(QK_K, kBlockSize, n_per_row, src, qrow, all_scales.data(), weight, iq4k_values, imatrix, 7);
|
||||
src += n_per_row;
|
||||
qrow += row_size;
|
||||
}
|
||||
QHelper helper(imatrix, n_per_row, kBlockSize);
|
||||
auto q_func = [&all_scales, &weight, block_size = kBlockSize] (const float * x, void * vy, int n_per_row, const float * imatrix) {
|
||||
quantize_row_iq4_k_impl_bs128(QK_K, block_size, n_per_row, x, (char *)vy, all_scales.data(), weight, iq4k_values, imatrix, 7);
|
||||
};
|
||||
helper.quantize(nrows, src, dst, row_size, q_func);
|
||||
return nrows * row_size;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user