MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / ggml_quantize_q4_0

Function ggml_quantize_q4_0

ggml.c:19105–19126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19103////////////////////////////////////////////////////////////////////////////////
19104
19105size_t ggml_quantize_q4_0(const float * src, void * dst, int n, int k, int64_t * hist) {
19106 assert(k % QK4_0 == 0);
19107 const int nb = k / QK4_0;
19108
19109 for (int b = 0; b < n; b += k) {
19110 block_q4_0 * restrict y = (block_q4_0 *) dst + b/QK4_0;
19111
19112 quantize_row_q4_0_reference(src + b, y, k);
19113
19114 for (int i = 0; i < nb; i++) {
19115 for (int j = 0; j < QK4_0; j += 2) {
19116 const uint8_t vi0 = y[i].qs[j/2] & 0x0F;
19117 const uint8_t vi1 = y[i].qs[j/2] >> 4;
19118
19119 hist[vi0]++;
19120 hist[vi1]++;
19121 }
19122 }
19123 }
19124
19125 return (n/QK4_0*sizeof(block_q4_0));
19126}
19127
19128size_t ggml_quantize_q4_1(const float * src, void * dst, int n, int k, int64_t * hist) {
19129 assert(k % QK4_1 == 0);

Callers 2

ggml_quantize_chunkFunction · 0.85
clip_model_quantizeFunction · 0.85

Calls 1

Tested by

no test coverage detected