17 for (
size_t b = 0; b < blocks; ++b) {
20 int32_t weighted[8] = {0};
21 for (
unsigned g = 0; g <
QK_K / 16; ++g) {
22 const unsigned lo = (w->
scales[g % 8] >> (4 * (g / 8))) & 15;
23 const unsigned hi = (w->
scales[8 + g % 4] >> (2 * (g / 4))) & 3;
24 const int scale = (int)(lo | (hi << 4)) - 32;
25 const unsigned base = (g % 2) * 16;
26 const unsigned mask = 1u << (g / 2);
27 const unsigned shift = 2 * ((g / 2) % 4);
28 for (
unsigned j = 0; j < 16; ++j) {
29 const int q = (w->
low[32 * (g / 8) + base + j] >> shift) & 3;
30 const int signed_q = q - ((w->
high[base + j] &
mask) ? 0 : 4);
31 weighted[j % 8] += scale * signed_q * x->
qs[g * 16 + j];
35 for (
unsigned i = 0; i < 8; ++i) {
36 const volatile float contribution = d * (float)weighted[i];
37 sums[i] += contribution;
41 for (
unsigned i = 0; i < 8; ++i) result += sums[i];