Skip to content

Commit 585d91a

Browse files
authored
cmake : add explicit F16C option (x86) (abetlen#576)
Fixes building for x86 processors missing F16C featureset MSVC not included, as in MSVC F16C is implied with AVX2/AVX512
1 parent 95ea26f commit 585d91a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ option(LLAMA_AVX "llama: enable AVX"
5656
option(LLAMA_AVX2 "llama: enable AVX2" ON)
5757
option(LLAMA_AVX512 "llama: enable AVX512" OFF)
5858
option(LLAMA_FMA "llama: enable FMA" ON)
59+
# in MSVC F16C is implied with AVX2/AVX512
60+
if (NOT MSVC)
61+
option(LLAMA_F16C "llama: enable F16C" ON)
62+
endif()
5963

6064
# 3rd party libs
6165
option(LLAMA_ACCELERATE "llama: enable Accelerate framework" ON)
@@ -207,7 +211,9 @@ elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^(x86_64|i686|AMD64)$")
207211
add_compile_options(/arch:AVX)
208212
endif()
209213
else()
210-
add_compile_options(-mf16c)
214+
if (LLAMA_F16C)
215+
add_compile_options(-mf16c)
216+
endif()
211217
if (LLAMA_FMA)
212218
add_compile_options(-mfma)
213219
endif()

0 commit comments

Comments
 (0)