Skip to content

Commit 1296695

Browse files
authored
ggml-cpu: BMI2 is only available on amd64
MSVC doesn't define __BMI2__ so it must be defined by by CMake. It was being set whenever GGML_BMI2 is set, but that results in a failure (`error LNK2019: unresolved external symbol __pdep_u64`) when targeting x86 (aka 32 bit) Windows. The fix is to only set __BMI2__ when targeting amd64.
1 parent 19ceec8 commit 1296695

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ggml/src/ggml-cpu/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,10 @@ function(ggml_add_cpu_backend_variant_impl tag_name)
308308
endif()
309309
if (GGML_BMI2)
310310
# MSVC does not define macro __BMI2__
311-
list(APPEND ARCH_DEFINITIONS __BMI2__ GGML_BMI2)
311+
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "amd64")
312+
# BMI2 is only available on amd64
313+
list(APPEND ARCH_DEFINITIONS __BMI2__ GGML_BMI2)
314+
endif()
312315
endif()
313316
else ()
314317
if (GGML_NATIVE)

0 commit comments

Comments
 (0)