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

[MPS] Solve contiguos view tensors using arrayViews instead of blits (#146) #91743

Closed

Conversation

DenisVieriu97
Copy link
Collaborator

Solve contiguous view tensors using arrayViews directly instead of performing blit or gather.

E.g in case of the following example:

x = torch.tensor([1,2,3,4], device="mps')
y = x[2:]
r = y + 2

Previously, y would be materialized using a gather or a blit. With this change, the memory of y is aliased directly using arrayViews, thus skipping the need for blit or gather.

Fixes #85297, #86048

@DenisVieriu97 DenisVieriu97 added the ciflow/mps Run MPS tests (subset of trunk) label Jan 5, 2023
@pytorch-bot
Copy link

pytorch-bot bot commented Jan 5, 2023

🔗 Helpful Links

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

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

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

❌ 1 Failures

As of commit f4d9f04:

FLAKY - The following jobs failed but were likely due to flakiness present on master:

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 Jan 5, 2023
@mikaylagawarecki mikaylagawarecki added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Jan 6, 2023
@DenisVieriu97
Copy link
Collaborator Author

@pytorchbot rebase

@pytorchmergebot
Copy link
Collaborator

@pytorchbot successfully started a rebase job. Check the current status here

@pytorchmergebot
Copy link
Collaborator

Successfully rebased contiguous_view_optimizations onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via git checkout contiguous_view_optimizations && git pull --rebase)

Copy link
Collaborator

@razarmehr razarmehr left a comment

Choose a reason for hiding this comment

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

LGTM

@DenisVieriu97
Copy link
Collaborator Author

@pytorchbot rebase

@pytorchmergebot
Copy link
Collaborator

@pytorchbot successfully started a rebase job. Check the current status here

DenisVieriu97 and others added 2 commits January 10, 2023 14:41
* Solve contiguos view tensors using arrayViews instead of blit

* Use c10::irange to iterate for loops

* Remove additional space

* Move the slicing of view tensors to View.mm
@pytorchmergebot
Copy link
Collaborator

Successfully rebased contiguous_view_optimizations onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via git checkout contiguous_view_optimizations && git pull --rebase)

@DenisVieriu97
Copy link
Collaborator Author

@pytorchbot merge -g

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Jan 10, 2023
@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks on your PR pass since you used the green (-g) flag (ETA: 0-4 Hours).

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

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: 2 additional jobs have failed, first few of them are: trunk ,trunk / linux-focal-rocm5.3-py3.8 / test (default, 2, 2, linux.rocm.gpu)

Details for Dev Infra team Raised by workflow job

@DenisVieriu97
Copy link
Collaborator Author

@pytorchbot merge -f "Lint+MPS is green"

@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).

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/mps Run MPS tests (subset of trunk) ciflow/trunk Trigger trunk jobs on your pull request Merged 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
6 participants