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

Only 3x3 conv can use 2:4 sparsity? #3849

Closed
WeixiangXu opened this issue May 8, 2024 · 4 comments
Closed

Only 3x3 conv can use 2:4 sparsity? #3849

WeixiangXu opened this issue May 8, 2024 · 4 comments
Assignees
Labels
triaged Issue has been triaged by maintainers

Comments

@WeixiangXu
Copy link

I use nsys to profile the resnet34.
image

And I find that only 3x3 conv use 2:4 sparsity, while 1x1 conv does not. (Furthermore, I find that Linear in transformers also does not use sparsity.)

Why?

@nvpohanh
Copy link
Collaborator

nvpohanh commented May 9, 2024

TRT tries both sparse and dense tactics and choose a faster one. Based on our experiments, sparse conv kernels are faster than dense conv kernels if C and K are large enough (>256). Could you try increase C and K for the 1x1 Conv and see if sparse conv tactic is chosen?

3x3 Conv effectively increases the C by 9x so it favors sparse kernels.

@zerollzeng zerollzeng added the triaged Issue has been triaged by maintainers label May 12, 2024
@WeixiangXu
Copy link
Author

Could you try increase C and K for the 1x1 Conv

Thanks for your reply!

Does C stand for C_in or C_out? And does K stands for kernel size? @nvpohanh

@nvpohanh
Copy link
Collaborator

Sorry, should have been clearer: C = C_in, K = C_out

@WeixiangXu
Copy link
Author

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triaged Issue has been triaged by maintainers
Projects
None yet
Development

No branches or pull requests

3 participants