Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[CINN][Backend Pass Update No.9] Update RemoveScheduleBlock pass #70334

Merged

Conversation

LittleHeroZZZX
Copy link
Contributor

PR Category

CINN

PR Types

Improvements

Description

改造了 RemoveScheduleBlock pass

Copy link

paddle-bot bot commented Dec 19, 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 paddle-bot bot added the contributor External developers label Dec 19, 2024
@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label Dec 19, 2024
@Hongqing-work
Copy link
Contributor

把注释迁移过来吧😂

Comment on lines 60 to 71
void VisitExpr(ir::Expr* expr) {
if (expr->is_var()) {
if (expr->as_var()->name == var_->name && (do_replace_ || visit_all_)) {
Expr copied = ir::ir_utils::IRCopy(expr_);
*expr = copied;
}
return;
}
for (auto field : (*expr)->expr_fields()) {
VisitExpr(field);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Expr也不用特殊实现了,直接调用默认visit函数就行

Copy link
Contributor Author

Choose a reason for hiding this comment

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

默认Visit是指 IRMutator::Visit嘛,不是说升级以后的Visit会被删除嘛?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Expr也不用特殊实现了,直接调用默认visit函数就行

BTW,为啥原来的Mutator的Visit方法都要传两个参数进去,不太理解

Copy link
Contributor

Choose a reason for hiding this comment

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

默认Visit是指 IRMutator::Visit嘛,不是说升级以后的Visit会被删除嘛?

升级之后,属于Stmt的visit函数会被删除,但是Expr还是必须按照这种方式访问,我们后续会把IRMutator的visit限定在Expr。原来的Visit方法传两个参数是为了区分const访问和非const访问,但是这种实现方式确实设计得有点奇怪。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK,已经改过了,麻烦您再看一下

@Hongqing-work Hongqing-work merged commit c6751b2 into PaddlePaddle:develop Dec 23, 2024
28 checks passed
@LittleHeroZZZX LittleHeroZZZX deleted the dev_removeScheduleBlockPass branch December 23, 2024 04:25
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
contributor External developers HappyOpenSource 快乐开源活动issue与PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants