-
Notifications
You must be signed in to change notification settings - Fork 25.7k
[MPS] Add mps keys to indices and values ops
#160223
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
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/160223
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 7be6762 with merge base 2247aa6 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Attention! native_functions.yaml was changedIf you are adding a new function or defaulted argument to native_functions.yaml, you cannot use it from pre-existing Python frontend code until our FC window passes (two weeks). Split your PR into two PRs, one which adds the new C++ functionality, and one that makes use of it from Python, and land them two weeks apart. See https://github.com/pytorch/pytorch/wiki/PyTorch's-Python-Frontend-Backward-and-Forward-Compatibility-Policy#forwards-compatibility-fc for more info. Caused by: |
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.
LGTM. Could you also add tests for indices/values? Say, by extending TestSparseMPS.test_sparse_coo_tensor_with_dims_and_tensors with
self.assertEqual(t.indices().cpu(), indices.cpu())
self.assertEqual(t.values().cpu(), values.cpu())|
I don't think that test is needed. indices() and values() do not come from a custom implementation and I would basically be comparing two same things to each other, just being dispatched from different devices. |
These tests are needed for sanity. Note that
Isn't that true for most tests? :) |
This is also the reason why these tests are needed as this PR adds a feature to the dispatching system. |
|
It's not true for most of the tests. Tests which compare outputs between device and cpu, in my opinion, should be added when you have a different implementation for it. i.e. see implementation for Also one of the reasons tests get added is to make sure that in the future people don't break things, here you can't physically break this implementation since you will be breaking both mps/cpu/cuda implementation if you change the underlying function. |
|
@malfet What do you think? |
There exists a number of ways to break a code that relies on the feature that this PR introduces without pytorch CI discovering the breakage. A trivial example is a future PR that removes the dispatch keys introduced here. Or a PR that provides a MPS-specific-but-buggy implementation for indices/values. Etc. While these examples may be artificial (or are they? This is considering that people will use/already use AI to generate PRs) in the sense that the review process should prevent landing such PRs. A failing CI would save everyone's time by making such future PRs unacceptable. |
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.
It would be nice to have some testing, but adding something to dispatch guess will not hurt, so I guess in followup PRs I expect you'll enable running test_sparse but skip majority of test there for MPS backend
indices and values ops
|
@pytorchbot merge -f "This seems fine" |
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 |
enable indices and values on sparse mps Pull Request resolved: #160223 Approved by: https://github.com/malfet
enable indices and values on sparse mps Pull Request resolved: #160223 Approved by: https://github.com/malfet
enable indices and values on sparse mps Pull Request resolved: pytorch#160223 Approved by: https://github.com/malfet
enable indices and values on sparse mps Pull Request resolved: pytorch#160223 Approved by: https://github.com/malfet
enable indices and values on sparse mps
cc @alexsamardzic @nikitaved @pearu @cpuhrsch @amjames @bhosmer @jcaip @kulinseth @albanD @malfet @DenisVieriu97 @jhavukainen