diff --git a/CMakeLists.txt b/CMakeLists.txt index 3557892339c30a4a644c8e8b8027b9a911e037cb..de972698499c3335f571956ccba812adc71c5d5e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,7 +34,6 @@ option(MGE_WITH_HALIDE "Build MegEngine with Halide JIT" OFF) option(MGE_WITH_MIDOUT_PROFILE "Build MegEngine with Midout profile." OFF) option(MGE_WITH_MINIMUM_SIZE "Swith off MGE_ENABLE_RTTI、MGE_ENABLE_EXCEPTIONS、MGE_ENABLE_LOGGING and switch on MGE_INFERENCE_ONLY so that compile minimum load_and_run. Take effect only when MGE_BIN_REDUCE was set" OFF) option(MGE_ARMV8_2_FEATURE_FP16 "Enable armv8.2-a+fp16 support" OFF) -option(MGE_ARMV8_2_FEATURE_DOTPROD "enable armv8.2-a+dotprod support" OFF) option(MGE_DISABLE_FLOAT16 "Disable MegEngine float16 support." OFF) option(MGE_WITH_CUDA "Enable MegEngine CUDA support." ON) option(MGE_CUDA_USE_STATIC "Enable MegEngine CUDA static linking." ON) @@ -773,6 +772,14 @@ if(MGE_ARCH STREQUAL "x86_64" OR MGE_ARCH STREQUAL "i386") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2 -mfpmath=sse") endif() endif() +# dotprod is not enable by default on APPLE, cpuinfo has some problem on APPLE +if(NOT APPLE) + CHECK_CXX_COMPILER_FLAG("-march=armv8.2-a+dotprod" CXX_COMPILER_SUPPORT_DOT) + if(CXX_COMPILER_SUPPORT_DOT) + message(STATUS "Enable dotprod feature in armv8.2-a using MGB_ENABLE_DOT") + set(MGB_ENABLE_DOT 1) + endif() +endif() if(MGE_ARCH STREQUAL "armv7") # -funsafe-math-optimizations to enable neon auto-vectorization (since neon is not fully IEEE 754 compatible, GCC does not turn on neon auto-vectorization by default. @@ -797,15 +804,6 @@ if(MGE_ARCH STREQUAL "aarch64") set(MARCH "-march=armv8.2-a+fp16") endif() - if(MGE_ARMV8_2_FEATURE_DOTPROD) - message(STATUS "Enable dotprod feature support in armv8.2") - if(MGE_ARMV8_2_FEATURE_FP16) - set(MARCH "-march=armv8.2-a+fp16+dotprod") - else() - set(MARCH "-march=armv8.2-a+dotprod") - endif() - endif() - if(MGE_WITH_CUDA) message(WARNING "aarch64 ld will add -mfix-cortex-a53-843419 and -mfix-cortex-a53-835769,\ when cuda enable and CMAKE with DEBUG build type,ld will take about 14min+,\ diff --git a/dnn/src/arm_common/simd_macro/marm_neon.h b/dnn/src/arm_common/simd_macro/marm_neon.h index dcd8f9aadad917f2c02b216508a089446868ff2c..17d544ee849e2bd12728864dc20005c60dfcb3e7 100644 --- a/dnn/src/arm_common/simd_macro/marm_neon.h +++ b/dnn/src/arm_common/simd_macro/marm_neon.h @@ -10,6 +10,10 @@ * implied. */ #pragma once + +#include "megdnn/arch.h" +#include "src/common/unroll_macro.h" + #if MGB_ENABLE_DOT #if defined(__ARM_FEATURE_DOTPROD) #undef __ARM_FEATURE_DOTPROD @@ -17,8 +21,6 @@ #define __ARM_FEATURE_DOTPROD 1 #endif #include -#include "megdnn/arch.h" -#include "src/common/unroll_macro.h" // GCC does not support __nodebug__, it reports: // '__nodebug__' attribute directive ignored diff --git a/scripts/cmake-build/cross_build_android_arm_inference.sh b/scripts/cmake-build/cross_build_android_arm_inference.sh index cec78c1a42f57dea61980815c524c136b56bf396..bdd1f397584011e8b05d2ad9c4d8dfcd5f6b8968 100755 --- a/scripts/cmake-build/cross_build_android_arm_inference.sh +++ b/scripts/cmake-build/cross_build_android_arm_inference.sh @@ -4,7 +4,6 @@ set -e ARCHS=("arm64-v8a" "armeabi-v7a") BUILD_TYPE=Release MGE_ARMV8_2_FEATURE_FP16=OFF -MGE_ARMV8_2_FEATURE_DOTPROD=OFF MGE_DISABLE_FLOAT16=OFF ARCH=arm64-v8a REMOVE_OLD_BUILD=false @@ -15,7 +14,6 @@ function usage() { echo "available args detail:" echo "-d : Build with Debug mode, default Release mode" echo "-f : enable MGE_ARMV8_2_FEATURE_FP16 for ARM64, need toolchain and hardware support" - echo "-p : enable MGE_ARMV8_2_FEATURE_DOTPROD for ARM64, need toolchain and hardware support" echo "-k : open MGE_DISABLE_FLOAT16 for NEON " echo "-a : config build arch available: ${ARCHS[@]}" echo "-r : remove old build dir before make, default off" @@ -25,7 +23,7 @@ function usage() { exit -1 } -while getopts "rkhdfpa:" arg +while getopts "rkhdfa:" arg do case $arg in d) @@ -36,10 +34,6 @@ do echo "enable MGE_ARMV8_2_FEATURE_FP16 for ARM64" MGE_ARMV8_2_FEATURE_FP16=ON ;; - p) - echo "enable MGE_ARMV8_2_FEATURE_DOTPROD for ARM64" - MGE_ARMV8_2_FEATURE_DOTPROD=ON - ;; k) echo "open MGE_DISABLE_FLOAT16 for NEON" MGE_DISABLE_FLOAT16=ON @@ -78,7 +72,6 @@ echo "----------------------------------------------------" echo "build config summary:" echo "BUILD_TYPE: $BUILD_TYPE" echo "MGE_ARMV8_2_FEATURE_FP16: $MGE_ARMV8_2_FEATURE_FP16" -echo "MGE_ARMV8_2_FEATURE_DOTPROD: $MGE_ARMV8_2_FEATURE_DOTPROD" echo "MGE_DISABLE_FLOAT16: $MGE_DISABLE_FLOAT16" echo "ARCH: $ARCH" echo "----------------------------------------------------" @@ -129,7 +122,6 @@ function cmake_build() { -DMGE_INFERENCE_ONLY=ON \ -DMGE_WITH_CUDA=OFF \ -DMGE_ARMV8_2_FEATURE_FP16= $MGE_ARMV8_2_FEATURE_FP16 \ - -DMGE_ARMV8_2_FEATURE_DOTPROD=$MGE_ARMV8_2_FEATURE_DOTPROD \ -DMGE_DISABLE_FLOAT16=$MGE_DISABLE_FLOAT16 \ -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \ ${EXTRA_CMAKE_ARGS} \ diff --git a/scripts/cmake-build/cross_build_ios_arm_inference.sh b/scripts/cmake-build/cross_build_ios_arm_inference.sh index 454d5967ba6cf6f0c4d3e175c25dead50a4bff04..196578cd105ad4afbabe78590008abef1ce48e32 100755 --- a/scripts/cmake-build/cross_build_ios_arm_inference.sh +++ b/scripts/cmake-build/cross_build_ios_arm_inference.sh @@ -4,7 +4,6 @@ set -e ARCHS=("arm64" "armv7") BUILD_TYPE=Release MGE_ARMV8_2_FEATURE_FP16=OFF -MGE_ARMV8_2_FEATURE_DOTPROD=OFF MGE_DISABLE_FLOAT16=OFF ARCH=arm64 REMOVE_OLD_BUILD=false @@ -15,7 +14,6 @@ function usage() { echo "available args detail:" echo "-d : Build with Debug mode, default Release mode" echo "-f : enable MGE_ARMV8_2_FEATURE_FP16 for ARM64, need toolchain and hardware support" - echo "-p : enable MGE_ARMV8_2_FEATURE_DOTPROD for ARM64, need toolchain and hardware support" echo "-k : open MGE_DISABLE_FLOAT16 for NEON " echo "-a : config build arch available: ${ARCHS[@]}" echo "-r : remove old build dir before make, default off" @@ -25,7 +23,7 @@ function usage() { exit -1 } -while getopts "rkhdfpa:" arg +while getopts "rkhdfa:" arg do case $arg in d) @@ -36,10 +34,6 @@ do echo "enable MGE_ARMV8_2_FEATURE_FP16 for ARM64" MGE_ARMV8_2_FEATURE_FP16=ON ;; - p) - echo "enable MGE_ARMV8_2_FEATURE_DOTPROD for ARM64" - MGE_ARMV8_2_FEATURE_DOTPROD=ON - ;; k) echo "open MGE_DISABLE_FLOAT16 for NEON" MGE_DISABLE_FLOAT16=ON @@ -78,7 +72,6 @@ echo "----------------------------------------------------" echo "build config summary:" echo "BUILD_TYPE: $BUILD_TYPE" echo "MGE_ARMV8_2_FEATURE_FP16: $MGE_ARMV8_2_FEATURE_FP16" -echo "MGE_ARMV8_2_FEATURE_DOTPROD: $MGE_ARMV8_2_FEATURE_DOTPROD" echo "MGE_DISABLE_FLOAT16: $MGE_DISABLE_FLOAT16" echo "ARCH: $ARCH" echo "----------------------------------------------------" @@ -126,7 +119,6 @@ function cmake_build() { -DPYTHON_EXECUTABLE=/usr/local/bin/python3 \ -DMGE_WITH_CUDA=OFF \ -DMGE_ARMV8_2_FEATURE_FP16= $MGE_ARMV8_2_FEATURE_FP16 \ - -DMGE_ARMV8_2_FEATURE_DOTPROD=$MGE_ARMV8_2_FEATURE_DOTPROD \ -DMGE_DISABLE_FLOAT16=$MGE_DISABLE_FLOAT16 \ -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \ ${EXTRA_CMAKE_ARGS} \ diff --git a/scripts/cmake-build/cross_build_linux_arm_inference.sh b/scripts/cmake-build/cross_build_linux_arm_inference.sh index dc1cfe258e25674583c48ba5fc773ec76d042863..2ca7b360c7f5aeaac255ce38688b80b6407a79f9 100755 --- a/scripts/cmake-build/cross_build_linux_arm_inference.sh +++ b/scripts/cmake-build/cross_build_linux_arm_inference.sh @@ -5,7 +5,6 @@ ARCHS=("arm64-v8a" "armeabi-v7a-softfp" "armeabi-v7a-hardfp") BUILD_TYPE=Release MGE_WITH_CUDA=OFF MGE_ARMV8_2_FEATURE_FP16=OFF -MGE_ARMV8_2_FEATURE_DOTPROD=OFF MGE_DISABLE_FLOAT16=OFF ARCH=arm64-v8a REMOVE_OLD_BUILD=false @@ -19,7 +18,6 @@ function usage() { echo "-d : Build with Debug mode, default Release mode" echo "-c : Build with CUDA, default without CUDA(for arm with cuda, example tx1)" echo "-f : enable MGE_ARMV8_2_FEATURE_FP16 for ARM64, need toolchain and hardware support" - echo "-p : enable MGE_ARMV8_2_FEATURE_DOTPROD for ARM64, need toolchain and hardware support" echo "-k : open MGE_DISABLE_FLOAT16 for NEON " echo "-a : config build arch available: ${ARCHS[@]}" echo "-r : remove old build dir before make, default off" @@ -29,7 +27,7 @@ function usage() { exit -1 } -while getopts "rkhdcfpa:" arg +while getopts "rkhdcfa:" arg do case $arg in d) @@ -44,10 +42,6 @@ do echo "enable MGE_ARMV8_2_FEATURE_FP16 for ARM64" MGE_ARMV8_2_FEATURE_FP16=ON ;; - p) - echo "enable MGE_ARMV8_2_FEATURE_DOTPROD for ARM64" - MGE_ARMV8_2_FEATURE_DOTPROD=ON - ;; k) echo "open MGE_DISABLE_FLOAT16 for NEON" MGE_DISABLE_FLOAT16=ON @@ -87,7 +81,6 @@ echo "build config summary:" echo "BUILD_TYPE: $BUILD_TYPE" echo "MGE_WITH_CUDA: $MGE_WITH_CUDA" echo "MGE_ARMV8_2_FEATURE_FP16: $MGE_ARMV8_2_FEATURE_FP16" -echo "MGE_ARMV8_2_FEATURE_DOTPROD: $MGE_ARMV8_2_FEATURE_DOTPROD" echo "MGE_DISABLE_FLOAT16: $MGE_DISABLE_FLOAT16" echo "ARCH: $ARCH" echo "----------------------------------------------------" @@ -147,7 +140,6 @@ function cmake_build() { -DMGE_INFERENCE_ONLY=ON \ -DMGE_WITH_CUDA=$MGE_WITH_CUDA \ -DMGE_ARMV8_2_FEATURE_FP16= $MGE_ARMV8_2_FEATURE_FP16 \ - -DMGE_ARMV8_2_FEATURE_DOTPROD=$MGE_ARMV8_2_FEATURE_DOTPROD \ -DMGE_DISABLE_FLOAT16=$MGE_DISABLE_FLOAT16 \ -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \ ${EXTRA_CMAKE_ARGS} \ diff --git a/src/megbrain_build_config.h.in b/src/megbrain_build_config.h.in index 08c25954d59a476668e3f2c6245e9723cdaefe8b..1deb8256fc4098bd64a752b028c2883b7df9c212 100644 --- a/src/megbrain_build_config.h.in +++ b/src/megbrain_build_config.h.in @@ -93,11 +93,6 @@ #define MGB_ENABLE_CPUINFO 1 #endif -#ifdef IOS -#undef MGB_ENABLE_CPUINFO -#define MGB_ENABLE_CPUINFO 0 -#endif - //! use one MACRO indicate enable_arm_dotprod #if __ARM_FEATURE_DOTPROD #ifdef MGB_ENABLE_DOT @@ -117,7 +112,12 @@ #endif #endif - +//! IOS disabled cpuinfo and dotprod, cpuinfo has some problem on ios +#ifdef IOS +#undef MGB_ENABLE_CPUINFO +#define MGB_ENABLE_CPUINFO 0 +#undef MGB_ENABLE_DOT +#endif // whether to include actual class name in mgb::Typeinfo object; if this is // disabled, mgb::serialization::OprRegistry::find_opr_by_name would not work.