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] Migrate tile_op into Phi #40371

Merged
merged 4 commits into from
Mar 11, 2022
Merged

Conversation

Aurelius84
Copy link
Contributor

@Aurelius84 Aurelius84 commented Mar 9, 2022

PR types

Function optimization

PR changes

OPs

Describe

[Phi] Migrate tile_op into Phi.

@paddle-bot-old
Copy link

paddle-bot-old bot commented Mar 9, 2022

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

namespace paddle {
namespace operators {

inline std::vector<int> get_repeat_times(
Copy link
Contributor

Choose a reason for hiding this comment

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

get_repeat_times 要不要改为驼峰命名?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这个函数只在fluid 下的XPU/NPU使用,因此两个设备的Kernel未在此PR迁移,因此此处仅做拆分。

out->set_dims(phi::make_ddim(out_shape));
if (out_shape[0] == x_dims[0]) {
out->share_lod(x);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

out 设置一下dtype

Copy link
Contributor Author

Choose a reason for hiding this comment

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

我在adam的PR里改,这个PR是否可以先合入。

Copy link
Contributor

Choose a reason for hiding this comment

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

好的

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if (just_copy) {
dev_ctx.template Alloc<T>(x_grad);

paddle::framework::TensorCopy(
Copy link
Contributor

Choose a reason for hiding this comment

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

可以尝试使用phi下的copy来替代

Copy link
Contributor Author

Choose a reason for hiding this comment

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

我在adam的PR改

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -0,0 +1,67 @@
// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

这个文件里的内容或许可以迁到funcs下,将传入的context变成,多个参数传入

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这个函数只在fluid 下的XPU/NPU使用,因此两个设备的Kernel未在此PR迁移,因此此处仅做拆分。

Copy link
Contributor

@chenwhql chenwhql left a comment

Choose a reason for hiding this comment

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

细节后续按建议再完善下

@Aurelius84 Aurelius84 merged commit 282cba4 into PaddlePaddle:develop Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants