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 perf of softmax_with_cross_entropy_bwd #40643

Merged
merged 4 commits into from
Mar 18, 2022

Conversation

ZzSean
Copy link
Contributor

@ZzSean ZzSean commented Mar 16, 2022

PR types

Performance optimization

PR changes

OPs

Describe

Delete D2D memcpy to optimize perf of softmax_with_cross_entropy_bwd with hard label

case pytorch paddle 优化前 diff paddle 优化后 diff 加速比
label(Variable)-dtype:int64,shape:[2,1024,1024,1] logits(Variable)-dtype:float32,shape:[2,1024,1024,19] axis(int):3 ignore_index(int):255 soft_label(bool):False 0.90763 0.98579 差于 (8.61%) 0.54260 优于 (67.27%) 1.82
label(Variable)-dtype:int64,shape:[8,1024,1] logits(Variable)-dtype:float32,shape:[8,1024,50257] axis(int):2 ignore_index(int):-100 soft_label(bool):False 8.12188 8.89369 差于 (9.50%) 4.74061 优于 (71.33%) 1.88
label(Variable)-dtype:int64,shape:[8,1024,1] logits(Variable)-dtype:float32,shape:[8,1024,50304] axis(int):2 ignore_index(int):-100 soft_label(bool):False 7.90362 8.88303 差于 (12.39%) 4.75493 优于 (66.22%) 1.87
label(Variable)-dtype:int64,shape:[8,1024,1] logits(Variable)-dtype:float16,shape:[8,1024,50304] axis(int):2 ignore_index(int):-100 soft_label(bool):False 3.98370 6.45549 差于 (62.05%) 4.50929 差于 (13.19%) 1.43

@paddle-bot-old
Copy link

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

@PaddlePaddle PaddlePaddle locked and limited conversation to collaborators Mar 17, 2022
@PaddlePaddle PaddlePaddle unlocked this conversation Mar 17, 2022
@ZzSean ZzSean merged commit 081e430 into PaddlePaddle:develop Mar 18, 2022
@ZzSean ZzSean deleted the opt_softmax_loss_bwd branch November 7, 2022 03:03
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.

2 participants