From a9d2e255f5cd37fcecb9238d77b530f21bcbb890 Mon Sep 17 00:00:00 2001 From: yangzhenzhang Date: Wed, 12 Jan 2022 15:57:28 +0800 Subject: [PATCH] support single direction exchange for conv2d --- mindspore/OWNERS | 1 + .../frontend/parallel/ops_info/conv2d_info.cc | 6 ------ tests/ut/python/parallel/test_conv2d.py | 16 +++++++--------- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/mindspore/OWNERS b/mindspore/OWNERS index 48c121c912e..e591d1ac399 100644 --- a/mindspore/OWNERS +++ b/mindspore/OWNERS @@ -8,3 +8,4 @@ approvers: - liangchenghui - wuxuejian - gaoxiong1 +- yangzhenzhang diff --git a/mindspore/ccsrc/frontend/parallel/ops_info/conv2d_info.cc b/mindspore/ccsrc/frontend/parallel/ops_info/conv2d_info.cc index c64fe5eafae..42f58cbb501 100644 --- a/mindspore/ccsrc/frontend/parallel/ops_info/conv2d_info.cc +++ b/mindspore/ccsrc/frontend/parallel/ops_info/conv2d_info.cc @@ -172,12 +172,6 @@ Status Conv2DInfo::CheckHWStrategySameModeByDimension(int64_t strategy, const st << " when kernel_size > stride but slice shape is smaller than or equal to (k - s + 1) / 2"; return FAILED; } - - if (h_or_w_kernel_size - h_or_w_stride == 1) { - MS_LOG(ERROR) << name_ << ": The 'same' mode do not support to split " << dimension - << " when kernel_size > stride but k - s == 1"; - return FAILED; - } } return SUCCESS; } diff --git a/tests/ut/python/parallel/test_conv2d.py b/tests/ut/python/parallel/test_conv2d.py index 169ca0329b7..e5581a5cf9f 100644 --- a/tests/ut/python/parallel/test_conv2d.py +++ b/tests/ut/python/parallel/test_conv2d.py @@ -207,16 +207,15 @@ def test_conv2d_model_parallel4(): def test_conv2d_left_and_right_no_need_to_send(): """ - Feature: same mode, k - s = 1, left pad is 0 - Description: do not support that the left no need to send - Expectation: compile failed + Feature: same mode, k - s = 1, left pad is 0, single direction exchange + Description: support that the left no need to send + Expectation: compile success """ context.set_auto_parallel_context(parallel_mode="semi_auto_parallel", device_num=8, global_rank=0) strategy1 = ((2, 1, 1, 4), (1, 1, 1, 1)) strategy2 = ((2, 1, 1, 4),) net = Net(_w2, out_channel=8, kernel_size=3, pad_mode="same", stride=2, strategy1=strategy1, strategy2=strategy2) - with pytest.raises(RuntimeError): - compile_net(net) + compile_net(net) def test_conv2d_kernel_size_larger_than_stride_and_split_h(): @@ -402,16 +401,15 @@ def test_conv2d_same_mode_overlap_size_equal_to_slice_shape(): def test_kernel_size_larger_than_stride_and_left_pad_is_0(): """ - Feature: same mode, kernel_size > stride and left pad is 0 + Feature: same mode, kernel_size > stride and left pad is 0, single direction exchange Description: split w - Expectation: compile failed + Expectation: compile success """ context.set_auto_parallel_context(parallel_mode="semi_auto_parallel", device_num=8, global_rank=0) strategy1 = ((1, 1, 1, 4), (1, 1, 1, 1)) strategy2 = ((1, 1, 1, 8),) net = Net(_w1, out_channel=8, kernel_size=2, pad_mode="same", stride=1, strategy1=strategy1, strategy2=strategy2) - with pytest.raises(RuntimeError): - compile_net(net) + compile_net(net) def test_conv2d_kernel_size_larger_than_stride_and_split_nchw():