-
Notifications
You must be signed in to change notification settings - Fork 25.7k
[sparse] semi-structured sparse + torch.compile support #111049
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
Conversation
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/111049
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New FailureAs of commit 575d075 with merge base 4b324a8 ( NEW FAILURE - The following job has failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
|
So I think we will need some additional work before subclass tracing and 2:4 sparsity can work together. Loosely I think the problem is the op level at which inductor breaks stuff down to call the subclass is more decomposed than in eager (which we have support for). For example - fp16 It looks like when compiling, inductor is trying different combinations of ops to represent When I try a So in order to support this, we'll either need to
permute(0,1) and reinterpret_tensor should be mapped to transpose. fp32 casts can be no-ops. |
Summary: Placeholder PR for subclassing + 2:4 sparsity Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
c88541a to
8d3d0fe
Compare
torch/sparse/semi_structured.py
Outdated
| transposed=not args[0].transposed, | ||
| ) | ||
|
|
||
| if func is torch.ops.prims.convert_element_type.default: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bdhirsh These are the ops I added to get this test to "work", you can comment these out to see where it fails earlier in the chain.
Summary: Placeholder PR for subclassing + 2:4 sparsity Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Placeholder PR for subclassing + 2:4 sparsity Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Placeholder PR for subclassing + 2:4 sparsity Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Placeholder PR for subclassing + 2:4 sparsity Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Placeholder PR for subclassing + 2:4 sparsity Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Placeholder PR for subclassing + 2:4 sparsity Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Placeholder PR for subclassing + 2:4 sparsity Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: This PR adds in torch.compile support for semi-structured sparsity, using the subclass tracing bdhirsh added. Based on wether we are using cuSPARSELt or CUTLASS, we return a different representation of the inner tensors. Test Plan: ``` python test/test_sparse_semi_structured.py -k compile ``` Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
192f01c to
e2d9bae
Compare
Summary: This PR adds in torch.compile support for semi-structured sparsity, using the subclass tracing @bdhirsh added. Based on wether we are using cuSPARSELt or CUTLASS, we return a different representation of the inner tensors. Test Plan: ``` python test/test_sparse_semi_structured.py -k compile ``` Reviewers: Subscribers: Tasks: Tags: ghstack-source-id: eeba936 Pull Request resolved: #111049
|
This is kind of strange. I was able to reproduce this error running locally, but I don't think it's related to my changes here. Running the following command yields failures for the torch.compile test, note that the other cusparselt/cutlass tests do not report a memory leak. Then I tried commenting out the call to cc @clee2000 @bdhirsh do y'all have any ideas what might be causing this? Could it be something funky with the tooling / torch.compile? |
|
Hey @jcaip - I messed around with the test locally, and this seems like a memory leak directly in cutlass / the SparseSemiStructuredTensor subclass. Here's a minimal repro: prints: |
|
@alexsamardzic - Alek can you take a look into this as well? |
|
This is sort of known problem; namely, the code doing conversion is actually changed to: While trying to change the function in question to come up with minimum self-contained example, I came up with something even unrelated: It will also print |
|
@alexsamardzic What do you think about turning off this flag to false now that we have torch.compile support for subclasses? I think this can also cause issues if we call to torch.compile again later. |
|
That's fine with me. |
Summary: This PR adds in torch.compile support for semi-structured sparsity, using the subclass tracing bdhirsh added. Based on wether we are using cuSPARSELt or CUTLASS, we return a different representation of the inner tensors. Test Plan: ``` python test/test_sparse_semi_structured.py -k compile ``` Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: This PR adds in torch.compile support for semi-structured sparsity, using the subclass tracing bdhirsh added. Based on wether we are using cuSPARSELt or CUTLASS, we return a different representation of the inner tensors. Test Plan: ``` python test/test_sparse_semi_structured.py -k compile ``` Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
|
Ah I believe the test is failing because I was not using Writing a new test for semi-structured sparse should fix this. |
Summary: This PR adds in torch.compile support for semi-structured sparsity, using the subclass tracing bdhirsh added. Based on wether we are using cuSPARSELt or CUTLASS, we return a different representation of the inner tensors. Test Plan: ``` python test/test_sparse_semi_structured.py -k compile ``` Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: This PR adds in torch.compile support for semi-structured sparsity, using the subclass tracing @bdhirsh added. Based on wether we are using cuSPARSELt or CUTLASS, we return a different representation of the inner tensors. Test Plan: ``` python test/test_sparse_semi_structured.py -k compile ``` Reviewers: Subscribers: Tasks: Tags: ghstack-source-id: 8e127cc Pull Request resolved: #111049
|
@pytorchbot merge -f "passing ciflow/slow now and unrelated failing test" |
Merge startedYour change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Summary: This PR adds in torch.compile support for semi-structured sparsity, using the subclass tracing @bdhirsh added. Based on wether we are using cuSPARSELt or CUTLASS, we return a different representation of the inner tensors. Test Plan: ``` python test/test_sparse_semi_structured.py -k compile ``` Reviewers: Subscribers: Tasks: Tags: Pull Request resolved: pytorch#111049 Approved by: https://github.com/cpuhrsch
Summary: This PR adds in torch.compile support for semi-structured sparsity, using the subclass tracing @bdhirsh added. Based on wether we are using cuSPARSELt or CUTLASS, we return a different representation of the inner tensors. Test Plan: ``` python test/test_sparse_semi_structured.py -k compile ``` Reviewers: Subscribers: Tasks: Tags: Pull Request resolved: pytorch#111049 Approved by: https://github.com/cpuhrsch
Stack from ghstack (oldest at bottom):
Summary:
This PR adds in torch.compile support for semi-structured sparsity,
using the subclass tracing @bdhirsh added.
Based on wether we are using cuSPARSELt or CUTLASS, we return a
different representation of the inner tensors.
Test Plan:
Reviewers:
Subscribers:
Tasks:
Tags: