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 the implemention of several operators to decrease the compiled size. #57309

Merged
merged 4 commits into from Sep 14, 2023

Conversation

Xreki
Copy link
Contributor

@Xreki Xreki commented Sep 14, 2023

PR types

Others

PR changes

OPs

Description

Pcard-70459

本PR的工作包括:

  1. CPU一些二元计算需要使用InverseFunctor,在计算满足交换律时,可以使用using InverseAddFunctor = AddFunctor<T>;别名,而不是定义新的Functor,编译出来的静态库大小可减少2M
  2. flip、rooll & roll_grad、index_put & index_put_grad 的Kernel实现中使用了Rank作为模板,会导致算子产生比较大的二进制文件,实际上Rank作为模板与否,并不会影响算子的性能。故改写了这几个算子,从模板中移除Rank,编译出来的静态库大小可减少4M

@paddle-bot
Copy link

paddle-bot bot commented Sep 14, 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.

@paddle-bot
Copy link

paddle-bot bot commented Sep 14, 2023

❌ The PR is not created using PR's template. You can refer to this Demo.
Please use PR's template, it helps save our maintainers' time so that more developers get helped.

@Xreki Xreki requested a review from ZzSean September 14, 2023 12:26
Copy link
Contributor

@ZzSean ZzSean left a comment

Choose a reason for hiding this comment

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

LGTM

@Xreki Xreki merged commit aefa62e into PaddlePaddle:develop Sep 14, 2023
27 checks passed
@Xreki Xreki deleted the op/opt_compile branch September 14, 2023 12:58
danleifeng pushed a commit to danleifeng/Paddle that referenced this pull request Nov 14, 2023
…ed size. (PaddlePaddle#57309)

* Optimize some codes.

* Remove the specialization of rank for flip_kernel.

* Remove the specialization of rank for roll_kernel and roll_grad_kernel.

* Remove the specialization of rank for index_put_kernel and index_put_grad_kernel.
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.

None yet

2 participants