-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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.11] Update schedule_block_dce pass #70498
base: develop
Are you sure you want to change the base?
[CINN][Backend Pass Update No.11] Update schedule_block_dce pass #70498
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
#include "paddle/cinn/optim/schedule_block_dce.h" | ||
#include "paddle/cinn/optim/schedule_block_dce_pass.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
没有用到的头文件直接删除吧,下同
@@ -14,6 +14,7 @@ | |||
|
|||
#pragma once | |||
|
|||
#include "paddle/cinn/ir/utils/stmt_converter.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里头文件不需要stmt_converter.h吧
void VisitStmt(IfThenElse stmt) override { | ||
VisitBlock(stmt->true_case()); | ||
if (stmt->false_case().defined()) { | ||
VisitBlock(stmt->false_case()); | ||
} | ||
if (IsEmptyIf(stmt)) { | ||
const BlockRef empty_block = _Block_::Make({}); | ||
stmt->set_true_case(empty_block); | ||
stmt->set_false_case(empty_block); | ||
} | ||
} | ||
|
||
void VisitStmt(For stmt) override { | ||
VisitBlock(stmt->body()); | ||
if (IsEmptyBlock(stmt->body())) { | ||
stmt->set_body(ir::stmt::_Block_::Make({})); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不需要实现成一个StmtMutator了,嵌套的情况PassManager会解决,只需要考虑当前block这个层级即可。这里可以删除的stmt种类就只有If, For, Schedule,写出相应的判断逻辑标记一下,在当前处理的Block里面删掉它们就可以了
PR Category
CINN
PR Types
Improvements
Description
改造了 EliminateDeadScheduleBlock Pass