-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Conversation
@huangzhiyuan Thanks for the contribution! |
@huangzhiyuan It seems that the PR is still failing on CI. Request you to take a look. |
@ankkhedia please take a view, ths :) |
@mxnet-label-bot update [pr-awaiting-review] |
@mxnet-label-bot add [MKLDNN] |
src/operator/tensor/matrix_op.cc
Outdated
return; | ||
} | ||
FallBackCompute(UnaryOp::IdentityCompute<cpu>, attrs, ctx, inputs, req, | ||
outputs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indent.
@@ -261,7 +317,9 @@ Example:: | |||
.set_num_outputs(1) | |||
.set_attr<nnvm::FInferShape>("FInferShape", FlattenShape) | |||
.set_attr<nnvm::FInferType>("FInferType", ElemwiseType<1, 1>) | |||
#if MXNET_USE_MKLDNN == 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If MKLDNN supports this op, please add .set_attr<bool>("TIsMKLDNN", true)
for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This attribute is in Line 327.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only some slight comments. Overall LGTM.
@@ -210,24 +272,18 @@ static void FlattenEx(const nnvm::NodeAttrs& attrs, | |||
#endif | |||
} | |||
|
|||
#if MXNET_USE_MKLDNN == 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems this will change the original behavior when MKL-DNN is not enabled. FlattenStorageType
is not defined then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is followed new style with other mkldnn op, that is, defining InferStorageType function within MKLDNN macro. Most other ops are refactored into this style by Luobao, I guess this one is missing.
src/operator/tensor/matrix_op.cc
Outdated
@@ -914,7 +972,7 @@ NNVM_REGISTER_OP(depth_to_space) | |||
.describe(R"code(Rearranges(permutes) data from depth into blocks of spatial data. | |||
Similar to ONNX DepthToSpace operator: | |||
https://github.com/onnx/onnx/blob/master/docs/Operators.md#DepthToSpace. | |||
The output is a new tensor where the values from depth dimension are moved in spatial blocks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for fixing these white spaces at line-end. Does cpplint complain about them? If not, I would like to keep them as is since these changes are not related to this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have fixed the white space same as before, could you help review again? thanks :)
Is there any unit test to cover this change? |
.set_attr<nnvm::FInferType>("FInferType", ElemwiseType<1, 1>) | ||
.set_attr<nnvm::FGradient>("FGradient", ElemwiseGradUseNone{"_backward_copy"}) | ||
.set_attr<FCompute>("FCompute<cpu>", UnaryOp::IdentityCompute<cpu>) | ||
#if MXNET_USE_MKLDNN == 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that this is not the first op which is implemented this way, but is there a reason for the two different if blocks here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing different, it has been merged into one block here. Thanks for your review! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This reverts commit c4a619c. Conflicts: src/operator/tensor/matrix_op.cc tests/python/mkl/test_mkldnn.py
Description
This PR indents to add reshape op supported by MKL-DNN. It will help reduce the unnecessary reorder operations after a MKL-DNN operation. @pengzhao-intel @ZhennanQin
Test network:
Origin verbose log:
mkldnn_verbose,exec,convolution,jit:avx512_common,forward_inference,fsrc:nchw fwei:Ohwi16o fbia:x fdst:nChw16c,alg:convolution_direct,mb4_g1ic3oc16384_ih16oh16kh1sh1dh0ph0_iw16ow16kw1sw1dw0pw0,2.08691
mkldnn_verbose,exec,reorder,jit:uni,undef,in:f32_nChw16c out:f32_nchw,num:1,4x16384x16x16,2.44995
mkldnn_verbose,exec,reorder,jit:uni,undef,in:f32_nchw out:f32_nChw16c,num:1,4x16384x16x16,1.64697
mkldnn_verbose,exec,reorder,jit:uni,undef,in:f32_nChw16c out:f32_nchw,num:1,4x16384x16x16,2.30298
mkldnn_verbose,exec,reorder,simple:any,undef,in:f32_nchw out:f32_nchw,num:1,16384x4x16x16,2.1731
mkldnn_verbose,exec,reorder,jit:uni,undef,in:f32_nchw out:f32_nChw16c,num:1,1x1024x1x16384,2.40698
mkldnn_verbose,exec,reorder,jit:uni,undef,in:f32_oihw out:f32_OIhw16i16o,num:1,16384x1024x1x1,2.29297
mkldnn_verbose,exec,convolution,jit_1x1:avx512_common,forward_inference,fsrc:nChw16c fwei:OIhw16i16o fbia:x fdst:nChw16c,alg:convolution_direct,mb1_g1ic1024oc16384_ih1oh1kh1sh1dh0ph0_iw16384ow16384kw1sw1dw0pw0,457.164
After reshape op supported by MKL-DNN verbose log:
mkldnn_verbose,exec,convolution,jit:avx512_common,forward_inference,fsrc:nchw fwei:Ohwi16o fbia:x fdst:nChw16c,alg:convolution_direct,mb4_g1ic3oc16384_ih16oh16kh1sh1dh0ph0_iw16ow16kw1sw1dw0pw0,1.86304
mkldnn_verbose,exec,reorder,simple:any,undef,in:f32_nchw16c out:f32_nchw,num:1,4x16384x16x16,2.35913
mkldnn_verbose,exec,reorder,simple:any,undef,in:f32_nchw out:f32_nchw,num:1,16x16x4x16384,1.55103
mkldnn_verbose,exec,reorder,jit:uni,undef,in:f32_nchw out:f32_nChw16c,num:1,1x1024x1x16384,2.6958
mkldnn_verbose,exec,reorder,jit:uni,undef,in:f32_oihw out:f32_OIhw16i16o,num:1,16384x1024x1x1,2.49683
mkldnn_verbose,exec,convolution,jit_1x1:avx512_common,forward_inference,fsrc:nChw16c fwei:OIhw16i16o fbia:x fdst:nChw16c,alg:convolution_direct,mb1_g1ic1024oc16384_ih1oh1kh1sh1dh0ph0_iw16384ow16384kw1sw1dw0pw0,432.984
Comments