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

Function ggml_quantize_q4_1

ggml.c:19128–19149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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);
19130 const int nb = k / QK4_1;
19131
19132 for (int b = 0; b < n; b += k) {
19133 block_q4_1 * restrict y = (block_q4_1 *) dst + b/QK4_1;
19134
19135 quantize_row_q4_1_reference(src + b, y, k);
19136
19137 for (int i = 0; i < nb; i++) {
19138 for (int j = 0; j < QK4_1; j += 2) {
19139 const uint8_t vi0 = y[i].qs[j/2] & 0x0F;
19140 const uint8_t vi1 = y[i].qs[j/2] >> 4;
19141
19142 hist[vi0]++;
19143 hist[vi1]++;
19144 }
19145 }
19146 }
19147
19148 return (n/QK4_1*sizeof(block_q4_1));
19149}
19150
19151size_t ggml_quantize_q5_0(const float * src, void * dst, int n, int k, int64_t * hist) {
19152 assert(k % QK5_0 == 0);

Callers 2

ggml_quantize_chunkFunction · 0.85
clip_model_quantizeFunction · 0.85

Calls 1

Tested by

no test coverage detected