Skip to content

Commit be09d98

Browse files
committed
Move kvalues_iq4nl definition to ggml-common.h
Signed-off-by: HungMingWu <[email protected]>
1 parent c2a67ef commit be09d98

File tree

7 files changed

+6
-12
lines changed

7 files changed

+6
-12
lines changed

ggml/src/ggml-common.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,6 +1070,10 @@ GGML_TABLE_BEGIN(uint32_t, iq3s_grid, 512)
10701070
0x0f090307, 0x0f090501, 0x0f090b01, 0x0f0b0505, 0x0f0b0905, 0x0f0d0105, 0x0f0d0703, 0x0f0f0101,
10711071
GGML_TABLE_END()
10721072

1073+
GGML_TABLE_BEGIN(int8_t, kvalues_iq4nl, 16)
1074+
-127, -104, -83, -65, -49, -35, -22, -10, 1, 13, 25, 38, 53, 69, 89, 113,
1075+
GGML_TABLE_END()
1076+
10731077
#define NGRID_IQ1S 2048
10741078
#define IQ1S_DELTA 0.125f
10751079
#define IQ1M_DELTA 0.125f

ggml/src/ggml-cpu/ggml-cpu-aarch64.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,6 @@ static inline __m256i mul_sum_i8_pairs_int32x8(const __m256i x, const __m256i y)
223223
}
224224
#endif
225225

226-
static const int8_t kvalues_iq4nl[16] = {-127, -104, -83, -65, -49, -35, -22, -10, 1, 13, 25, 38, 53, 69, 89, 113};
227-
228226
static void quantize_q8_0_4x4(const float * GGML_RESTRICT x, void * GGML_RESTRICT vy, int64_t k) {
229227
assert(QK8_0 == 32);
230228
assert(k % QK8_0 == 0);

ggml/src/ggml-cpu/ggml-cpu-quants.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,8 +1639,6 @@ void quantize_row_tq2_0(const float * restrict x, void * restrict vy, int64_t k)
16391639
quantize_row_tq2_0_ref(x, y, k);
16401640
}
16411641

1642-
static const int8_t kvalues_iq4nl[16] = {-127, -104, -83, -65, -49, -35, -22, -10, 1, 13, 25, 38, 53, 69, 89, 113};
1643-
16441642
//===================================== Q8_K ==============================================
16451643

16461644
void quantize_row_q8_K(const float * restrict x, void * restrict y, int64_t k) {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252
#include "ggml-impl.h"
5353
#include "ggml-cpu-impl.h"
5454
#include "ggml-quants.h"
55+
#define GGML_COMMON_IMPL_CPP
56+
#include "ggml-common.h"
5557

5658
#include <atomic>
5759
#include <array>
@@ -284,7 +286,6 @@ template <> inline __m256bh load(const float *p) {
284286
// CONSTANTS
285287

286288
#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};
288289
static const __m128i iq4nlt = _mm_loadu_si128((const __m128i *) kvalues_iq4nl);
289290
#endif
290291

ggml/src/ggml-cuda/common.cuh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,6 @@ static __device__ __forceinline__ int ggml_cuda_dp4a(const int a, const int b, i
358358
#endif // defined(GGML_USE_HIP) && defined(__HIP_PLATFORM_AMD__)
359359
}
360360

361-
// TODO: move to ggml-common.h
362-
static constexpr __device__ int8_t kvalues_iq4nl[16] = {-127, -104, -83, -65, -49, -35, -22, -10, 1, 13, 25, 38, 53, 69, 89, 113};
363-
364361
typedef void (*dequantize_kernel_t)(const void * vx, const int64_t ib, const int iqs, dfloat2 & v);
365362

366363
static __device__ __forceinline__ float get_alibi_slope(

ggml/src/ggml-quants.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2431,8 +2431,6 @@ void dequantize_row_iq1_m(const block_iq1_m * restrict x, float * restrict y, in
24312431
}
24322432
}
24332433

2434-
static const int8_t kvalues_iq4nl[16] = {-127, -104, -83, -65, -49, -35, -22, -10, 1, 13, 25, 38, 53, 69, 89, 113};
2435-
24362434
void dequantize_row_iq4_nl(const block_iq4_nl * restrict x, float * restrict y, int64_t k) {
24372435
assert(k % QK4_NL == 0);
24382436
const int64_t nb = k / QK4_NL;

ggml/src/ggml-sycl/common.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,6 @@ typedef sycl::float2 dfloat2;
139139

140140
#define MMVQ_MAX_BATCH_SIZE 8
141141

142-
static const int8_t kvalues_iq4nl[16]={-127, -104, -83, -65, -49, -35, -22, -10, 1, 13, 25, 38, 53, 69, 89, 113};
143-
144142
static int g_all_sycl_device_count = -1;
145143
static bool g_ggml_backend_sycl_buffer_type_initialized = false;
146144

0 commit comments

Comments
 (0)