Skip to content

Conversation

@phlrain
Copy link
Collaborator

@phlrain phlrain commented Jan 4, 2024

PR types

Function optimization

PR changes

Others

Description

Pcard-67164

优化 pir compiler内部的buffer 构造逻辑,移除无用的stage的参数;该重构只是一个准备性的改造,目的是为了后续codegen阶段的逻辑优化,当前是由多处构造temp buffer的逻辑,这些逻辑相同,但是实现不统一

@paddle-bot
Copy link

paddle-bot bot commented Jan 4, 2024

你的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 Jan 4, 2024

❌ 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.

@paddle-ci-bot
Copy link

paddle-ci-bot bot commented Jan 12, 2024

Sorry to inform you that 55e869b's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

@phlrain phlrain changed the title refactor cinn pir compiler temp buffer [PIR+CINN]refactor cinn pir compiler temp buffer Jan 16, 2024

using cinn::hlir::op::ExternalApiRegistry;

// Collect the temporary tensors from a computational graph.
Copy link
Contributor

Choose a reason for hiding this comment

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

这个如果没有额外依赖的话,建议放到cinn/lang/lower.cc中,与lang::GetTempBuffers 其他函数放到一起。

Copy link
Contributor

Choose a reason for hiding this comment

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

看了下lang的namespace下已经有一个同名函数了,但可以在function name区分下?

}

std::vector<ir::Buffer> temp_buffers;
for (auto& i : name_to_buffer) temp_buffers.push_back(i.second);
Copy link
Contributor

Choose a reason for hiding this comment

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

虽然for的body只有一行,也建议用{}包裹一下

!tensor_arg_names.count(x->as_tensor()->name)) ||
utils::Endswith(x->as_tensor()->buffer->name, "temp_buffer"));
});
for (auto& e : all_temp_tensors) {
Copy link
Contributor

Choose a reason for hiding this comment

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

这里相对于旧的逻辑少了CollectIRNodesWithoutTensor,这个是符合预期的吗?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

我理解是符合预期的

Aurelius84
Aurelius84 previously approved these changes Jan 16, 2024
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.

后续我们得考虑如何清理和统一这里的逻辑,看起来已经有比较大的维护成本了

@phlrain phlrain merged commit 9cbf3ce into PaddlePaddle:develop Jan 17, 2024
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.

2 participants