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

Triton group normalization is slower than torch ops in some case. #134

Open
chenly15 opened this issue Mar 12, 2024 · 1 comment
Open

Triton group normalization is slower than torch ops in some case. #134

chenly15 opened this issue Mar 12, 2024 · 1 comment

Comments

@chenly15
Copy link

chenly15 commented Mar 12, 2024

In the techniques, I found GroupNorm was effective to speed up. But when I tested the speed between triton and torch operations, I found triton was slower than torch. The script is the same as https://github.com/chengzeyi/stable-fast/blob/main/src/sfast/triton/ops/group_norm.py , and the result is shown below.
For the GroupNorm operation, whether triton is faster than torch. Can I replace the torch.nn.GroupNorm with TritonGroupNorm directly, to accelerate stable diffusion model.
截屏2024-03-12 17 51 00
My env is
A100 GPU, torch 2.1, triton 2.1, no xformers, diffusers 0.21.2

@chengzeyi
Copy link
Owner

@chenly15 Our implementation may be not super effecient now. I currently use other methods to speed up groupnorm computation. However, it has not been open-sourced by far.

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

No branches or pull requests

2 participants