MCPcopy Create free account
hub / github.com/andrewkchan/deepseek.cpp / dequantize_row_q2_K

Function dequantize_row_q2_K

src/quant.cpp:217–247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215}
216
217void dequantize_row_q2_K(const block_q2_K * __restrict__ x, float * __restrict__ y, int64_t k) {
218 assert(k % QK_K == 0);
219 const int nb = k / QK_K;
220
221 for (int i = 0; i < nb; i++) {
222
223 const float d = half_to_float(x[i].d);
224 const float min = half_to_float(x[i].dmin);
225
226 const uint8_t * q = x[i].qs;
227
228 int is = 0;
229 float dl, ml;
230 for (int n = 0; n < QK_K; n += 128) {
231 int shift = 0;
232 for (int j = 0; j < 4; ++j) {
233
234 uint8_t sc = x[i].scales[is++];
235 dl = d * (sc & 0xF); ml = min * (sc >> 4);
236 for (int l = 0; l < 16; ++l) *y++ = dl * ((int8_t)((q[l] >> shift) & 3)) - ml;
237
238 sc = x[i].scales[is++];
239 dl = d * (sc & 0xF); ml = min * (sc >> 4);
240 for (int l = 0; l < 16; ++l) *y++ = dl * ((int8_t)((q[l+16] >> shift) & 3)) - ml;
241
242 shift += 2;
243 }
244 q += 32;
245 }
246 }
247}
248
249static float make_q3_quants(int n, int nmax, const float * __restrict__ x, int8_t * __restrict__ L, bool do_rmse) {
250 float max = 0;

Callers 1

_copy_embeddingMethod · 0.85

Calls 1

half_to_floatFunction · 0.85

Tested by

no test coverage detected