@@ -1707,8 +1707,10 @@ bool get_backward_slice_info(LgInfo &lg_info, slice_info_t &in_si,
17071707 bool support_hw_margin = module::isBM1684XFamily ();
17081708 if (auto conv_op = dyn_cast<tpu::Conv2DOp>(op)) {
17091709 auto attr = getConv2DParam (conv_op);
1710- bool support_dwconv2d_hw_margin = attr.is_dw ;
1711- support_hw_margin = support_hw_margin && support_dwconv2d_hw_margin;
1710+ if (!attr.is_dw &&
1711+ (module::getCoreNum () > 1 || attr.dh > 1 || attr.dw > 1 )) {
1712+ support_hw_margin = false ;
1713+ }
17121714 }
17131715 if (shape_secs.dsecs == 1 ) {
17141716 in_si.d .emplace_back (slice_pair_t (0 , d));
@@ -2205,11 +2207,14 @@ static bool backward_update_slice(
22052207 // has no backend support.)
22062208 auto tpukernel_support_HWmargins = [&lg_info](Operation *op) -> bool {
22072209 if (auto conv_op = dyn_cast<tpu::Conv2DOp>(op)) {
2208- auto attr = getConv2DParam (conv_op);
2209- bool support_dwconv2d_hw_margin =
2210- module::isBM1684XFamily () && attr.is_dw ;
2211- if (support_dwconv2d_hw_margin) {
2212- return true ;
2210+ if (module::isBM1684XFamily ()) {
2211+ auto attr = getConv2DParam (conv_op);
2212+ if (attr.is_dw ) {
2213+ return true ;
2214+ }
2215+ if (module::getCoreNum () == 1 && attr.dh == 1 && attr.dw == 1 ) {
2216+ return true ;
2217+ }
22132218 }
22142219 // Note: backend function is incomplete, feel free to complete it
22152220 // Realizing this functionality could lead to significant rewards.
0 commit comments