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

[PHI] traspose2 kernel migration #47748

Merged
merged 18 commits into from
Nov 29, 2022
Merged

[PHI] traspose2 kernel migration #47748

merged 18 commits into from
Nov 29, 2022

Conversation

paulinagacek
Copy link
Contributor

PR types

Others

PR changes

Others

Describe

  • migrate transpose2 operator to phi

@paddle-bot
Copy link

paddle-bot bot commented Nov 7, 2022

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added contributor External developers status: proposed labels Nov 7, 2022
@CLAassistant
Copy link

CLAassistant commented Nov 7, 2022

CLA assistant check
All committers have signed the CLA.

@Silv3S Silv3S added the Intel label Nov 8, 2022
@Silv3S Silv3S self-requested a review November 9, 2022 11:14
@paulinagacek paulinagacek marked this pull request as ready for review November 14, 2022 17:26
// limitations under the License.

#include "paddle/phi/kernels/transpose_kernel.h"
#include "paddle/fluid/framework/tensor_util.h"
Copy link
Contributor

@YuanRisheng YuanRisheng Nov 15, 2022

Choose a reason for hiding this comment

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

If you use copy function in PHI, please change to copy in "paddle/phi/core/tensor_utils.h"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@YuanRisheng There is no Copy equivalent for OneDNNContext, should I leave it like this or create OneDNNContext version in paddle/phi/core/tensor_utils.cc? I tried to do it in this PR but then Copy behaved inconsistently with OneDnn

Copy link
Contributor

@YuanRisheng YuanRisheng Nov 15, 2022

Choose a reason for hiding this comment

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

@paulinagacek Oh, I see. The code of MKLDNN Copy is not implemented in paddle/phi/core/tensor_utils.cc. You may need migrate the code of MKLDNN Copy(The code is in TensorCopyImpl function) from paddle/fluid/framework/tensor_util.cc to paddle/phi/core/tensor_utils.cc. This is a necessary work for MKLDNN kernel migration. Thank you.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@YuanRisheng I think the problem with phi::Copy may have occured in previous PRs (e.g. transpose2_grad) and there TensorCopy was used instead of phi::Copy, so if I add OneDNNContext version I shoul also change it in other kernels. Can I leave TensorCopy in this PR and dedicate seperate PR for creating OneDNN version of phi::Copy?

Copy link
Contributor

Choose a reason for hiding this comment

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

That's Ok.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@YuanRisheng so could you give me approve as the check failed because that TensorCopy usage? Could you also take a look at CE-FRAMEWORK please? It fails even though there are no errors and all tests pass. Besides these two checks I think this PR is ready to merge. Thanks!

Copy link
Contributor

@YuanRisheng YuanRisheng Nov 15, 2022

Choose a reason for hiding this comment

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

@paulinagacek The CE-FRAMEWORK seems have a error. It is a OneDNN error that is unfamiliar to me. I am not sure whether this error is related to the file "operator_reshape2_onednn_fuse_pass.cc" you modified. Maybe you can rerun the CE-FRAMEWORK second time. If CE-FRAMEWORK fails again, you need deal with this issue. After all CI pass(except CI-APPROVAL), I will approve and merge this PR. Thanks.
image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@YuanRisheng now tests pass except coverage, because kernel is probably not fully covered by unit tests in fluid. May I get an approve for TensorCopy please?

Copy link
Contributor

Choose a reason for hiding this comment

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

That's OK and please create OneDNN version of phi::Copy in next PR. Thank you

@paulinagacek
Copy link
Contributor Author

@YuanRisheng, @chenwhql should I delete transpose and transpose_grad kernels from fluid as they are replaced by tranpose2 and tranpose2_grad in phi or just leave it the way it is? I mean deleting this file: paddle/fluid/operators/mkldnn/transpose_mkldnn_op.cc

@YuanRisheng
Copy link
Contributor

@YuanRisheng, @chenwhql should I delete transpose and transpose_grad kernels from fluid as they are replaced by tranpose2 and tranpose2_grad in phi or just leave it the way it is? I mean deleting this file: paddle/fluid/operators/mkldnn/transpose_mkldnn_op.cc

transpose and transpose_grad in Fluid may be used for compatible with old operators. You can just leave it the way it is.

@paulinagacek
Copy link
Contributor Author

@YuanRisheng why did you close this PR?

@YuanRisheng YuanRisheng reopened this Nov 15, 2022
@YuanRisheng
Copy link
Contributor

@YuanRisheng why did you close this PR?

Sorry,I accidentally clicked on the wrong button.

Copy link
Member

@Silv3S Silv3S left a comment

Choose a reason for hiding this comment

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

LGTM

// limitations under the License.

#include "paddle/phi/kernels/transpose_kernel.h"
#include "paddle/fluid/framework/tensor_util.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

That's OK and please create OneDNN version of phi::Copy in next PR. Thank you

@YuanRisheng YuanRisheng merged commit d86aa4c into PaddlePaddle:develop Nov 29, 2022
lxsbupt pushed a commit to lxsbupt/Paddle that referenced this pull request Dec 17, 2022
* traspose2 kernel migrated

* Got rid of mutable_data

* x modification added

* ops added in extra info file

* Formatting fix

* 2 fuse passes with tanpose2 commented

* nr of outs changed in 2 passes, passes uncommented

* Changes in passes reverted

* transpose chnaged in operator.cc

* MKLDNN check in operator.cc

* Transpose fixes

* Fix deleted from operato

* template corrected

Co-authored-by: Paulina Gacek <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers Intel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants