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

[Paddle Inference] Memory Optimize destruct argument #49046

Merged
merged 21 commits into from
Dec 17, 2022

Conversation

xiaoxiaohehe001
Copy link
Contributor

@xiaoxiaohehe001 xiaoxiaohehe001 commented Dec 13, 2022

PR types

Others

PR changes

Others

Describe

  1. pass 阶段 argument 会保存网络信息,pass 结束后未析构导致内存增加,推理 pass 阶段完成后,不会再使用 argument ,遂将其变成智能指针手动释放。
    image

  2. 修改 analysis 相关单测,删除单测中调用 predictor->analysis_argument() 接口获取 fused 后节点信息。

  3. 这样 pass 优化结束后 predictor->analysis_argument() 接口会被释放无法再被调用,目前 analysis_argument()接口调用多用于调试,mkldnn_int8 会继续调用所以 不在mkldnn下释放。

@paddle-bot
Copy link

paddle-bot bot commented Dec 13, 2022

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

Comment on lines +1369 to +1371
} else {
argument_.reset(nullptr);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

这里的释放操作需要确认一下,analysis_argument()主要用于测试,获取fusion_statis字段检测fuse op数量。 需确认这些单测是否有效。

Copy link
Contributor

Choose a reason for hiding this comment

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

为了降内存,几乎把这些测试都删掉了

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 0b36655 into PaddlePaddle:develop Dec 17, 2022
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