| 19103 | //////////////////////////////////////////////////////////////////////////////// |
| 19104 | |
| 19105 | size_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 | |
| 19128 | size_t ggml_quantize_q4_1(const float * src, void * dst, int n, int k, int64_t * hist) { |
| 19129 | assert(k % QK4_1 == 0); |
no test coverage detected