@@ -121,6 +121,11 @@ ifneq ($(filter ppc64%,$(UNAME_M)),)
121
121
endif
122
122
endif
123
123
124
+ ifndef LLAMA_NO_K_QUANTS
125
+ CFLAGS += -DGGML_USE_K_QUANTS
126
+ OBJS += k_quants.o
127
+ endif
128
+
124
129
ifndef LLAMA_NO_ACCELERATE
125
130
# Mac M1 - include Accelerate framework.
126
131
# `-framework Accelerate` works on Mac Intel as well, with negliable performance boost (as of the predict time).
@@ -140,7 +145,7 @@ ifdef LLAMA_OPENBLAS
140
145
endif # LLAMA_OPENBLAS
141
146
142
147
ifdef LLAMA_BLIS
143
- CFLAGS += -DGGML_USE_OPENBLAS -I/usr/local/include/blis -I/usr/include/blis
148
+ CFLAGS += -DGGML_USE_OPENBLAS -I/usr/local/include/blis -I/usr/include/blis
144
149
LDFLAGS += -lblis -L/usr/local/lib
145
150
endif # LLAMA_BLIS
146
151
@@ -212,6 +217,11 @@ ifneq ($(filter armv8%,$(UNAME_M)),)
212
217
CFLAGS += -mfp16-format=ieee -mno-unaligned-access
213
218
endif
214
219
220
+ ifdef LLAMA_NO_K_QUANTS
221
+ k_quants.o : k_quants.c k_quants.h
222
+ $(CC ) $(CFLAGS ) -c $< -o $@
223
+ endif # LLAMA_NO_K_QUANTS
224
+
215
225
#
216
226
# Print build information
217
227
#
@@ -231,10 +241,7 @@ $(info )
231
241
# Build library
232
242
#
233
243
234
- ggml.o : ggml.c ggml.h ggml-cuda.h ggml-quants-k.h
235
- $(CC ) $(CFLAGS ) -c $< -o $@
236
-
237
- ggml-quants-k.o : ggml-quants-k.c ggml-quants-k.h ggml.h ggml-cuda.h
244
+ ggml.o : ggml.c ggml.h ggml-cuda.h
238
245
$(CC ) $(CFLAGS ) -c $< -o $@
239
246
240
247
llama.o : llama.cpp ggml.h ggml-cuda.h llama.h llama-util.h
@@ -243,7 +250,7 @@ llama.o: llama.cpp ggml.h ggml-cuda.h llama.h llama-util.h
243
250
common.o : examples/common.cpp examples/common.h
244
251
$(CXX ) $(CXXFLAGS ) -c $< -o $@
245
252
246
- libllama.so : llama.o ggml.o ggml-quants-k.o $(OBJS )
253
+ libllama.so : llama.o ggml.o $(OBJS )
247
254
$(CXX ) $(CXXFLAGS ) -shared -fPIC -o $@ $^ $(LDFLAGS )
248
255
249
256
clean :
@@ -253,28 +260,28 @@ clean:
253
260
# Examples
254
261
#
255
262
256
- main : examples/main/main.cpp build-info.h ggml.o ggml-quants-k.o llama.o common.o $(OBJS )
263
+ main : examples/main/main.cpp build-info.h ggml.o llama.o common.o $(OBJS )
257
264
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
258
265
@echo
259
266
@echo ' ==== Run ./main -h for help. ===='
260
267
@echo
261
268
262
- quantize : examples/quantize/quantize.cpp build-info.h ggml.o ggml-quants-k.o llama.o $(OBJS )
269
+ quantize : examples/quantize/quantize.cpp build-info.h ggml.o llama.o $(OBJS )
263
270
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
264
271
265
- quantize-stats : examples/quantize-stats/quantize-stats.cpp build-info.h ggml.o ggml-quants-k.o llama.o $(OBJS )
272
+ quantize-stats : examples/quantize-stats/quantize-stats.cpp build-info.h ggml.o llama.o $(OBJS )
266
273
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
267
274
268
- perplexity : examples/perplexity/perplexity.cpp build-info.h ggml.o ggml-quants-k.o llama.o common.o $(OBJS )
275
+ perplexity : examples/perplexity/perplexity.cpp build-info.h ggml.o llama.o common.o $(OBJS )
269
276
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
270
277
271
- embedding : examples/embedding/embedding.cpp build-info.h ggml.o ggml-quants-k.o llama.o common.o $(OBJS )
278
+ embedding : examples/embedding/embedding.cpp build-info.h ggml.o llama.o common.o $(OBJS )
272
279
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
273
280
274
- save-load-state : examples/save-load-state/save-load-state.cpp build-info.h ggml.o ggml-quants-k.o llama.o common.o $(OBJS )
281
+ save-load-state : examples/save-load-state/save-load-state.cpp build-info.h ggml.o llama.o common.o $(OBJS )
275
282
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
276
283
277
- server : examples/server/server.cpp examples/server/httplib.h examples/server/json.hpp build-info.h ggml.o ggml-quants-k.o llama.o common.o $(OBJS )
284
+ server : examples/server/server.cpp examples/server/httplib.h examples/server/json.hpp build-info.h ggml.o llama.o common.o $(OBJS )
278
285
$(CXX ) $(CXXFLAGS ) -Iexamples/server $(filter-out % .h,$(filter-out % .hpp,$^ ) ) -o $@ $(LDFLAGS )
279
286
280
287
build-info.h : $(wildcard .git/index) scripts/build-info.sh
@@ -289,11 +296,11 @@ build-info.h: $(wildcard .git/index) scripts/build-info.sh
289
296
# Tests
290
297
#
291
298
292
- benchmark-matmult : examples/benchmark/benchmark-matmult.cpp build-info.h ggml.o ggml-quants-k.o $(OBJS )
299
+ benchmark-matmult : examples/benchmark/benchmark-matmult.cpp build-info.h ggml.o $(OBJS )
293
300
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
294
301
./$@
295
302
296
- vdot : pocs/vdot/vdot.cpp ggml.o ggml-quants-k.o $(OBJS )
303
+ vdot : pocs/vdot/vdot.cpp ggml.o $(OBJS )
297
304
$(CXX ) $(CXXFLAGS ) $^ -o $@ $(LDFLAGS )
298
305
299
306
.PHONY : tests clean
0 commit comments