From 2a2c1275b0b7e097a414f072f3dab0da24380552 Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Wed, 29 Jun 2022 18:36:00 +0800 Subject: [PATCH] fix(dnn): correctly using MEGDNN_DISABLE_FLOAT16 directives GitOrigin-RevId: c6b124f195c9fc3a830bb058797d7d5619aad72d --- dnn/src/arm_common/conv_bias/f16/direct_nchw88_algo.cpp | 1 + dnn/src/common/rounding_converter.cuh | 4 ++-- dnn/src/cuda/warp_perspective/forward.cpp | 4 ++-- dnn/src/cuda/warp_perspective/forward.cu | 4 ++-- dnn/src/fallback/powc/opr_impl.cpp | 2 +- dnn/src/naive/resize/opr_impl.cpp | 2 +- src/opr-mm/impl/megray_helper.cpp | 2 +- 7 files changed, 10 insertions(+), 9 deletions(-) diff --git a/dnn/src/arm_common/conv_bias/f16/direct_nchw88_algo.cpp b/dnn/src/arm_common/conv_bias/f16/direct_nchw88_algo.cpp index ce256662c..df72f4be7 100644 --- a/dnn/src/arm_common/conv_bias/f16/direct_nchw88_algo.cpp +++ b/dnn/src/arm_common/conv_bias/f16/direct_nchw88_algo.cpp @@ -15,6 +15,7 @@ using conv_fun = std::function; MIDOUT_DECL(megdnn_arm_common_conv_bias_fp16_nchw88) +MIDOUT_DECL(megdnn_arm_common_conv_bias_fp16_nchw88_stride1) namespace { static WorkspaceBundle get_bundle(const ConvBiasImpl::NCBKernSizeParam& param) { diff --git a/dnn/src/common/rounding_converter.cuh b/dnn/src/common/rounding_converter.cuh index 9b50eca9b..d605fae2d 100644 --- a/dnn/src/common/rounding_converter.cuh +++ b/dnn/src/common/rounding_converter.cuh @@ -14,7 +14,7 @@ struct RoundingConverter { } }; -#ifndef MEGDNN_DISABLE_FLOAT16 +#if !MEGDNN_DISABLE_FLOAT16 template <> struct RoundingConverter { @@ -32,7 +32,7 @@ struct RoundingConverter { } }; -#endif // #ifdef MEGDNN_DISABLE_FLOAT16 +#endif // #if !MEGDNN_DISABLE_FLOAT16 template <> struct RoundingConverter { diff --git a/dnn/src/cuda/warp_perspective/forward.cpp b/dnn/src/cuda/warp_perspective/forward.cpp index 03af17451..37f5c44e4 100644 --- a/dnn/src/cuda/warp_perspective/forward.cpp +++ b/dnn/src/cuda/warp_perspective/forward.cpp @@ -295,7 +295,7 @@ void WarpPerspectiveForwardImpl::exec( m_error_tracker, stream); } else if (DNN_FLOAT16_SELECT( src.layout.dtype == dtype::Float16(), false)) { -#ifndef MEGDNN_DISABLE_FLOAT16 +#if !MEGDNN_DISABLE_FLOAT16 warp_perspective::forward_proxy( is_nhwc, src.ptr(), mat.ptr(), mat_idx.raw_ptr() ? mat_idx.ptr() : nullptr, @@ -563,7 +563,7 @@ void WarpPerspectiveForwardImpl::exec( m_error_tracker, stream); } else if (DNN_FLOAT16_SELECT( src.layout.dtype == dtype::Float16(), false)) { -#ifndef MEGDNN_DISABLE_FLOAT16 +#if !MEGDNN_DISABLE_FLOAT16 SmallVector workspace_sizes{sizeof(dt_float16*) * srcs.size()}; WorkspaceBundle workspace_cpu(nullptr, workspace_sizes); auto total_workspace_size = workspace_cpu.total_size_in_bytes(); diff --git a/dnn/src/cuda/warp_perspective/forward.cu b/dnn/src/cuda/warp_perspective/forward.cu index b2adf8869..13c1b5c78 100644 --- a/dnn/src/cuda/warp_perspective/forward.cu +++ b/dnn/src/cuda/warp_perspective/forward.cu @@ -1924,7 +1924,7 @@ void forward_proxy_nchw64( cudaStream_t); INST(float) INST(uint8_t) -#ifndef MEGDNN_DISABLE_FLOAT16 +#if !MEGDNN_DISABLE_FLOAT16 INST(dt_float16) #endif INST(int8_t) @@ -1936,7 +1936,7 @@ INST(int8_t) int, int, int, ctype, BorderMode, megcore::AsyncErrorInfo*, void*, \ cudaStream_t); INST(float) -#ifndef MEGDNN_DISABLE_FLOAT16 +#if !MEGDNN_DISABLE_FLOAT16 INST(dt_float16) #endif #undef INST diff --git a/dnn/src/fallback/powc/opr_impl.cpp b/dnn/src/fallback/powc/opr_impl.cpp index 170a466f0..1cf062bbd 100644 --- a/dnn/src/fallback/powc/opr_impl.cpp +++ b/dnn/src/fallback/powc/opr_impl.cpp @@ -73,7 +73,7 @@ struct powci_general_even { template struct float_itype; -#ifndef MEGDNN_DISABLE_FLOAT16 +#if !MEGDNN_DISABLE_FLOAT16 template <> struct float_itype<2> { using type = uint16_t; diff --git a/dnn/src/naive/resize/opr_impl.cpp b/dnn/src/naive/resize/opr_impl.cpp index 661d7dc56..59ed5e027 100644 --- a/dnn/src/naive/resize/opr_impl.cpp +++ b/dnn/src/naive/resize/opr_impl.cpp @@ -84,7 +84,7 @@ ResizeImpl::KernParam ResizeImpl::KernParam::from_tensors( #define INST(_dtype) template struct ResizeImpl::KernParam<_dtype>; INST(dt_float32); -#ifndef MEGDNN_DISABLE_FLOAT16 +#if !MEGDNN_DISABLE_FLOAT16 INST(dt_float16); #endif INST(dt_int8); diff --git a/src/opr-mm/impl/megray_helper.cpp b/src/opr-mm/impl/megray_helper.cpp index d3591a378..aa8f8c10c 100644 --- a/src/opr-mm/impl/megray_helper.cpp +++ b/src/opr-mm/impl/megray_helper.cpp @@ -15,7 +15,7 @@ MegRay::DType mgb::opr::get_megray_dtype(megdnn::DType dtype) { return MegRay::DType::MEGRAY_INT32; case DTypeEnum::Float32: return MegRay::DType::MEGRAY_FLOAT32; -#ifndef MEGDNN_DISABLE_FLOAT16 +#if !MEGDNN_DISABLE_FLOAT16 case DTypeEnum::Float16: return MegRay::DType::MEGRAY_FLOAT16; #endif -- GitLab