diff --git a/dnn/src/fallback/conv_bias/conv1x1/conv1x1_utils.cpp b/dnn/src/fallback/conv_bias/conv1x1/conv1x1_utils.cpp index 2d899a6f325acbd61ced3680d4494177e779c371..e909443063f2d33d9c5ba1183140f59617b92857 100644 --- a/dnn/src/fallback/conv_bias/conv1x1/conv1x1_utils.cpp +++ b/dnn/src/fallback/conv_bias/conv1x1/conv1x1_utils.cpp @@ -17,7 +17,7 @@ WorkspaceBundle get_thread_bundle( (param.src_type.enumv() == DTypeEnum::Quantized8Asymm && param.dst_type.enumv() == DTypeEnum::Quantized8Asymm); size_t matmul_dst_bytes_per_thread = - is_dst_8bit ? oc_tile_size * OH * OW * sizeof(param.bias_type) : 0; + is_dst_8bit ? oc_tile_size * OH * OW * param.bias_type.size() : 0; return WorkspaceBundle{nullptr, {matmul_c_size, matmul_dst_bytes_per_thread}}; } diff --git a/dnn/src/fallback/conv_bias/im2col/algos.cpp b/dnn/src/fallback/conv_bias/im2col/algos.cpp index cdad66974c69b84cc105fc2638bcb7f05f565e8c..5b28e90434001796dbda68c2f378c389b98e3509 100644 --- a/dnn/src/fallback/conv_bias/im2col/algos.cpp +++ b/dnn/src/fallback/conv_bias/im2col/algos.cpp @@ -199,8 +199,7 @@ static WorkspaceBundle get_bundle( if (no_need_pading) { padding = 0; //! not need padding } else { - padding = - (GROUP * N * IC * IH2 * IW2) * sizeof(param.src_type); //! for padding + padding = (GROUP * N * IC * IH2 * IW2) * param.src_type.size(); //! for padding } packa_size = GROUP * packa_group_size; //! for packA size = GROUP * a_size diff --git a/dnn/src/fallback/conv_bias/im2col/im2col_kerns.h b/dnn/src/fallback/conv_bias/im2col/im2col_kerns.h index fb86ff56e7e1b8b04fd07f10f7201c572a00fa7b..143e14fb1305ae3afe024596ef1058cf79d56877 100644 --- a/dnn/src/fallback/conv_bias/im2col/im2col_kerns.h +++ b/dnn/src/fallback/conv_bias/im2col/im2col_kerns.h @@ -146,15 +146,15 @@ public: size_t im2col = 0, packb = 0, bias_temp = 0; bool default_pack = matmul_algo->packmode() == Pack_Mode::DEFAULT; megdnn_assert(default_pack, "only support default packa"); - size_t im2col_dst_size = IC * FH * FW * ohw_tile_size * sizeof(param.src_type); + size_t im2col_dst_size = IC * FH * FW * ohw_tile_size * param.src_type.size(); size_t matmul_dst_size = - pack_oc_size * oc_tile_size * ohw_tile_size * sizeof(param.bias_type); + pack_oc_size * oc_tile_size * ohw_tile_size * param.bias_type.size(); //! matmul_dst and im2col_dst use the same memory WorkspaceBundle wb = matmul_algo->get_bundle(im2col_kern_param); packb = wb.get_size(1); im2col = std::max(im2col_dst_size, matmul_dst_size); if (param.bias_mode == megdnn::BiasMode::BIAS) { - bias_temp = oc_tile_size * ohw_tile_size * sizeof(param.bias_type); + bias_temp = oc_tile_size * ohw_tile_size * param.bias_type.size(); } return {nullptr, {packb, im2col, bias_temp}}; } @@ -231,15 +231,15 @@ public: size_t im2col = 0, packb = 0, matmul_dst = 0, bias_temp = 0; bool only_packA = matmul_algo->packmode() == Pack_Mode::ONLY_PACKA; megdnn_assert(only_packA, "onlysupport onlypackA mode"); - size_t im2col_dst_size = IC * FH * FW * ohw_tile_size * sizeof(param.src_type); - size_t matmul_dst_size = oc_tile_size * ohw_tile_size * sizeof(param.bias_type); + size_t im2col_dst_size = IC * FH * FW * ohw_tile_size * param.src_type.size(); + size_t matmul_dst_size = oc_tile_size * ohw_tile_size * param.bias_type.size(); //! matmul_dst and im2col_dst use the same memory WorkspaceBundle wb = matmul_algo->get_bundle(im2col_kern_param); packb = wb.get_size(1); im2col = im2col_dst_size; matmul_dst = matmul_dst_size; if (param.bias_mode == megdnn::BiasMode::BIAS) { - bias_temp = oc_tile_size * ohw_tile_size * sizeof(param.bias_type); + bias_temp = oc_tile_size * ohw_tile_size * param.bias_type.size(); } return {nullptr, {packb, im2col, matmul_dst, bias_temp}}; @@ -309,8 +309,8 @@ public: param.dst_type.enumv() == DTypeEnum::QuantizedS8) || (param.src_type.enumv() == DTypeEnum::Quantized8Asymm && param.dst_type.enumv() == DTypeEnum::Quantized8Asymm); - size_t im2col_dst_size = IC * FH * FW * ohw_tile_size * sizeof(param.src_type); - size_t matmul_dst_size = oc_tile_size * ohw_tile_size * sizeof(param.bias_type); + size_t im2col_dst_size = IC * FH * FW * ohw_tile_size * param.src_type.size(); + size_t matmul_dst_size = oc_tile_size * ohw_tile_size * param.bias_type.size(); im2col = im2col_dst_size; if (is_dst_8bit) { matmul_dst = matmul_dst_size; @@ -319,9 +319,8 @@ public: } matmul_compute = matmul_algo->get_workspace(im2col_kern_param); if (param.bias_mode == megdnn::BiasMode::BIAS) { - bias_temp = oc_tile_size * ohw_tile_size * sizeof(param.bias_type); + bias_temp = oc_tile_size * ohw_tile_size * param.bias_type.size(); } - return {nullptr, {im2col, matmul_dst, bias_temp, matmul_compute}}; } };