From d556b1d80992d69dbd9a9fc4a8a7a87a31df1a08 Mon Sep 17 00:00:00 2001 From: Kawrakow Date: Wed, 17 Jul 2024 16:51:34 +0300 Subject: [PATCH] Fix Makefile, add GGML_USE_IQK_MULMAT ifdefs to iqk-quantize --- Makefile | 3 +++ iqk-quantize.cpp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/Makefile b/Makefile index 720f8661..fa360296 100644 --- a/Makefile +++ b/Makefile @@ -475,6 +475,7 @@ ifdef LLAMA_BLIS OBJS += ggml-blas.o endif # LLAMA_BLIS +OBJS += iqk-quantize.o ifndef LLAMA_NO_IQK_MULMAT MK_CPPFLAGS += -DGGML_USE_IQK_MULMAT OBJS += iqk_mul_mat.o @@ -707,6 +708,8 @@ OBJS += ggml-alloc.o ggml-backend.o ggml-quants.o unicode.o unicode-data.o COMMON_H_DEPS = common/common.h common/sampling.h common/log.h llama.h COMMON_DEPS = common.o sampling.o grammar-parser.o build-info.o json-schema-to-grammar.o +iqk-quantize.o: iqk-quantize.cpp iqk-quantize.h iqk_mul_mat.h ggml-quants.h ggml-common.h ggml.h ggml-impl.h + $(CXX) $(CXXFLAGS) -c $< -o $@ ifndef LLAMA_NO_IQK_MULMAT iqk_mul_mat.o: iqk_mul_mat.cpp ggml-impl.h ggml.h ggml-quants.h ggml-common.h iqk_mul_mat.h $(CXX) $(CXXFLAGS) -c $< -o $@ diff --git a/iqk-quantize.cpp b/iqk-quantize.cpp index c7b868a5..f0b6eec4 100644 --- a/iqk-quantize.cpp +++ b/iqk-quantize.cpp @@ -14,7 +14,9 @@ // limitations under the License. #include "iqk-quantize.h" +#if GGML_USE_IQK_MULMAT #include "iqk_mul_mat.h" +#endif #include "ggml-quants.h" #include "ggml-impl.h" #define GGML_COMMON_IMPL_C @@ -243,9 +245,11 @@ void ggml_vec_dot_iq1_bn_q8_K64(int n, float * s, size_t bs, const void * vx, si static_assert(QK_IQ1BN == 64, "This dot product implementation for iq1_bn requires a block size of 64"); +#if GGML_USE_IQK_MULMAT if (iqk_mul_mat(GGML_TASK_TYPE_COMPUTE, 1, 1, n, GGML_TYPE_IQ1_BN, vx, 0, GGML_TYPE_Q8_K64, vy, 0, s, 0, 0, 1)) { return; } +#endif const block_iq1_bn * x = (const block_iq1_bn *)vx;