MCPcopy Create free account
hub / github.com/Niko1221/Strata / dequant_q2_K

Function dequant_q2_K

engine/src/quant/dequant.cpp:200–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198}
199
200void dequant_q2_K(const block_q2_K* STRATA_RESTRICT x, float* STRATA_RESTRICT y, int64_t k) {
201 assert(k % QK_K == 0);
202 const int nb = k / QK_K;
203
204 for (int i = 0; i < nb; i++) {
205
206 const float d = fp16_to_fp32(x[i].d);
207 const float min = fp16_to_fp32(x[i].dmin);
208
209 const uint8_t * q = x[i].qs;
210
211 int is = 0;
212 float dl, ml;
213 for (int n = 0; n < QK_K; n += 128) {
214 int shift = 0;
215 for (int j = 0; j < 4; ++j) {
216
217 uint8_t sc = x[i].scales[is++];
218 dl = d * (sc & 0xF); ml = min * (sc >> 4);
219 for (int l = 0; l < 16; ++l) *y++ = dl * ((int8_t)((q[l] >> shift) & 3)) - ml;
220
221 sc = x[i].scales[is++];
222 dl = d * (sc & 0xF); ml = min * (sc >> 4);
223 for (int l = 0; l < 16; ++l) *y++ = dl * ((int8_t)((q[l+16] >> shift) & 3)) - ml;
224
225 shift += 2;
226 }
227 q += 32;
228 }
229 }
230}
231
232void dequant_q3_K(const block_q3_K* STRATA_RESTRICT x, float* STRATA_RESTRICT y, int64_t k) {
233 assert(k % QK_K == 0);

Callers 1

dequant_rowFunction · 0.85

Calls 1

fp16_to_fp32Function · 0.70

Tested by

no test coverage detected