KEMBAR78
[MPS] coalesce for sparse tensors by Isalia20 · Pull Request #159729 · pytorch/pytorch · GitHub
Skip to content

Conversation

@Isalia20
Copy link
Collaborator

@Isalia20 Isalia20 commented Aug 3, 2025

MPS coalesce function for sparse tensors

cc @kulinseth @albanD @malfet @DenisVieriu97 @jhavukainen

@pytorch-bot
Copy link

pytorch-bot bot commented Aug 3, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/159729

Note: Links to docs will display an error until the docs builds have been completed.

⏳ No Failures, 26 Pending

As of commit 639b30b with merge base 40c4d61 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot bot added the release notes: mps Release notes category label Aug 3, 2025
@Isalia20 Isalia20 added the module: mps Related to Apple Metal Performance Shaders framework label Aug 3, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Aug 3, 2025

Attention! native_functions.yaml was changed

If 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:

@Isalia20 Isalia20 added the ciflow/mps Run MPS tests (subset of trunk) label Aug 3, 2025
@pytorch-bot pytorch-bot bot removed the ciflow/mps Run MPS tests (subset of trunk) label Aug 3, 2025
@janeyx99 janeyx99 added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Aug 4, 2025
@Isalia20
Copy link
Collaborator Author

Isalia20 commented Aug 6, 2025

@pytorchbot rebase

@pytorchmergebot
Copy link
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot
Copy link
Collaborator

Rebase failed due to Command git -C /home/runner/work/pytorch/pytorch rebase refs/remotes/origin/viable/strict pull/159729/head returned non-zero exit code 1

Rebasing (1/10)
Auto-merging aten/src/ATen/native/native_functions.yaml
CONFLICT (content): Merge conflict in aten/src/ATen/native/native_functions.yaml
Auto-merging torch/csrc/inductor/aoti_torch/generated/c_shim_mps.h
Auto-merging torch/csrc/utils/tensor_new.cpp
error: could not apply 139bf92076a... sparse tensors
hint: Resolve all conflicts manually, mark them as resolved with
hint: "git add/rm <conflicted_files>", then run "git rebase --continue".
hint: You can instead skip this commit: run "git rebase --skip".
hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Could not apply 139bf92076a... # sparse tensors

Raised by https://github.com/pytorch/pytorch/actions/runs/16789659717

@Isalia20 Isalia20 added the ciflow/mps Run MPS tests (subset of trunk) label Aug 6, 2025
sparse_cpu = sparse_cpu.sparse_resize_(torch.Size([4, 5]), sparse_dim=2, dense_dim=0)
self.assertEqual(sparse, sparse_cpu)

def test_coalesce(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you just enable portions of test_sparse? I.e. why it needs to be a separate MPS test?

Copy link
Collaborator Author

@Isalia20 Isalia20 Aug 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the long term goal, now if I enable tests in test_sparse.py most of the ops will just fail and we'd have to add to skip MPS almost everywhere. Once we cover most of the sparse functionality then we can delete this and just enable sparse tests

@pytorch-bot pytorch-bot bot removed the ciflow/mps Run MPS tests (subset of trunk) label Aug 8, 2025
@malfet
Copy link
Contributor

malfet commented Aug 8, 2025

@pytorchbot merge -f "It was green before"

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use -f as last resort and instead consider -i/--ignore-current to continue the merge ignoring current failures. This will allow currently pending tests to finish and report signal before the merge.

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

hinriksnaer pushed a commit to hinriksnaer/pytorch that referenced this pull request Aug 8, 2025
MPS coalesce function for sparse tensors

Pull Request resolved: pytorch#159729
Approved by: https://github.com/malfet

Co-authored-by: Nikita Shulga <2453524+malfet@users.noreply.github.com>
markc-614 pushed a commit to markc-614/pytorch that referenced this pull request Sep 17, 2025
MPS coalesce function for sparse tensors

Pull Request resolved: pytorch#159729
Approved by: https://github.com/malfet

Co-authored-by: Nikita Shulga <2453524+malfet@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merged module: mps Related to Apple Metal Performance Shaders framework open source release notes: mps Release notes category triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants