diff --git a/cmake/ncnn_add_layer.cmake b/cmake/ncnn_add_layer.cmake index d9f898f62c9..50d7dcf89ce 100644 --- a/cmake/ncnn_add_layer.cmake +++ b/cmake/ncnn_add_layer.cmake @@ -345,7 +345,8 @@ macro(ncnn_add_layer class) ncnn_add_arch_opt_source(${class} asimddp "-march=armv8.2-a+fp16+dotprod") endif() if(NCNN_RUNTIME_CPU AND NCNN_ARM82FP16FML) - ncnn_add_arch_opt_source(${class} asimdfhm "-march=armv8.2-a+fp16+fp16fml") + # clang 9.0.9 shipped with android ndk-r21 is missing __ARM_FEATURE_FP16_FML macro for asimdfhm target + ncnn_add_arch_opt_source(${class} asimdfhm "-march=armv8.2-a+fp16+fp16fml -D__ARM_FEATURE_FP16_FML") endif() if(NCNN_RUNTIME_CPU AND NCNN_ARM84BF16) ncnn_add_arch_opt_source(${class} bf16 "-march=armv8.4-a+fp16+dotprod+bf16") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 21d5ae5eae3..b27f8ad42bd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -634,6 +634,8 @@ if(NCNN_TARGET_ARCH STREQUAL "arm" AND (CMAKE_SIZEOF_VOID_P EQUAL 8 OR NCNN_TARG endif() if(NCNN_ARM82FP16FML) set(ARM_MARCH_FLAG "${ARM_MARCH_FLAG}+fp16fml") + # clang 9.0.9 shipped with android ndk-r21 is missing __ARM_FEATURE_FP16_FML macro for asimdfhm target + target_compile_options(ncnn PRIVATE -D__ARM_FEATURE_FP16_FML) endif() endif() endif()