CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
【CINN】add IfFusion pass #62584
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】add IfFusion pass #62584
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
paddle/cinn/optim/if_fusion.cc
Outdated
} | ||
|
||
// judge whether condition is same | ||
bool isNeedFuse = ir::ir_utils::IRCompare(op->condition, lop->condition); |
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.
is_need_fuse
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.
done,稍后和其他修改一起推上来
@@ -906,6 +907,7 @@ std::vector<ir::LoweredFunc> OpLowererImpl::PostProcess( | |||
} | |||
// 4.Apply low level pass | |||
func = optim::Optimize(Expr(func), target_, false).as_lowered_func_ref(); | |||
optim::IfFusion(&(func->body)); |
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可以添加到optim::Optimize()中
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.
get
paddle/cinn/optim/if_fusion.cc
Outdated
} | ||
|
||
// judge whether condition is same | ||
bool isNeedFuse = ir::ir_utils::IRCompare(op->condition, lop->condition); |
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.
只有在var name都完全相同时才合并吗?
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.
做外层融合,目前支持的if的条件完全相同的融合。
按照之前的讨论,后续的设计并交集的融合目前方案不明确,要后续支持。
VisitImpl(Reduce); | ||
VisitImpl(Ramp); | ||
VisitImpl(Broadcast); | ||
VisitImpl(FracOp); | ||
VisitImpl(Product); | ||
VisitImpl(Sum); | ||
VisitImpl(PrimitiveNode); | ||
VisitImpl(IntrinsicOp); | ||
VisitImpl(_BufferRange_); | ||
VisitImpl(_Dim_); |
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.
这里 Visit 的 op 是按照什么标准选取的,能 cover 到所有情况吗?
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.
此段代码的是为了增添last_op的记录支持,除了记录last_op之外别无更改。
这里出现的类型,是来自于paddle/cinn/ir/ir_mutator.h内所有的Visit重载,应当覆盖了所有的情况。
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.
LGTM for const_cast
PR types
Performance optimization
PR changes
Others
Description
pcard-81172
Add ifFusion pass to merge the if block with same condition.