[NewIR]Add NOT_FOR_INFER to prune Inference Library Size and Split VJP CodeGen into pd_op_vjp.cc #56352
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR types
Others
PR changes
Others
Description
Pcard-67164
一、现状
在 PR 下,Linux 官方镜像编译的 libpaddle_inference.so 的库体积如下:
其中借助 nm 命令发现包含的 dialect符号有 1833 个:
看了下符号分布,主要是 InferMeta 相关的符号:
借助 size 命令查看了推理库里各个 segment 的分布:
最后,借助 cmake 命令,我们看下其对 pd_dialect 的依赖,直接依赖了 pd_dialect:
二、优化后
由于推理库会依赖控制流算子,其又间接依赖了执行器InterpreterCore,其对新 IR 组件的耦合会更加的紧密,故暂时无法将新 IR 相关的target 给切分出去。
目前新 IR 相关的静态库的体积如下,目前新IR总共引入约30M 的静态库体积。其中有27.3M都是pd_op.a (算子定义),其余的组件不到3M。目测后续增长的size没有那么多