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

[QST] why can't use ColumnMajor as sparse GEMM output layout? #1150

Closed
shicheng0829 opened this issue Oct 18, 2023 · 3 comments
Closed

[QST] why can't use ColumnMajor as sparse GEMM output layout? #1150

shicheng0829 opened this issue Oct 18, 2023 · 3 comments
Labels
question Question

Comments

@shicheng0829
Copy link

shicheng0829 commented Oct 18, 2023

Recently, I used cutlass Sparse Gemm to implement the pytorch linear layer.

In pytorch, y = x @ w^T + b, as w is a sparse matrix.

Sparse Gemm represents D = A * B + C as A is a sparse matrix.

So I must use (w @ x^T)^T to compute x @ w^T.

However, I found that the sparse GEMM output layout can't be ColumnMajor from this file. So I can only compute the transpose of the real result.

def GenerateSM80_SparseTensorOp_16832(manifest, cuda_version):

I want to know how I can solve this problem, Thanks.

@hwu36

@hwu36
Copy link
Collaborator

hwu36 commented Oct 18, 2023

Cutlass 2.x only has row major epilogue for both dense and sparse gemm. If we want to output column major for dense gemm, we do this trick: C:row = A x B => C:col = B' x A'. If we apply this trick to sparse gemm, then B' becomes sparse which means B is sparse which changes the original problem.

What you can do is like use a naive epilogue which is like https://github.com/NVIDIA/cutlass/blob/main/include/cutlass/gemm/warp/mma_tensor_op_tile_iterator.h#L2976 or you can write an efficient column major epilogue like cutlass 1.x did.

Copy link

This issue has been labeled inactive-30d due to no recent activity in the past 30 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be labeled inactive-90d if there is no activity in the next 60 days.

@mnicely
Copy link
Collaborator

mnicely commented Dec 5, 2023

Closing due to inactivity. Please reopen if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question
Projects
None yet
Development

No branches or pull requests

3 participants