From 845f42a38bccfaaf973acd5aac6d1016eae9959f Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Mon, 6 Jul 2020 20:50:30 +0800 Subject: [PATCH] fix(midout/naive/warp_perspective): fix Template Functions instantiation GitOrigin-RevId: c487f3663dcaf1bde5c56854fcd3d51a5e8cd734 --- dnn/src/fallback/warp_perspective/opr_impl.cpp | 15 ++++++++++----- dnn/src/naive/warp_perspective/opr_impl.cpp | 18 ++++++++++++++++++ 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/dnn/src/fallback/warp_perspective/opr_impl.cpp b/dnn/src/fallback/warp_perspective/opr_impl.cpp index a17359713..61b6ba226 100644 --- a/dnn/src/fallback/warp_perspective/opr_impl.cpp +++ b/dnn/src/fallback/warp_perspective/opr_impl.cpp @@ -141,20 +141,25 @@ void WarpPerspectiveImpl::kern_fallback( if (is_resize_optimizable(sub_param.mptr)) { if (bmode == BorderMode::CONSTANT) { MIDOUT_BEGIN(megdnn_fallback_warpperspective, midout_iv(1), - midout_iv(true)) { + midout_iv(true), ctype, mtype) { kern_resize(sub_param); - } MIDOUT_END(); + } + MIDOUT_END(); } else { MIDOUT_BEGIN(megdnn_fallback_warpperspective, midout_iv(1), - midout_iv(false)) { + midout_iv(false), ctype, mtype) { kern_resize(sub_param); } MIDOUT_END(); } } else { - rep(oh, OH) kern_naive(sub_param, oh); + MIDOUT_BEGIN(megdnn_fallback_warpperspective, midout_iv(2), ctype, + mtype) { + rep(oh, OH) kern_naive(sub_param, oh); + } + MIDOUT_END(); } - sub_param.mptr += 3*3; + sub_param.mptr += 3 * 3; sub_param.dptr += C*OH*OW; } diff --git a/dnn/src/naive/warp_perspective/opr_impl.cpp b/dnn/src/naive/warp_perspective/opr_impl.cpp index f580d2c1f..9a0790675 100644 --- a/dnn/src/naive/warp_perspective/opr_impl.cpp +++ b/dnn/src/naive/warp_perspective/opr_impl.cpp @@ -148,6 +148,24 @@ void WarpPerspectiveForwardImpl::kern_naive( MIDOUT_END(); } +#define INST(ctype, mtype) \ + template void WarpPerspectiveForwardImpl::kern_naive( \ + const KernParam&, size_t); + +INST(float, float); + +#if !MEGDNN_DISABLE_FLOAT16 +INST(dt_float16, float); +INST(dt_float16, dt_float16); +INST(dt_bfloat16, float); +INST(dt_bfloat16, dt_bfloat16); +#endif + +INST(int8_t, float); +INST(uint8_t, float); + +#undef INST + template void WarpPerspectiveForwardImpl::kern_naive_nhwcd4( const KernParam& kern_param, size_t task_id) { -- GitLab