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.11] Update schedule_block_dce pass #70498

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

Conversation

Albresky
Copy link
Contributor

PR Category

CINN

PR Types

Improvements

Description

改造了 EliminateDeadScheduleBlock Pass

Copy link

paddle-bot bot commented Dec 26, 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 26, 2024
#include "paddle/cinn/optim/schedule_block_dce.h"
#include "paddle/cinn/optim/schedule_block_dce_pass.h"
Copy link
Contributor

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"
Copy link
Contributor

Choose a reason for hiding this comment

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

这里头文件不需要stmt_converter.h吧

Comment on lines +167 to +184
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({}));
}
}
Copy link
Contributor

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里面删掉它们就可以了

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