Skip to content

Commit 6512a90

Browse files
midnightmagicmidnight
authored andcommitted
cmake : fix compile assumptions for power9/etc (whisper/2777)
* Add small comment re: VSX to readme Co-authored-by: midnight <[email protected]>
1 parent 4512055 commit 6512a90

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

ggml/src/ggml-cpu/CMakeLists.txt

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -281,19 +281,15 @@ function(ggml_add_cpu_backend_variant_impl tag_name)
281281
endif()
282282
elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc64")
283283
message(STATUS "PowerPC detected")
284-
execute_process(COMMAND bash -c "grep POWER10 /proc/cpuinfo | head -n 1" OUTPUT_VARIABLE POWER10_M)
285-
string(FIND "${POWER10_M}" "POWER10" substring_index)
286-
if (NOT DEFINED substring_index OR "${substring_index}" STREQUAL "")
287-
set(substring_index -1)
288-
endif()
289-
290-
if (${substring_index} GREATER_EQUAL 0)
291-
list(APPEND ARCH_FLAGS -mcpu=power10)
284+
execute_process(COMMAND bash -c "grep POWER /proc/cpuinfo | head -n 1" OUTPUT_VARIABLE POWER_M)
285+
if (${POWER_M} MATCHES "POWER10")
286+
list(APPEND ARCH_FLAGS -mcpu=power10)
287+
elseif (${POWER_M} MATCHES "POWER9")
288+
list(APPEND ARCH_FLAGS -mcpu=power9)
292289
elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc64le")
293-
list(APPEND ARCH_FLAGS -mcpu=powerpc64le)
290+
list(APPEND ARCH_FLAGS -mcpu=powerpc64le -mtune=native)
294291
else()
295-
list(APPEND ARCH_FLAGS -mcpu=native -mtune=native)
296-
# TODO: Add targets for Power8/Power9 (Altivec/VSX) and Power10(MMA) and query for big endian systems (ppc64/le/be)
292+
list(APPEND ARCH_FLAGS -mcpu=powerpc64 -mtune=native)
297293
endif()
298294
elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "loongarch64")
299295
message(STATUS "loongarch64 detected")

0 commit comments

Comments
 (0)