core: add back OpenMP due to huge perf loss on TG128

This commit is contained in:
Han Yin 2025-06-25 14:25:35 -07:00
parent 53ac8af67a
commit b59c59e5c3
1 changed files with 8 additions and 4 deletions

View File

@ -17,19 +17,22 @@ set(CMAKE_CXX_STANDARD 17 CACHE STRING "" FORCE)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# --------------------------------------------------------------------------
# 1 CPU feature detection library
# 1.a CPU feature detection library
# --------------------------------------------------------------------------
add_subdirectory(
${CMAKE_CURRENT_LIST_DIR}/../../../../../../include/cpu_features
${CMAKE_BINARY_DIR}/cpu_features_build)
# CPU feature detection library (lightweight, loads first)
add_library(llama_cpu_detector SHARED cpu_detector.cpp)
target_link_libraries(llama_cpu_detector
PRIVATE CpuFeatures::cpu_features
android
log)
# --------------------------------------------------------------------------
# 1.b Make the LLVM OpenMP runtime available
# --------------------------------------------------------------------------
find_package(OpenMP REQUIRED)
# --------------------------------------------------------------------------
# 2. Locate the root of the llama.cpp source tree
# (six levels up from this CMakeLists.txt).
@ -65,7 +68,7 @@ function(build_llama_tier tier march)
# ---- llama / ggml feature switches ----------------------------
-DGGML_CPU_KLEIDIAI=${kleidi}
-DGGML_LLAMAFILE=OFF
-DGGML_OPENMP=OFF
-DGGML_OPENMP=ON
-DLLAMA_BUILD_COMMON=ON
-DLLAMA_CURL=OFF
-DBUILD_SHARED_LIBS=OFF # we want static libs to embed
@ -135,6 +138,7 @@ function(build_llama_tier tier march)
ggml_core_${tier} # umbrella (brings in few weak deps)
ggml_cpu_core_${tier} # back-end & scheduler
ggml_base_core_${tier} # core math
OpenMP::OpenMP_CXX # OpenMP
android
log)