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 decoupling] remove dependency on "paddle/fluid/operators/elementwise/xxx.h" in phi #47870

Merged
merged 6 commits into from
Nov 15, 2022

Conversation

huangjiyi
Copy link
Member

@huangjiyi huangjiyi commented Nov 10, 2022

PR types

Others

PR changes

Others

Describe

remove dependency on "paddle/fluid/operators/elementwise/xxx.h" in phi, including elementwise_op_function.h and elementwise_op_impl.cu.h.

changes:

  1. #include "paddle/fluid/operators/elementwise/elementwise_op_impl.cu.h" 替换为 #include "paddle/phi/kernels/funcs/elementwise_base.h".
  2. paddle::operators:LaunchSameDimsElementwiseCudaKernel 替换为 phi::funcs::ElementwiseKernel
  3. 去除 viterbi_decode_kernel.cu 中的 #include "paddle/fluid/operators/elementwise/elementwise_op_function.h",并将 paddle::operators::LaunchElementwiseCudaKernel 替换为 phi::funcs::BroadcastKernel,同时添加 #include "paddle/phi/kernels/funcs/broadcast_function.h".

@paddle-bot
Copy link

paddle-bot bot commented Nov 10, 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 10, 2022
rm indirect dependence to "elementwise_op_impl.cu.h"

Revert "add LaunchElementwiseCudaKernel in phi"

This reverts commit 588f45b.

add LaunchElementwiseCudaKernel in phi

fix bugs
@@ -882,6 +882,38 @@ void ElementwiseKernel(const KPDevice &ctx,
}
}

template <typename OutT, typename Functor, int NumOuts = 1>
void LaunchSameDimsElementwiseCudaKernel(
Copy link
Contributor

Choose a reason for hiding this comment

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

不需要把这个函数移过来,通过分析其逻辑可以看出,其本质调用的ElementwiseKernel,所以直接把使用这个函数的地方替换成ElementwiseKernel即可,另外如果后续需要移动函数,需要把原函数删掉,防止维护重复代码,增加工作量

Copy link
Member Author

Choose a reason for hiding this comment

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

好的

@luotao1
Copy link
Contributor

luotao1 commented Nov 14, 2022

@YuanRisheng 修改后的 CI 已经全部通过,可以再次 review 了。

@YuanRisheng YuanRisheng merged commit 04c2955 into PaddlePaddle:develop Nov 15, 2022
@huangjiyi huangjiyi deleted the decouple_elementwise branch November 16, 2022 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants