Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix x86 depthwise conv2d alter_op_layout #3264

Merged
merged 8 commits into from
Jun 6, 2019

Conversation

kevinthesun
Copy link
Contributor

Fix x86 depthwise conv2d alter_op_layout. Related discussion topic: https://discuss.tvm.ai/t/x86-relay-auto-tune-mobilefacenet-error-using-relay/2508/22

@tqchen tqchen added status: need test case need test cases to cover the change status: need review labels May 31, 2019
@@ -415,7 +415,8 @@ def _alter_conv2d_layout(attrs, inputs, tinfo, F):

dtype = data.dtype
out_dtype = dtype if out_dtype in ("same", "") else out_dtype
is_depthwise = groups == in_channel and groups == out_channel
kshape = get_const_tuple(kernel.shape)
is_depthwise = groups == kshape[0] and kshape[1] == 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to check kernel layout?

@kevinthesun kevinthesun force-pushed the MoveX86DepthwiseConv branch from 0a6a274 to 39c622e Compare June 3, 2019 20:30
@@ -415,11 +415,15 @@ def _alter_conv2d_layout(attrs, inputs, tinfo, F):

dtype = data.dtype
out_dtype = dtype if out_dtype in ("same", "") else out_dtype
is_depthwise = groups == in_channel and groups == out_channel

# only optimize for NCHW
if layout != 'NCHW':
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if layout != 'NCHW':
if layout != 'NCHW' or attrs["kernel_layout"] != "OIHW":

and remove the assert below.

@yzhliu yzhliu merged commit d7bc4fd into apache:master Jun 6, 2019
@yzhliu
Copy link
Member

yzhliu commented Jun 6, 2019

Thanks @kevinthesun !

@yzhliu yzhliu added status: accepted and removed status: need review status: need test case need test cases to cover the change labels Jun 6, 2019
@kevinthesun kevinthesun deleted the MoveX86DepthwiseConv branch June 13, 2019 20:10
wweic pushed a commit to wweic/tvm that referenced this pull request Jun 26, 2019
* Fix x86 depthwise conv2d alter_op_layout

* Small fix

* Add test case

* Fix test

* Assert kernel layout

* Minor fix

* Add get_shape function

* Minor change
wweic pushed a commit to neo-ai/tvm that referenced this pull request Jun 27, 2019
* Fix x86 depthwise conv2d alter_op_layout

* Small fix

* Add test case

* Fix test

* Assert kernel layout

* Minor fix

* Add get_shape function

* Minor change
@apivovarov
Copy link
Contributor

@kevinthesun Looks like this PR makes autotvm to "skips depthwise_conv2d_nchw workloads for llvm x86_64"
More details: https://discuss.tvm.ai/t/autotvm-skips-depthwise-conv2d-nchw-workloads-for-llvm-x86-64/3353/1

@apivovarov
Copy link
Contributor

apivovarov commented Jul 17, 2019

Issue: #3557

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants