summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIwan Kawrakow <iwan.kawrakow@gmail.com>2024-06-16 17:27:18 +0300
committerIwan Kawrakow <iwan.kawrakow@gmail.com>2024-06-22 12:02:51 +0300
commit4fcfcd05d1b2b01b2f2224406d96a6ea9831ddcb (patch)
treec2203ebbb4ba6ef3f301537aa1b61f8dbb84531c
parent7f8901dca1296651ea3b20ac71f793c77495e294 (diff)
bitnet: scale is per row, not per tensor
-rw-r--r--ggml-quants.c2
-rw-r--r--iqk_mul_mat.cpp4
2 files changed, 3 insertions, 3 deletions
diff --git a/ggml-quants.c b/ggml-quants.c
index 552d6198..fc3155ef 100644
--- a/ggml-quants.c
+++ b/ggml-quants.c
@@ -3731,7 +3731,7 @@ void quantize_row_q8_K64_reference(const float * restrict x, block_q8_K64 * rest
for (int j = 0; j < 64; ++j) {
float ax = fabsf(x[j]);
if (ax > amax) {
- amax = ax; max = x[j];
+ amax = ax; max = x[j];
}
}
if (!amax) {
diff --git a/iqk_mul_mat.cpp b/iqk_mul_mat.cpp
index fa1a0c83..ed8ed2e8 100644
--- a/iqk_mul_mat.cpp
+++ b/iqk_mul_mat.cpp
@@ -1347,12 +1347,12 @@ static void mul_mat_iq1bn_q8_K64(int n, const void * vx, size_t bx, const DataIn
typedef union { float f; uint32_t i; } scale_t;
scale_t scale;
- uint16_t u = x[0].extra & 0xff;
- scale.i = ((((u >> 4) | 0xf0) - 132) << 23) | ((u & 0x0f) << 19);
for (int ix = 0; ix < nrc_x; ++ix) {
x = (const block_iq1_bn *)((const char *)vx + ix*bx);
+ uint16_t u = x[0].extra & 0xff;
+ scale.i = ((((u >> 4) | 0xf0) - 132) << 23) | ((u & 0x0f) << 19);
for (int iy = 0; iy < nrc_y; ++iy) accd[iy] = _mm256_setzero_ps();