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

optimize compilation of operators using eigen #31851

Merged

Conversation

Avin0323
Copy link
Contributor

@Avin0323 Avin0323 commented Mar 24, 2021

PR types

Others

PR changes

Others

Describe

优化使用Eigen库broadcast调用的部分op:

  1. 新增paddle/fluid/operators/eigen目录,与eigen相关的代码在此目录下实现;
  2. 算子实现中,使用统一封装的函数来替换y.device(dev) = x.xxx();形式;
  3. 本PR只涉及broadcast调用,其他高频函数后续逐步优化;
  • 库体积变化:

单架构下预测静态库减少14M(644M->630M),动态库体积减少6M(244M->238M),Whl包体积减少1M(115M->114M)

  • 编译耗时变化:
*.o 耗时变化 变化比例
expand_as_op.cu.o 56s -> 37s 降低33.9%
expand_as_op.cc.o 56s -> 23s 降低58.9%
expand_v2_op.cu.o 89s -> 60s 降低32.5%
expand_v2_op.cc.o 91s -> 57s 降低37.3%
meshgrid_op.cu.o 58s -> 38s 降低34.4%
meshgrid_op.cc.o 48s -> 21s 降低56.2%
tile_op.cu.o 85s -> 57s 降低32.9%
tile_op.cc.o 90s -> 56s 降低37.7%
expand_op.cu.o 85s -> 55s 降低35.2%
expand_op.cc.o 89s -> 53s 降低40.4%
expand_as_v2_op.cu.o 58s -> 39s 降低32.7%
expand_as_v2_op.cc.o 61s -> 25s 降低59%
addmm_op.cu.o 39s -> 39s 持平
addmm_op.cc.o 23s -> 21s 降低8.6%

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@Avin0323 Avin0323 changed the title [WIP]optimize compilation of operators using eigen optimize compilation of operators using eigen Apr 6, 2021
Copy link
Contributor

@wanghuancoder wanghuancoder left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@zhangting2020 zhangting2020 left a comment

Choose a reason for hiding this comment

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

LGTM

@luotao1 luotao1 merged commit 187bf41 into PaddlePaddle:develop Apr 6, 2021
@Avin0323 Avin0323 deleted the optimize-compilation-with-eigen branch April 6, 2021 11:51
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.

4 participants