| 23 | } |
| 24 | |
| 25 | void dequant_q2_0(const block_q2_0* STRATA_RESTRICT x, float* STRATA_RESTRICT y, int64_t k) { |
| 26 | static const int qk = QK2_0; |
| 27 | |
| 28 | assert(k % qk == 0); |
| 29 | |
| 30 | const int nb = k / qk; |
| 31 | |
| 32 | for (int i = 0; i < nb; i++) { |
| 33 | const float d = fp16_to_fp32(x[i].d); |
| 34 | |
| 35 | for (int j = 0; j < qk; ++j) { |
| 36 | const int byte_index = j / 4; |
| 37 | const int bit_offset = (j % 4) * 2; |
| 38 | const uint8_t q = (x[i].qs[byte_index] >> bit_offset) & 0x03; |
| 39 | // 00=-1, 01=0, 10=+1, 11=+2 |
| 40 | y[i*qk + j] = ((int)q - 1) * d; |
| 41 | } |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | void dequant_q4_0(const block_q4_0* STRATA_RESTRICT x, float* STRATA_RESTRICT y, int64_t k) { |
| 46 | static const int qk = QK4_0; |
no test coverage detected