CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[Paddle-TRT] support sub block: while op, condition_block op #59588
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
[Paddle-TRT] support sub block: while op, condition_block op #59588
Conversation
2ed4a17
to
6511140
Compare
paddle/fluid/framework/block_desc.cc
Outdated
VarDesc *new_var = new VarDesc(*var_desc); | ||
vars_[name] = std::make_unique<VarDesc>(*new_var); |
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.
这里感觉会不会有问题,你append的和实际存储进block的不是同一个var,怎么同步?并且这里第136行完全是冗余的,make_unique内部就会new一个新的出来。。。
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.
这里感觉会不会有问题,你append的和实际存储进block的不是同一个var,怎么同步?并且这里第136行完全是冗余的,make_unique内部就会new一个新的出来。。。
当前的IR都只在自己的block上进行graph的修改(可能会修改var_desc的属性),不同的block中的边界var_desc是不同的,为了不干扰其它block上的graph操作。op的执行阶段是通过var_desc中的name去找scope,只要var name一样,就能正常运行
paddle/fluid/framework/ir/graph.h
Outdated
@@ -425,6 +427,8 @@ class Graph { | |||
} | |||
return res; | |||
} | |||
// The block this SubGraph belongs to. | |||
int block_id_{0}; |
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.
从private移到public的理由?
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.
从private移到public的理由?
debug用的,忘了删
b15a14d
to
000102e
Compare
|
||
// block inputs | ||
std::vector<std::string> block_inputs = {}; | ||
if (block_op->Type() == "while") { |
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.
这里只对while op进行了处理,没有处理其他的condition op吗?
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.
ops_type 目前只有"conditional_block", "while",这些 OP的input 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.
LGTM for flag
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
@@ -312,6 +312,14 @@ void ConvBNFusePass::ApplyImpl(ir::Graph* graph) const { | |||
graph, platform::errors::InvalidArgument("Graph cannot be nullptr.")); | |||
FusePassBase::Init(name_scope_, graph); | |||
|
|||
VLOG(3) << "Running conv_bn_fuse_pass."; | |||
if (graph->IsMainGraph()) { |
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_VLOG_ON,默认情况下就可以跳过执行
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_VLOG_ON,默认情况下就可以跳过执行
学习到了,下个pr修改一下
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
…addle#59588) * [Paddle-TRT] support sub block: while op, condition_block op
PR types
Others
PR changes
Others
Description
Pcard-71503
Paddle-TRT support sub block: while op, condition_block op:
执行逻辑:
收益: