!32069 [MS][LITE][Develop] fix vs build and high version ndk build

Merge pull request !32069 from sunsuodong/fix_build
This commit is contained in:
i-robot 2022-03-28 09:17:42 +00:00 committed by Gitee
commit 6fad2e6acd
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 11 additions and 12 deletions

View File

@ -23,11 +23,6 @@ void var2Invar(float *save_var, int size, float eps) {
}
}
#ifdef _MSC_VER
void backwardAll(const float *in, const float *yt, const float *mean, const float *invar, const float *scale, int size,
int ch, float *dbias, float *dscale, float *dx, bool is_train) {
#else
static void backwardComputeDx(const float *in, const float *yt, const float *mean, const float *invar,
const float *scale, int size, int ch, const float *dbias, const float *dscale, float *dx,
float N, bool is_train) {
@ -44,6 +39,10 @@ static void backwardComputeDx(const float *in, const float *yt, const float *mea
}
}
#ifdef _MSC_VER
void backwardAll(const float *in, const float *yt, const float *mean, const float *invar, const float *scale, int size,
int ch, float *dbias, float *dscale, float *dx, bool is_train) {
#else
void backwardAll(const float *restrict in, const float *restrict yt, const float *restrict mean,
const float *restrict invar, const float *restrict scale, int size, int ch, float *restrict dbias,
float *restrict dscale, float *restrict dx, bool is_train) {

View File

@ -329,6 +329,13 @@ if(MSLITE_ENABLE_CONVERTER)
add_compile_definitions(ENABLE_CONVERTER)
endif()
if(MSLITE_ENABLE_FP16 AND PLATFORM_ARM32 AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 12.0)
message(STATUS "If you want to build fp16 in arm82_a32, please use android nkd r21e or r22b!")
set(MSLITE_ENABLE_FP16 off)
endif()
endif()
message(STATUS "************MindSpore Lite Build Option:************")
message(STATUS "\tMSLITE_GPU_BACKEND = \t${MSLITE_GPU_BACKEND}")
message(STATUS "\tMSLITE_REGISTRY_DEVICE = \t${MSLITE_REGISTRY_DEVICE}")
@ -383,13 +390,6 @@ if(((MSLITE_GPU_BACKEND STREQUAL tensorrt) OR MSLITE_ENABLE_NPU) AND (
as off and MSLITE_GPU_BACKEND nor can it be configured as tensorrt.")
endif()
if(MSLITE_ENABLE_FP16 AND PLATFORM_ARM32 AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang"
AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
message(STATUS "If you want to build fp16 in arm82_a32, \
your Clang version:[${CMAKE_CXX_COMPILER_VERSION}] must not be less than 9.0 and please use android nkd r21e!")
set(MSLITE_ENABLE_FP16 off)
endif()
if(MSLITE_ENABLE_HIGH_PERFORMANCE)
add_compile_definitions(ENABLE_HIGH_PERFORMANCE)
endif()