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

Unify the gpu implementation of stack and unstack to reuse the optimization. #49748

Merged
merged 9 commits into from Jan 31, 2023

Conversation

Xreki
Copy link
Contributor

@Xreki Xreki commented Jan 11, 2023

PR types

Performance optimization

PR changes

OPs

Describe

统一stack、unstack实现,并优化unstack部分计算。

算子 配置 前向 反向
stack x[16], x.shape=[16, 16, 16], axis=1 0.0044725 -> 0.0041357, -7.53046% 0.0134192 -> 0.0122590, -8.64610%
unstack x.shape=[16, 1024, 512], axis=1 0.1104237 -> 0.1092000, -1.10820% -
unstack x.shape=[16, 800, 500], axis=-1 0.2898367 -> 0.1011838, -65.08939% -

@paddle-bot
Copy link

paddle-bot bot commented Jan 11, 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.

Copy link
Contributor

@JamesLim-sy JamesLim-sy 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 3586e85 into PaddlePaddle:develop Jan 31, 2023
@Xreki Xreki deleted the op/unify_stack_unstack branch January 31, 2023 02:35
pangengzheng pushed a commit to pangengzheng/Paddle that referenced this pull request Feb 2, 2023
…zation. (PaddlePaddle#49748)

* Unify the gpu implementation of stack and unstack to reuse the optimization.

* Optimize the cuda implementation of unstack.

* Use GpuMemcpyAsync instead of memory::Copy.

* Fix error of calculating the index.

* Use FastDivMod to further imporve the performance of unstack.
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