Skip to content

[PHI] migrating Squeeze2 and reshape2 #46331

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

Closed
wants to merge 27 commits into from

Conversation

sfraczek
Copy link
Contributor

@sfraczek sfraczek commented Sep 20, 2022

PR types

Function optimization

PR changes

OPs

Describe

Migration of reshape2 and squeeze2 from fluid to phi.

@paddle-bot
Copy link

paddle-bot bot commented Sep 20, 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.

by explicitly specifying template args to call to ReshapeKernel in ReshapeWithXShape
@sfraczek sfraczek requested a review from jakpiase September 21, 2022 13:09
@sfraczek

This comment was marked as resolved.

@sfraczek sfraczek marked this pull request as ready for review September 23, 2022 08:49
paulinagacek
paulinagacek previously approved these changes Sep 23, 2022
Copy link
Contributor

@paulinagacek paulinagacek left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -104,21 +104,16 @@ class ReshapeMKLDNNKernel : public framework::OpKernel<T> {
}

void InferInOutShape(const framework::ExecutionContext& ctx,

Copy link
Member

Choose a reason for hiding this comment

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

remove empty line

capacity));
}
}
return make_ddim(output_shape);
Copy link
Member

Choose a reason for hiding this comment

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

This method is already implemented in paddle/phi/infermeta/unary.cc. Maybe it's better to import header and call that implementation instead of copying it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This method is not exported in header (unary.h) so it's invisible.

@sfraczek sfraczek requested a review from chenwhql September 23, 2022 13:39
Copy link
Contributor

@YuanRisheng YuanRisheng left a comment

Choose a reason for hiding this comment

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

The CI-coverage is not successful. Please check if the ReshapeKernel and SqueezeKernel are called. Check these unittests:test_reshape_mkldnn_op and test_squeeze2_mkldnn_op with Paddle that is not compiled with cuda. If they are called, I will mark this ci as successful. Otherwise, I will help you to find the reason why they are not called.

@sfraczek
Copy link
Contributor Author

sfraczek commented Sep 26, 2022

The CI-coverage is not successful. Please check if the ReshapeKernel and SqueezeKernel are called. Check these unittests:test_reshape_mkldnn_op and test_squeeze2_mkldnn_op with Paddle that is not compiled with cuda. If they are called, I will mark this ci as successful. Otherwise, I will help you to find the reason why they are not called.

When I run the test test_reshape_mkldnn_op I have 4 errors on my branch and on develop the same. The errors regard bfloat on plain CPU library. They say something about missing shape variable.
I see only the default cpu reshape kernel executed. Old and new mkldnn kernel is not executed. Please help me find out why. I haven't checked squeeze yet.

@sfraczek
Copy link
Contributor Author

@YuanRisheng I would also like to register this kernel only for float and bfloat but I didn't know how, this macro seems to ignore dtype.

@YuanRisheng
Copy link
Contributor

YuanRisheng commented Sep 27, 2022

@YuanRisheng I would also like to register this kernel only for float and bfloat but I didn't know how, this macro seems to ignore dtype.

Well, I find out the truth of the bug:#35781. The mkldnn kernel of Reshape2 and Squeeze2 have bugs and have been disabled last year. So, there are 2 options you can choose:
1, Delete the code of Reshape2 and Squeeze2 and they will not migrated to PHI.
2, Fix these two kernels' bugs and migrate to PHI

I suggest the first option, because these two kernels are not used at all now and it is simple. @sfraczek

@sfraczek
Copy link
Contributor Author

@YuanRisheng I would also like to register this kernel only for float and bfloat but I didn't know how, this macro seems to ignore dtype.

Well, I find out the truth of the bug:#35781. The mkldnn kernel of Reshape2 and Squeeze2 have bugs and have been disabled last year. So, there are 2 options you can choose: 1, Delete the code of Reshape2 and Squeeze2 and they will not migrated to PHI. 2, Fix these two kernels' bugs and migrate to PHI

I suggest the first option, because these two kernels are not used at all now and it is simple. @sfraczek

Thank you. We will try to fix it first and delay the migration.

@paddle-bot-old paddle-bot-old bot removed the contributor External developers label Oct 17, 2022
@sfraczek
Copy link
Contributor Author

waiting for #48359

@Silv3S Silv3S closed this Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants