File tree Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -126,7 +126,8 @@ option(GGML_RVV "ggml: enable rvv" ON)
126126option (GGML_VXE "ggml: enable vxe" ON )
127127
128128option (GGML_CPU_ALL_VARIANTS "ggml: build all variants of the CPU backend (requires GGML_BACKEND_DL)" OFF )
129- set (GGML_CPU_ARM_ARCH "" CACHE STRING "ggml: CPU architecture for ARM" )
129+ set (GGML_CPU_ARM_ARCH "" CACHE STRING "ggml: CPU architecture for ARM" )
130+ set (GGML_CPU_POWERPC_CPUTYPE "" CACHE STRING "ggml: CPU type for PowerPC" )
130131
131132
132133if (WIN32 )
Original file line number Diff line number Diff line change @@ -289,15 +289,21 @@ function(ggml_add_cpu_backend_variant_impl tag_name)
289289 endif ()
290290 elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc64" )
291291 message (STATUS "PowerPC detected" )
292- execute_process (COMMAND bash -c "grep POWER /proc/cpuinfo | head -n 1" OUTPUT_VARIABLE POWER_M)
293- if (${POWER_M} MATCHES "POWER10" )
294- list (APPEND ARCH_FLAGS -mcpu=power10)
295- elseif (${POWER_M} MATCHES "POWER9" )
296- list (APPEND ARCH_FLAGS -mcpu=power9)
297- elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc64le" )
298- list (APPEND ARCH_FLAGS -mcpu=powerpc64le -mtune=native)
292+ if (GGML_NATIVE)
293+ execute_process (COMMAND bash -c "grep POWER /proc/cpuinfo | head -n 1" OUTPUT_VARIABLE POWER_M)
294+ if (${POWER_M} MATCHES "POWER10" )
295+ list (APPEND ARCH_FLAGS -mcpu=power10)
296+ elseif (${POWER_M} MATCHES "POWER9" )
297+ list (APPEND ARCH_FLAGS -mcpu=power9)
298+ elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc64le" )
299+ list (APPEND ARCH_FLAGS -mcpu=powerpc64le -mtune=native)
300+ else ()
301+ list (APPEND ARCH_FLAGS -mcpu=powerpc64 -mtune=native)
302+ endif ()
299303 else ()
300- list (APPEND ARCH_FLAGS -mcpu=powerpc64 -mtune=native)
304+ if (GGML_CPU_POWERPC_CPUTYPE)
305+ list (APPEND ARCH_FLAGS -mcpu=${GGML_CPU_POWERPC_CPUTYPE} )
306+ endif ()
301307 endif ()
302308 elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "loongarch64" )
303309 message (STATUS "loongarch64 detected" )
You can’t perform that action at this time.
0 commit comments