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

[Optimization] CrossEntropyLoss #264

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

[Optimization] CrossEntropyLoss #264

wants to merge 5 commits into from

Conversation

StrongSpoon
Copy link
Collaborator

@StrongSpoon StrongSpoon commented Oct 29, 2024

PR Category

Operator

Type of Change

Performance Optimization

Description

apply fusion on celoss kernel and sum kernel of weight.
avoid memory copy from device to host by disabling context saving when input tensor doesn't require gradient.
achieve 90% relative performance on average compared to aten (only 13% before)
performance is better in benchmark with cudagraph or on RTX 3090

A100-benchmark without cudagraph
截屏2024-11-15 16 37 43

A100-benchmark with cudagraph
截屏2024-11-15 16 38 19

Issue

Progress

  • Change is properly reviewed (1 reviewer required, 2 recommended).
  • Change is responded to an issue.
  • Change is fully covered by a UT.

Performance

@StrongSpoon StrongSpoon changed the title [Optimization][DO NOT MERGE] CrossEntropyLoss [Optimization] CrossEntropyLoss Nov 15, 2024
src/flag_gems/ops/cross_entropy_loss.py Outdated Show resolved Hide resolved
src/flag_gems/ops/cross_entropy_loss.py Outdated Show resolved Hide resolved
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