Skip to content

Commit a184e10

Browse files
committed
cmake : add -fno-inline for Metal build (#4545)
1 parent 515cfec commit a184e10

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,10 @@ if (LLAMA_METAL)
181181
#
182182
# note: this is the only way I found to disable fast-math in Metal. it's ugly, but at least it works
183183
# disabling fast math is needed in order to pass tests/test-backend-ops
184+
# note: adding -fno-inline fixes the tests when using MTL_SHADER_VALIDATION=1
184185
add_custom_command(
185186
OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ggml.metallib
186-
COMMAND xcrun -sdk macosx metal -fno-fast-math -c ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ggml-metal.metal -o ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ggml-metal.air
187+
COMMAND xcrun -sdk macosx metal -fno-fast-math -fno-inline -c ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ggml-metal.metal -o ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ggml-metal.air
187188
COMMAND xcrun -sdk macosx metallib ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ggml-metal.air -o ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ggml.metallib
188189
DEPENDS ggml-metal.metal
189190
COMMENT "Compiling Metal kernels"

0 commit comments

Comments
 (0)