-
Notifications
You must be signed in to change notification settings - Fork 25.7k
[MPS] Add grid_sampler_3d for MPS
#160541
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/160541
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New FailureAs of commit 026d903 with merge base 3650989 ( NEW FAILURE - The following job has failed:
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: |
|
I tried using opmath_t to fix the difference between CPU and MPS results for half types. That alone did not fix it. But then I wrote a test that compares the results of half and full precision types both on MPS, and those do match within a relatively low tolerance. Then if I try removing the opmath_t, the half and full precision results on MPS become significantly different from each other again. And it looks like the CPU impl does not use opmath_t, so since each output element is calculated with a fairly large number of dependent multiplications and additions, I believe that explains why the CPU and MPS results differ greatly for half precision. So I'll update the PR to use opmath_t and add the half-vs-full precision test I wrote. We'll have to continue skipping the CPU-vs-MPS test for half precision, unless the CPU impl is updated at some point to use opmath_t |
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
|
@pytorchbot merge -f "Lint + MPS are green" |
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 |
This fixes following warnings during the compilation of GridSampler.metal
```
/Users/malfet/git/pytorch/pytorch/aten/src/ATen/native/mps/kernels/GridSampler.metal:22:23: warning: unused parameter 'input_sizes' [-Wunused-parameter]
constant int32_t* input_sizes,
^
/Users/malfet/git/pytorch/pytorch/aten/src/ATen/native/mps/kernels/GridSampler.metal:24:23: warning: unused parameter 'grid_sizes' [-Wunused-parameter]
constant int32_t* grid_sizes,
^
2 warnings generated.
```
Introduced by #160541
[ghstack-poisoned]
This fixes following warnings during the compilation of GridSampler.metal
```
/Users/malfet/git/pytorch/pytorch/aten/src/ATen/native/mps/kernels/GridSampler.metal:22:23: warning: unused parameter 'input_sizes' [-Wunused-parameter]
constant int32_t* input_sizes,
^
/Users/malfet/git/pytorch/pytorch/aten/src/ATen/native/mps/kernels/GridSampler.metal:24:23: warning: unused parameter 'grid_sizes' [-Wunused-parameter]
constant int32_t* grid_sizes,
^
2 warnings generated.
```
Introduced by #160541
ghstack-source-id: fa913d3
Pull Request resolved: #160850
This fixes following warnings during the compilation of GridSampler.metal
```
/Users/malfet/git/pytorch/pytorch/aten/src/ATen/native/mps/kernels/GridSampler.metal:22:23: warning: unused parameter 'input_sizes' [-Wunused-parameter]
constant int32_t* input_sizes,
^
/Users/malfet/git/pytorch/pytorch/aten/src/ATen/native/mps/kernels/GridSampler.metal:24:23: warning: unused parameter 'grid_sizes' [-Wunused-parameter]
constant int32_t* grid_sizes,
^
2 warnings generated.
```
Introduced by #160541
Pull Request resolved: #160850
Approved by: https://github.com/cyyever, https://github.com/Skylion007
This PR adds support for `grid_sampler_3d` for MPS with "bilinear" interpolation. NOTE: "nearest" interpolation is not yet supported Fixes pytorch#159882 Pull Request resolved: pytorch#160541 Approved by: https://github.com/malfet
This fixes following warnings during the compilation of GridSampler.metal
```
/Users/malfet/git/pytorch/pytorch/aten/src/ATen/native/mps/kernels/GridSampler.metal:22:23: warning: unused parameter 'input_sizes' [-Wunused-parameter]
constant int32_t* input_sizes,
^
/Users/malfet/git/pytorch/pytorch/aten/src/ATen/native/mps/kernels/GridSampler.metal:24:23: warning: unused parameter 'grid_sizes' [-Wunused-parameter]
constant int32_t* grid_sizes,
^
2 warnings generated.
```
Introduced by pytorch#160541
Pull Request resolved: pytorch#160850
Approved by: https://github.com/cyyever, https://github.com/Skylion007
This PR adds support for `grid_sampler_3d` for MPS with "bilinear" interpolation. NOTE: "nearest" interpolation is not yet supported Fixes pytorch#159882 Pull Request resolved: pytorch#160541 Approved by: https://github.com/malfet
This fixes following warnings during the compilation of GridSampler.metal
```
/Users/malfet/git/pytorch/pytorch/aten/src/ATen/native/mps/kernels/GridSampler.metal:22:23: warning: unused parameter 'input_sizes' [-Wunused-parameter]
constant int32_t* input_sizes,
^
/Users/malfet/git/pytorch/pytorch/aten/src/ATen/native/mps/kernels/GridSampler.metal:24:23: warning: unused parameter 'grid_sizes' [-Wunused-parameter]
constant int32_t* grid_sizes,
^
2 warnings generated.
```
Introduced by pytorch#160541
Pull Request resolved: pytorch#160850
Approved by: https://github.com/cyyever, https://github.com/Skylion007
Stack from ghstack (oldest at bottom):
grid_sampler_3dfor MPS #160541This PR adds support for
grid_sampler_3dfor MPS with "bilinear" interpolation.NOTE: "nearest" interpolation is not yet supported
Fixes #159882