Skip to content

Commit ef0dbde

Browse files
jmorgancaorca-zhang
authored andcommitted
llamafile: use member variable instead of constant for iq4nlt (ggml-org#11780)
1 parent 7de6f68 commit ef0dbde

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

ggml/src/ggml-cpu/llamafile/sgemm.cpp

+9-8
Original file line numberDiff line numberDiff line change
@@ -280,14 +280,6 @@ template <> inline __m256bh load(const float *p) {
280280
}
281281
#endif
282282

283-
////////////////////////////////////////////////////////////////////////////////////////////////////
284-
// CONSTANTS
285-
286-
#if defined(__AVX__) || defined(__AVX2__) || defined(__AVX512F__)
287-
static const int8_t kvalues_iq4nl[16] = {-127, -104, -83, -65, -49, -35, -22, -10, 1, 13, 25, 38, 53, 69, 89, 113};
288-
static const __m128i iq4nlt = _mm_loadu_si128((const __m128i *) kvalues_iq4nl);
289-
#endif
290-
291283
////////////////////////////////////////////////////////////////////////////////////////////////////
292284
// FLOATING POINT MATRIX MULTIPLICATION
293285

@@ -614,6 +606,14 @@ class tinyBLAS_Q0_AVX {
614606
TC *C, int64_t ldc,
615607
int ith, int nth)
616608
: A(A), B(B), C(C), k(k), lda(lda), ldb(ldb), ldc(ldc), ith(ith), nth(nth) {
609+
const int8_t kvalues_iq4nl[16] = {
610+
-127, -104, -83, -65,
611+
-49, -35, -22, -10,
612+
1, 13, 25, 38,
613+
53, 69, 89, 113
614+
};
615+
616+
iq4nlt = _mm_loadu_si128((const __m128i *)kvalues_iq4nl);
617617
}
618618

619619
void matmul(int64_t m, int64_t n) {
@@ -1038,6 +1038,7 @@ class tinyBLAS_Q0_AVX {
10381038
const int64_t ldc;
10391039
const int ith;
10401040
const int nth;
1041+
__m128i iq4nlt;
10411042
};
10421043
#endif // __AVX__
10431044

0 commit comments

Comments
 (0)