@@ -111,46 +111,10 @@ function(ggml_add_cpu_backend_variant_impl tag_name)
111111            endif  ()
112112
113113            set (CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_PREV} )
114-         elseif  (APPLE )
115-             if  (GGML_NATIVE)
116-                 set (USER_PROVIDED_MARCH FALSE )
117-                 foreach (flag_var IN ITEMS CMAKE_C_FLAGS CMAKE_CXX_FLAGS  CMAKE_REQUIRED_FLAGS)
118-                     if  ("${${flag_var} }"  MATCHES  "-march=[a-zA-Z0-9+._-]+" )
119-                         set (USER_PROVIDED_MARCH TRUE )
120-                         break ()
121-                     endif ()
122-                 endforeach ()
123- 
124-                 if  (NOT  USER_PROVIDED_MARCH)
125-                     set (MARCH_FLAGS "-march=armv8.2a" )
126- 
127-                     check_cxx_source_compiles("#include <arm_neon.h>\n int main() { int8x16_t _a, _b; int32x4_t _s = vdotq_s32(_s, _a, _b); return 0; }"  GGML_COMPILER_SUPPORT_DOTPROD)
128-                     if  (GGML_COMPILER_SUPPORT_DOTPROD)
129-                         set (MARCH_FLAGS "${MARCH_FLAGS} +dotprod" )
130-                         list (APPEND  ARCH_DEFINITIONS __ARM_FEATURE_DOTPROD)
131- 
132-                         message (STATUS  "ARM feature DOTPROD enabled" )
133-                     endif  ()
134- 
135-                     set (TEST_I8MM_FLAGS "-march=armv8.2a+i8mm" )
136- 
137-                     set (CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS} )
138-                     set (CMAKE_REQUIRED_FLAGS     "${CMAKE_REQUIRED_FLAGS}  ${TEST_I8MM_FLAGS} " )
139- 
140-                     check_cxx_source_compiles("#include <arm_neon.h>\n int main() { int8x16_t _a, _b; int32x4_t _s = vmmlaq_s32(_s, _a, _b); return 0; }"  GGML_COMPILER_SUPPORT_MATMUL_INT8)
141-                     if  (GGML_COMPILER_SUPPORT_MATMUL_INT8)
142-                         set (MARCH_FLAGS "${MARCH_FLAGS} +i8mm" )
143-                         list (APPEND  ARCH_DEFINITIONS __ARM_FEATURE_MATMUL_INT8)
144- 
145-                         message (STATUS  "ARM feature MATMUL_INT8 enabled" )
146-                     endif  ()
147- 
148-                     set (CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE} )
149- 
150-                     list (APPEND  ARCH_FLAGS "${MARCH_FLAGS} " )
151-                 endif  ()
152-             endif  ()
153114        else ()
115+             if  (GGML_NATIVE)
116+                 list (APPEND  ARCH_FLAGS -mcpu=native)
117+             endif ()
154118            check_cxx_compiler_flag(-mfp16-format=ieee COMPILER_SUPPORTS_FP16_FORMAT_I3E)
155119            if  (NOT  "${COMPILER_SUPPORTS_FP16_FORMAT_I3E} "  STREQUAL  "" )
156120                list (APPEND  ARCH_FLAGS -mfp16-format=ieee)
0 commit comments