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

[PIR] lowering group op through op fusion && fusion merge pass and kernel jit pass #58193

Merged
merged 33 commits into from
Oct 23, 2023

Conversation

phlrain
Copy link
Collaborator

@phlrain phlrain commented Oct 18, 2023

PR types

Function optimization

PR changes

Others

Description

  1. 完成group op op fusion, fusion merge 策略和jit kernel的串联工作
  2. 除group 中的input 和output 设置的问题,整体打通工作已经完成,剩余的点在于对齐性能相关的策略

TODO:
当前group中的input 和output 存在问题,pr中进行了限制,会在新PR中进行优化

Pcard-67164

@paddle-bot
Copy link

paddle-bot bot commented Oct 18, 2023

你的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
Copy link

paddle-bot bot commented Oct 18, 2023

❌ The PR is not created using PR's template. You can refer to this Demo.
Please use PR's template, it helps save our maintainers' time so that more developers get helped.

@phlrain phlrain changed the title Connect softmax all path [PIR] test op fusion && fusion merge pass with kernel jit pass Oct 19, 2023
@phlrain phlrain changed the title [PIR] test op fusion && fusion merge pass with kernel jit pass [PIR] lowering group op through op fusion && fusion merge pass and kernel jit pass Oct 19, 2023
Copy link
Contributor

@Aurelius84 Aurelius84 left a comment

Choose a reason for hiding this comment

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

孵化功能,因PR频繁被冲突,comment可以单独提PR修复,LGTM overall

namespace ir {

std::vector<pir::Value> GetBlockOutsideInput(
const std::vector<pir::Operation*> op_list) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const std::vector<pir::Operation*> op_list) {
const std::vector<pir::Operation*>& op_list) {

}

std::vector<pir::Value> GetBlockOutsideOutput(
const std::vector<pir::Operation*> op_list) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const std::vector<pir::Operation*> op_list) {
const std::vector<pir::Operation*>& op_list) {

"Only support one group after group fusion"));
for (auto group : group_list) {
auto ir_compiler =
new cinn::hlir::framework::PIRCompiler(*program, target, scope);
Copy link
Contributor

Choose a reason for hiding this comment

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

这里会有潜在的mem leak风险,如之前讨论,我们还没有确定最终如何统一管理PIRCompiler 对象,但可以先简单地用单例持有下,这样能保证退出后可以delete掉这个new的对象

return vec_res;
}

std::unique_ptr<pir::Program> CINNGroupLoweringPass(::pir::Program* program) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
std::unique_ptr<pir::Program> CINNGroupLoweringPass(::pir::Program* program) {
std::unique_ptr<pir::Program> CINNGroupLoweringPass(const ::pir::Program* program) {

这里可以const一下?

@@ -61,9 +61,11 @@ std::vector<pir::CUDAJITInfo> PIRCompiler::BuildCUDAJITInfo(

auto fn_ptrs = compiler_->GetFnPtr();

auto* compilter_ptr = compiler_.release();
Copy link
Contributor

Choose a reason for hiding this comment

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

这里release后,jit.info是不是仅持有了指向资源的指针,但其实没有负责析构(即delete)它?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

是的,这个有一个新的pr来处理这块

@phlrain phlrain merged commit f5b4ebe into PaddlePaddle:develop Oct 23, 2023
hitywt pushed a commit to hitywt/Paddle that referenced this pull request Oct 24, 2023
…rnel jit pass (PaddlePaddle#58193)

* update

* update

* revert some code

* update

* poish print

* fix compile bug

* update

* update

* polish code

* update

* update

* update

* update

* update

* remove useless code

* remove useless code

* remove useless code

* fix compile bug
jiahy0825 pushed a commit to jiahy0825/Paddle that referenced this pull request Oct 26, 2023
…rnel jit pass (PaddlePaddle#58193)

* update

* update

* revert some code

* update

* poish print

* fix compile bug

* update

* update

* polish code

* update

* update

* update

* update

* update

* remove useless code

* remove useless code

* remove useless code

* fix compile bug
danleifeng pushed a commit to danleifeng/Paddle that referenced this pull request Nov 14, 2023
…rnel jit pass (PaddlePaddle#58193)

* update

* update

* revert some code

* update

* poish print

* fix compile bug

* update

* update

* polish code

* update

* update

* update

* update

* update

* remove useless code

* remove useless code

* remove useless code

* fix compile bug
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.

3 participants