Skip to content

Conversation

malfet
Copy link
Contributor

@malfet malfet commented Jul 25, 2024

Similar to how AND/OR/XOR ops are implemented

TODO: Consider using MPS method calls rather than metal kernels

Similar to how AND/OR/XOR ops are implemented

TODO: Consider using MPS method calls rather than metal kernels
@malfet malfet requested a review from kulinseth as a code owner July 25, 2024 21:07
Copy link

pytorch-bot bot commented Jul 25, 2024

🔗 Helpful Links

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

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

❌ 1 New Failure

As of commit d1c7b2a with merge base bf6aae1 (image):

NEW FAILURE - The following job has failed:

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

@pytorch-bot pytorch-bot bot added ciflow/mps Run MPS tests (subset of trunk) release notes: mps Release notes category labels Jul 25, 2024
@@ -85,8 +85,6 @@ static Tensor slow_conv2d_forward_mps(const Tensor& self,
// These ops are not supported via MPS backend currently, and we fallback to run on CPU.
// For the rest of unsupported ops the user needs to pass 'PYTORCH_ENABLE_MPS_FALLBACK=1'
// to fallback on CPU, otherwise we will error out.
m.impl("bitwise_left_shift.Tensor_out", torch::CppFunction::makeFromBoxedFunction<&mps_fallback>());
m.impl("bitwise_right_shift.Tensor_out", torch::CppFunction::makeFromBoxedFunction<&mps_fallback>());
Copy link
Contributor

Choose a reason for hiding this comment

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

If there was a fallback in place, why were things not working before?
Granted that the error was with __left__.Scalar. Not sure how that magic works

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, the fallback was for the Tensor variant, not for the Scalar ones

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, this only works if one calls torch.bitwise_left_shift, not sure what's the story with all those

@@ -8457,29 +8457,29 @@
device_check: NoCheck # TensorIterator
variants: method, function
dispatch:
CPU, CUDA: __lshift__
CPU, CUDA, MPS: __lshift__
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, where is the magic that ties __lshift__ to bitwise_left_shift_out

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here:

lshift_stub(iter.device_type(), iter);

@malfet
Copy link
Contributor Author

malfet commented Jul 26, 2024

@pytorchbot merge -f "MPS + Linr tests are 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). 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

@github-actions github-actions bot deleted the malfet/mps-add-shift-ops branch August 26, 2024 02:01
pytorchmergebot pushed a commit that referenced this pull request Sep 11, 2024
Missed it while working on #131813
Test plan: `python -c "import torch;print(torch.randint(100, 500, (64,), device='mps') >> torch.tensor([3,], device='mps'))"`

Pull Request resolved: #135607
Approved by: https://github.com/manuelcandales
yushangdi pushed a commit that referenced this pull request Sep 12, 2024
Missed it while working on #131813
Test plan: `python -c "import torch;print(torch.randint(100, 500, (64,), device='mps') >> torch.tensor([3,], device='mps'))"`

Pull Request resolved: #135607
Approved by: https://github.com/manuelcandales
Chao1Han pushed a commit to Chao1Han/pytorch that referenced this pull request Sep 20, 2024
Missed it while working on pytorch#131813
Test plan: `python -c "import torch;print(torch.randint(100, 500, (64,), device='mps') >> torch.tensor([3,], device='mps'))"`

Pull Request resolved: pytorch#135607
Approved by: https://github.com/manuelcandales
pytorchbot pushed a commit that referenced this pull request Oct 2, 2024
Missed it while working on #131813
Test plan: `python -c "import torch;print(torch.randint(100, 500, (64,), device='mps') >> torch.tensor([3,], device='mps'))"`

Pull Request resolved: #135607
Approved by: https://github.com/manuelcandales

(cherry picked from commit 3bf6be4)
kit1980 pushed a commit that referenced this pull request Oct 2, 2024
[MPS] Add missing dispatch to rshift.Tensor (#135607)

Missed it while working on #131813
Test plan: `python -c "import torch;print(torch.randint(100, 500, (64,), device='mps') >> torch.tensor([3,], device='mps'))"`

Pull Request resolved: #135607
Approved by: https://github.com/manuelcandales

(cherry picked from commit 3bf6be4)

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
ciflow/mps Run MPS tests (subset of trunk) Merged release notes: mps Release notes category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants