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

[CINN][Backend Pass Update No.5] Update ir_simplify pass #70666

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

Albresky
Copy link
Contributor

@Albresky Albresky commented Jan 7, 2025

PR Category

CINN

PR Types

Improvements

Description

改造了 IR Simplify Pass

Copy link

paddle-bot bot commented Jan 7, 2025

你的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 the contributor External developers label Jan 7, 2025
@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label Jan 8, 2025
Comment on lines 49 to 50
struct SimplifyNoPureMathMutator : public ir::IRMutator<ir::Expr*>,
public ir::stmt::StmtMutator<> {
Copy link
Contributor

Choose a reason for hiding this comment

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

这里不需要再改写了,用ExprPass即可,PassManager会遍历所有Statement内部的Expr进行改造

Comment on lines 144 to 145
struct SimplifyLoadMutator : public ir::IRMutator<ir::Expr*>,
public ir::stmt::StmtMutator<> {
Copy link
Contributor

Choose a reason for hiding this comment

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

同上,且这里For不需要特殊实现了

Comment on lines 229 to 235
struct SimplifyStoreMutator : public ir::IRMutator<ir::Expr*>,
public ir::stmt::StmtMutator<> {
void operator()(Expr* x) { ir::IRMutator<ir::Expr*>::Visit(x, x); }

void operator()(ir::stmt::BlockRef block) {
ir::stmt::StmtMutator<>::VisitBlock(block);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

这里也不需要继承这两个Mutator,直接针对特定Statement改造就行

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的

@Hongqing-work
Copy link
Contributor

需要再确认一下使用何种Pass进行修改

// TODO(Albresky): Is this pass necessary in stmt-based new IR? If so,
// we cannot obtain the father node of the current block, so how to
// reduce the nested unnecessary block?
struct SimplifyBlocksMutator : public ir::IRMutator<> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Hongqing-work Hi,我有个疑问。请问在改造后的新 IR 中,是否还存在这种两个 Block 嵌套的情况?如果有,父亲 Block 应该在当前 Block 的 scope 外,此时如何将当前 Block 的 stmt 合并到父亲呢?

Copy link
Contributor

Choose a reason for hiding this comment

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

目前应该不会了,这个改动可以删除

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers HappyOpenSource 快乐开源活动issue与PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants