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

Refactor dropout cuda impl for code reuse. #35621

Merged

Conversation

limin2021
Copy link
Contributor

@limin2021 limin2021 commented Sep 9, 2021

PR types

Performance optimization

PR changes

OPs

Describe

Refactor dropout cuda impl for code reuse:
(1) Move dropout cuda forward impl in dropout_op.cu and backward impl in dropout_op.h to newly dropout_impl.cu.h;
(2) Originally, the backward impl for cpu and gpu share same code. To be more clear, they are separated into two pieces.
I extract the cuda backward impl from dropout_op.h and put them in dropout_impl.cu.h.
Now, all the cpu impl is in dropout_op.h and all the gpu impl is in dropout_impl.cu.h.

Unittest Results for dropout op:
c49cf754fcd67afc707fe39becc4d626

@paddle-bot-old
Copy link

paddle-bot-old bot commented Sep 9, 2021

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

@xingfeng01
Copy link
Contributor

建议 Describe 里第 (2) 条描述稍微的详细一点。

@xingfeng01
Copy link
Contributor

LGTM

@limin2021
Copy link
Contributor Author

建议 Describe 里第 (2) 条描述稍微的详细一点。

Done.

*(reinterpret_cast<LoadT*>(&dst[i])) =
*reinterpret_cast<LoadT*>(&dest_vec[0]);
*(reinterpret_cast<MaskLoadT*>(&mask_data[i])) =
*reinterpret_cast<MaskLoadT*>(&mask_vec[0]);
Copy link
Contributor

Choose a reason for hiding this comment

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

这里在当前的devleop已经不是这样写了。注意下挪动后,不要修改了内容

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

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