Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
  • Loading branch information
candrews authored Nov 26, 2025
commit 42f8fee633ce2188bb2d9189577e35b0fc2cea0e
5 changes: 4 additions & 1 deletion ggml/src/ggml-cpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,10 @@ function(ggml_add_cpu_backend_variant_impl tag_name)
endif()
if (GGML_BMI2)
# MSVC does not define macro __BMI2__
list(APPEND ARCH_DEFINITIONS __BMI2__ GGML_BMI2)
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "amd64")
# BMI2 is only available on amd64
list(APPEND ARCH_DEFINITIONS __BMI2__ GGML_BMI2)
endif()
endif()
else ()
if (GGML_NATIVE)
Expand Down