Skip to content

Commit 94014df

Browse files
ggerganovarthw
authored andcommitted
cmake : fix ARM feature detection (ggml-org#10543)
ggml-ci
1 parent 2016284 commit 94014df

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

ggml/src/ggml-cpu/CMakeLists.txt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,23 @@ if (CMAKE_OSX_ARCHITECTURES STREQUAL "arm64" OR
8282
check_cxx_source_compiles("#include <arm_neon.h>\nint main() { int8x16_t _a, _b; int32x4_t _s = vdotq_s32(_s, _a, _b); return 0; }" GGML_COMPILER_SUPPORT_DOTPROD)
8383
if (GGML_COMPILER_SUPPORT_DOTPROD)
8484
add_compile_definitions(__ARM_FEATURE_DOTPROD)
85+
86+
message(STATUS "ARM feature DOTPROD enabled")
8587
endif ()
8688

87-
check_cxx_source_compiles("#include <arm_neon.h>\nint main() { int8x16_t _a, _b; int32x4_t _s = vmlaq_f32(_s, _a, _b); return 0; }" GGML_COMPILER_SUPPORT_MATMUL_INT8)
89+
check_cxx_source_compiles("#include <arm_neon.h>\nint main() { int8x16_t _a, _b; int32x4_t _s = vmmlaq_f32(_s, _a, _b); return 0; }" GGML_COMPILER_SUPPORT_MATMUL_INT8)
8890

8991
if (GGML_COMPILER_SUPPORT_MATMUL_INT8)
9092
add_compile_definitions(__ARM_FEATURE_MATMUL_INT8)
93+
94+
message(STATUS "ARM feature MATMUL_INT8 enabled")
9195
endif ()
9296

9397
check_cxx_source_compiles("#include <arm_neon.h>\nint main() { float16_t _a; float16x8_t _s = vdupq_n_f16(_a); return 0; }" GGML_COMPILER_SUPPORT_FP16_VECTOR_ARITHMETIC)
9498
if (GGML_COMPILER_SUPPORT_FP16_VECTOR_ARITHMETIC)
9599
add_compile_definitions(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
100+
101+
message(STATUS "ARM feature FP16_VECTOR_ARITHMETIC enabled")
96102
endif ()
97103

98104
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_PREV})
@@ -113,17 +119,23 @@ if (CMAKE_OSX_ARCHITECTURES STREQUAL "arm64" OR
113119
if (GGML_COMPILER_SUPPORT_DOTPROD)
114120
set(MARCH_FLAGS "${MARCH_FLAGS}+dotprod")
115121
add_compile_definitions(__ARM_FEATURE_DOTPROD)
122+
123+
message(STATUS "ARM feature DOTPROD enabled")
116124
endif ()
117125

118126
set(TEST_I8MM_FLAGS "-march=armv8.2a+i8mm")
119127

120128
set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS})
121-
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${TEST_I8MM_FLAGS}")
129+
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${TEST_I8MM_FLAGS}")
130+
122131
check_cxx_source_compiles("#include <arm_neon.h>\nint main() { int8x16_t _a, _b; int32x4_t _s = vmmlaq_s32(_s, _a, _b); return 0; }" GGML_COMPILER_SUPPORT_MATMUL_INT8)
123132
if (GGML_COMPILER_SUPPORT_MATMUL_INT8)
124133
set(MARCH_FLAGS "${MARCH_FLAGS}+i8mm")
125134
add_compile_definitions(__ARM_FEATURE_MATMUL_INT8)
135+
136+
message(STATUS "ARM feature MATMUL_INT8 enabled")
126137
endif ()
138+
127139
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE})
128140

129141
list(APPEND ARCH_FLAGS "${MARCH_FLAGS}")

0 commit comments

Comments
 (0)