-
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.5] Update ir_simplify pass #70666
base: develop
Are you sure you want to change the base?
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
struct SimplifyNoPureMathMutator : public ir::IRMutator<ir::Expr*>, | ||
public ir::stmt::StmtMutator<> { |
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.
这里不需要再改写了,用ExprPass即可,PassManager会遍历所有Statement内部的Expr进行改造
struct SimplifyLoadMutator : public ir::IRMutator<ir::Expr*>, | ||
public ir::stmt::StmtMutator<> { |
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.
同上,且这里For不需要特殊实现了
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); | ||
} |
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.
这里也不需要继承这两个Mutator,直接针对特定Statement改造就行
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.
好的
需要再确认一下使用何种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<> { |
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.
@Hongqing-work Hi,我有个疑问。请问在改造后的新 IR 中,是否还存在这种两个 Block 嵌套的情况?如果有,父亲 Block 应该在当前 Block 的 scope 外,此时如何将当前 Block 的 stmt 合并到父亲呢?
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.
目前应该不会了,这个改动可以删除
16b85ca
to
0150a6f
Compare
PR Category
CINN
PR Types
Improvements
Description
改造了 IR Simplify Pass