From 5d31810bca14edfa3a2896696bde46237d18e1b2 Mon Sep 17 00:00:00 2001 From: sunsuodong Date: Sat, 26 Mar 2022 03:09:25 -0700 Subject: [PATCH] fix build --- .../device/cpu/kernel/nnacl/fp32_grad/batch_norm.c | 9 ++++----- mindspore/lite/CMakeLists.txt | 14 +++++++------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/fp32_grad/batch_norm.c b/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/fp32_grad/batch_norm.c index b4d97a3c77a..122e7116f4f 100644 --- a/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/fp32_grad/batch_norm.c +++ b/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/fp32_grad/batch_norm.c @@ -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) { diff --git a/mindspore/lite/CMakeLists.txt b/mindspore/lite/CMakeLists.txt index 88509e41d89..fd4ac9d7ad2 100644 --- a/mindspore/lite/CMakeLists.txt +++ b/mindspore/lite/CMakeLists.txt @@ -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()