MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / quantize_q4_0

Function quantize_q4_0

subprojects/llama.cpp/ggml/src/ggml-quants.c:1921–1934  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1919}
1920
1921size_t quantize_q4_0(const float * GGML_RESTRICT src, void * GGML_RESTRICT dst, int64_t nrow, int64_t n_per_row, const float * quant_weights) {
1922 if (!quant_weights) {
1923 quantize_row_q4_0_ref(src, dst, (int64_t)nrow*n_per_row);
1924 return nrow * ggml_row_size(GGML_TYPE_Q4_0, n_per_row);
1925 }
1926 size_t row_size = ggml_row_size(GGML_TYPE_Q4_0, n_per_row);
1927 char * qrow = (char *)dst;
1928 for (int64_t row = 0; row < nrow; ++row) {
1929 quantize_row_q4_0_impl(src, (block_q4_0*)qrow, n_per_row, quant_weights);
1930 src += n_per_row;
1931 qrow += row_size;
1932 }
1933 return nrow * row_size;
1934}
1935
1936static void quantize_row_q4_1_impl(const float * GGML_RESTRICT x, block_q4_1 * GGML_RESTRICT y, int64_t n_per_row, const float * quant_weights) {
1937 static_assert(QK4_1 == 32, "QK4_1 must be 32");

Callers 1

ggml_quantize_chunkFunction · 0.85

Calls 3

quantize_row_q4_0_refFunction · 0.85
ggml_row_sizeFunction · 0.85
quantize_row_q4_0_implFunction · 0.85

Tested by

no test coverage detected