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

[pass] Upgrade Constant Folding Pass #49908

Merged
merged 3 commits into from
Jan 31, 2023

Conversation

zhangjun
Copy link
Contributor

@zhangjun zhangjun commented Jan 17, 2023

PR types

Others

PR changes

Others

Describe

Pass optimizations may have motifications on Graph or ProgramDesc:

  • Graph
    • graph->node->var_desc
  • ProgramDesc
    • graph->node->op->block_desc(pointed to original block desc in program desc)->var_desc

TensrRT op_teller uses the information of BlockDesc inside ProgramDesc. So we should make var in OP block persistable after Constant Folding pass.

Related PR:#48763 #45494

@paddle-bot
Copy link

paddle-bot bot commented Jan 17, 2023

你的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.

Copy link
Contributor

@zhoutianzi666 zhoutianzi666 left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -143,6 +143,10 @@ void ConstantFoldingPass::ApplyImpl(ir::Graph *graph) const {
}
out_desc->SetShape(out_shape);
out_desc->SetPersistable(true);
auto *var_desc_out = op_node->Op()->Block()->Var(out_name);
Copy link
Contributor

Choose a reason for hiding this comment

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

可能是由于 Program 和 Graph 两套 IR 没法无损转换导致的问题

Copy link
Contributor

@jiweibo jiweibo left a comment

Choose a reason for hiding this comment

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

LGTM

@jiweibo jiweibo merged commit c3cd850 into PaddlePaddle:develop Jan 31, 2023
pangengzheng pushed a commit to pangengzheng/Paddle that referenced this pull request Feb 2, 2023
@zhangjun zhangjun deleted the constant-folding branch February 15, 2023 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants