Skip to content

Commit 9912b9e

Browse files
authored
build : add LLAMA_METAL_NDEBUG flag (#3033)
1 parent 9e20231 commit 9912b9e

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,9 @@ ifdef LLAMA_METAL
360360
MK_CPPFLAGS += -DGGML_USE_METAL
361361
MK_LDFLAGS += -framework Foundation -framework Metal -framework MetalKit
362362
OBJS += ggml-metal.o
363+
ifdef LLAMA_METAL_NDEBUG
364+
MK_CPPFLAGS += -DGGML_METAL_NDEBUG
365+
endif
363366
endif # LLAMA_METAL
364367

365368
ifdef LLAMA_METAL

0 commit comments

Comments
 (0)