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

[NewIR]Add NOT_FOR_INFER to prune Inference Library Size and Split VJP CodeGen into pd_op_vjp.cc #56352

Merged
merged 11 commits into from
Aug 24, 2023

Conversation

Aurelius84
Copy link
Contributor

@Aurelius84 Aurelius84 commented Aug 16, 2023

PR types

Others

PR changes

Others

Description

Pcard-67164

一、现状

相关PR:#56302
触发的 inference 库体积膨胀:
image

在 PR 下,Linux 官方镜像编译的 libpaddle_inference.so 的库体积如下:
image
其中借助 nm 命令发现包含的 dialect符号有 1833 个:
image
看了下符号分布,主要是 InferMeta 相关的符号:
image
借助 size 命令查看了推理库里各个 segment 的分布:
image

最后,借助 cmake 命令,我们看下其对 pd_dialect 的依赖,直接依赖了 pd_dialect:
image

二、优化后

由于推理库会依赖控制流算子,其又间接依赖了执行器InterpreterCore,其对新 IR 组件的耦合会更加的紧密,故暂时无法将新 IR 相关的target 给切分出去。

目前新 IR 相关的静态库的体积如下,目前新IR总共引入约30M 的静态库体积。其中有27.3M都是pd_op.a (算子定义),其余的组件不到3M。目测后续增长的size没有那么多
image
image
image
image

@paddle-bot
Copy link

paddle-bot bot commented Aug 16, 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.

@Aurelius84 Aurelius84 changed the title [NewIR]Prune Inference Library Size and Remove IR Dialect [NewIR]Add NOT_FOR_INFER to prune Inference Library Size and Split VJP CodeGen into pd_op_vjp.cc Aug 22, 2023
@Aurelius84 Aurelius84 merged commit 5d43f5e into PaddlePaddle:develop Aug 24, 2023
BeingGod pushed a commit to BeingGod/Paddle that referenced this pull request Sep 9, 2023
…P CodeGen into pd_op_vjp.cc (PaddlePaddle#56352)

* [NewIR]Prune Inference Library Size and Remove IR Dialect

* remove options

* add NOT_FOR_INFER

* fix pd_vjp.cc

* polish deps

* fix code style

* fix unittest

* fix cmake

* fix inference CI
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.

2 participants