From 198f3eb5f6706d83966319373cac084a33945e54 Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Thu, 4 Jun 2020 19:29:40 +0800 Subject: [PATCH] fix(dnn/arm): fix fp32 nchw44 direct workspace bug GitOrigin-RevId: 6ee433b02c31c40c154b9d22ad9116fd9afc38a7 --- .../arm_common/conv_bias/fp32/f32_direct_nchw44_algo.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/dnn/src/arm_common/conv_bias/fp32/f32_direct_nchw44_algo.cpp b/dnn/src/arm_common/conv_bias/fp32/f32_direct_nchw44_algo.cpp index a024525e..b1ee38aa 100644 --- a/dnn/src/arm_common/conv_bias/fp32/f32_direct_nchw44_algo.cpp +++ b/dnn/src/arm_common/conv_bias/fp32/f32_direct_nchw44_algo.cpp @@ -37,19 +37,20 @@ static inline size_t get_perthread_cache_bytes(const int ic, const int ih2, static void get_rectified_size( const megdnn::fallback::ConvBiasImpl::NCBKernSizeParam& param, int& ih2, int& iw2, int& oh2, int& ow2) { + constexpr int cacheline = 64 / sizeof(float); int ic = param.filter_meta.icpg; int iw = param.isz[1]; int oh = param.osz[0]; int ow = param.osz[1]; - - oh2 = oh; - ow2 = ow; - constexpr int cacheline = 64 / sizeof(float); - int block_oh = - l2_block_helper(param.nr_threads, oh, ic * iw * sizeof(float) * 2); auto&& fm = param.filter_meta; const int stride_h = static_cast(fm.stride[0]); const int filter_h = static_cast(fm.spatial[0]); + + oh2 = oh; + ow2 = ow; + + int block_oh = l2_block_helper(param.nr_threads, oh, + ic * iw * sizeof(float) * stride_h); ih2 = block_oh * stride_h + filter_h - stride_h; iw2 = round_up(iw + 2 * static_cast(fm.padding[1]), cacheline); }