Skip to content

Commit 093e3f1

Browse files
shalinib-ibmroot
and
root
authored
cmake : Handle mixed-case 'Power' strings in POWER CPU detection (#13966)
Some systems report the CPU implementation as "Power11" instead of "POWER11". The existing CMake logic uses a case-sensitive regular expression to extract the CPU generation, which fails when the casing doesn't exactly match "POWER". This patch provides a fix by first converting the string to uppercase before applying the regex. Signed-off-by: root <[email protected]> Co-authored-by: root <[email protected]>
1 parent 663445b commit 093e3f1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ggml/src/ggml-cpu/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,8 @@ function(ggml_add_cpu_backend_variant_impl tag_name)
318318
execute_process(COMMAND bash -c "prtconf |grep 'Implementation' | head -n 1" OUTPUT_VARIABLE POWER10_M)
319319
endif()
320320

321-
string(REGEX MATCHALL "POWER *([0-9]+)" MATCHED_STRING "${POWER10_M}")
321+
string(TOUPPER "${POWER10_M}" POWER10_M_UPPER)
322+
string(REGEX MATCHALL "POWER *([0-9]+)" MATCHED_STRING "${POWER10_M_UPPER}")
322323
string(REGEX REPLACE "POWER *([0-9]+)" "\\1" EXTRACTED_NUMBER "${MATCHED_STRING}")
323324

324325
if (EXTRACTED_NUMBER GREATER_EQUAL 10)

0 commit comments

Comments
 (0)