Skip to content

Commit a64a411

Browse files
committed
Merge branch 'mmnga-dev' into mmnga-dev-llamacpp
2 parents affbdcf + 5127387 commit a64a411

File tree

12 files changed

+390
-297
lines changed

12 files changed

+390
-297
lines changed

CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ set(LLAMA_CUDA_KQUANTS_ITER "2" CACHE STRING "llama: iters./thread per block for
8383
option(LLAMA_HIPBLAS "llama: use hipBLAS" OFF)
8484
option(LLAMA_CLBLAST "llama: use CLBlast" OFF)
8585
option(LLAMA_METAL "llama: use Metal" ${LLAMA_METAL_DEFAULT})
86+
option(LLAMA_METAL_NDEBUG "llama: disable Metal debugging" OFF)
8687
option(LLAMA_MPI "llama: use MPI" OFF)
8788
option(LLAMA_K_QUANTS "llama: use k-quants" ON)
8889
option(LLAMA_QKK_64 "llama: use super-block size of 64 for k-quants" OFF)
@@ -174,7 +175,9 @@ if (LLAMA_METAL)
174175
set(GGML_SOURCES_METAL ggml-metal.m ggml-metal.h)
175176

176177
add_compile_definitions(GGML_USE_METAL)
177-
#add_compile_definitions(GGML_METAL_NDEBUG)
178+
if (LLAMA_METAL_NDEBUG)
179+
add_compile_definitions(GGML_METAL_NDEBUG)
180+
endif()
178181

179182
# get full path to the file
180183
#add_compile_definitions(GGML_METAL_DIR_KERNELS="${CMAKE_CURRENT_SOURCE_DIR}/")

Makefile

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,11 @@ endif
109109

110110

111111
ifdef LLAMA_CODE_COVERAGE
112-
CXXFLAGS += -fprofile-arcs -ftest-coverage -dumpbase ''
112+
MK_CXXFLAGS += -fprofile-arcs -ftest-coverage -dumpbase ''
113113
endif
114114

115115
ifdef LLAMA_DISABLE_LOGS
116-
CFLAGS += -DLOG_DISABLE_LOGS
117-
CXXFLAGS += -DLOG_DISABLE_LOGS
116+
MK_CPPFLAGS += -DLOG_DISABLE_LOGS
118117
endif # LLAMA_DISABLE_LOGS
119118

120119
# warnings
@@ -124,7 +123,7 @@ MK_CXXFLAGS += -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wno-m
124123

125124
ifeq '' '$(findstring clang++,$(CXX))'
126125
# g++ only
127-
CXXFLAGS += -Wno-format-truncation
126+
MK_CXXFLAGS += -Wno-format-truncation
128127
endif
129128

130129
# OS specific
@@ -188,8 +187,8 @@ endif
188187
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54412
189188
# https://github.com/ggerganov/llama.cpp/issues/2922
190189
ifneq '' '$(findstring mingw,$(shell $(CC) -dumpmachine))'
191-
CFLAGS += -Xassembler -muse-unaligned-vector-move
192-
CXXFLAGS += -Xassembler -muse-unaligned-vector-move
190+
MK_CFLAGS += -Xassembler -muse-unaligned-vector-move
191+
MK_CXXFLAGS += -Xassembler -muse-unaligned-vector-move
193192
endif
194193

195194
ifneq ($(filter aarch64%,$(UNAME_M)),)
@@ -226,8 +225,8 @@ ifneq ($(filter ppc64%,$(UNAME_M)),)
226225
endif
227226

228227
else
229-
CFLAGS += -march=rv64gcv -mabi=lp64d
230-
CXXFLAGS += -march=rv64gcv -mabi=lp64d
228+
MK_CFLAGS += -march=rv64gcv -mabi=lp64d
229+
MK_CXXFLAGS += -march=rv64gcv -mabi=lp64d
231230
endif
232231

233232
ifndef LLAMA_NO_K_QUANTS
@@ -247,16 +246,6 @@ ifndef LLAMA_NO_ACCELERATE
247246
endif
248247
endif # LLAMA_NO_ACCELERATE
249248

250-
ifdef LLAMA_METAL
251-
# By default - use GPU acceleration on Mac OS
252-
ifeq ($(UNAME_S),Darwin)
253-
CFLAGS += -DGGML_USE_METAL #-DGGML_METAL_NDEBUG
254-
CXXFLAGS += -DGGML_USE_METAL
255-
LDFLAGS += -framework Foundation -framework Metal -framework MetalKit
256-
OBJS += ggml-metal.o
257-
endif
258-
endif # LLAMA_METAL
259-
260249
ifdef LLAMA_MPI
261250
MK_CPPFLAGS += -DGGML_USE_MPI
262251
MK_CFLAGS += -Wno-cast-qual
@@ -368,9 +357,12 @@ ggml-cuda.o: ggml-cuda.cu ggml-cuda.h
368357
endif # LLAMA_HIPBLAS
369358

370359
ifdef LLAMA_METAL
371-
MK_CPPFLAGS += -DGGML_USE_METAL #-DGGML_METAL_NDEBUG
360+
MK_CPPFLAGS += -DGGML_USE_METAL
372361
MK_LDFLAGS += -framework Foundation -framework Metal -framework MetalKit
373362
OBJS += ggml-metal.o
363+
ifdef LLAMA_METAL_NDEBUG
364+
MK_CPPFLAGS += -DGGML_METAL_NDEBUG
365+
endif
374366
endif # LLAMA_METAL
375367

376368
ifdef LLAMA_METAL

common/common.cpp

Lines changed: 94 additions & 94 deletions
Large diffs are not rendered by default.

common/log.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -513,16 +513,16 @@ inline bool log_param_pair_parse(bool check_but_dont_parse, const std::string &
513513

514514
inline void log_print_usage()
515515
{
516-
fprintf(stdout, "log options:\n");
516+
printf("log options:\n");
517517
/* format
518-
fprintf(stdout, " -h, --help show this help message and exit\n");*/
518+
printf(" -h, --help show this help message and exit\n");*/
519519
/* spacing
520-
fprintf(stdout, "__-param----------------Description\n");*/
521-
fprintf(stdout, " --log-test Run simple logging test\n");
522-
fprintf(stdout, " --log-disable Disable trace logs\n");
523-
fprintf(stdout, " --log-enable Enable trace logs\n");
524-
fprintf(stdout, " --log-file Specify a log filename (without extension)\n");
525-
fprintf(stdout, " Log file will be tagged with unique ID and written as \"<name>.<ID>.log\"\n"); /* */
520+
printf("__-param----------------Description\n");*/
521+
printf(" --log-test Run simple logging test\n");
522+
printf(" --log-disable Disable trace logs\n");
523+
printf(" --log-enable Enable trace logs\n");
524+
printf(" --log-file Specify a log filename (without extension)\n");
525+
printf(" Log file will be tagged with unique ID and written as \"<name>.<ID>.log\"\n"); /* */
526526
}
527527

528528
#define log_dump_cmdline(argc, argv) log_dump_cmdline_impl(argc, argv)

0 commit comments

Comments
 (0)