Skip to content

Conversation

@Hiroaki0422
Copy link

Fixes #141287
Implemented missing backward for already implemented _upsample_bilinear2d_aa mps support.
Confirmed this is under to-be-implemented from the tracking board here

Summary:

  • Implemented _upsample_bicubic2d_aa backward for MPS with a dedicated AA kernel, pipeline instantiation, and dispatch wiring.
  • Enabled MPS dispatch in native_functions.yaml and wired host-side _out/functional wrappers.
  • Added MPS test coverage for bicubic antialias interpolate and adjusted tolerances/skips to match CPU.

@pytorch-bot
Copy link

pytorch-bot bot commented Dec 7, 2025

🔗 Helpful Links

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

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:

✅ No Failures

As of commit 0cd700d with merge base 3ab4b9a (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 Dec 7, 2025
@Hiroaki0422 Hiroaki0422 changed the title [MPS] Add missing backward for _upsample_bicubic2d_aa supportMps upsample bicubic2d aa backward [MPS] Add missing backward for _upsample_bicubic2d_aa support Dec 7, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 7, 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:

@malfet malfet added the ciflow/mps Run MPS tests (subset of trunk) label Dec 8, 2025
@pytorch-bot pytorch-bot bot removed the ciflow/mps Run MPS tests (subset of trunk) label Dec 9, 2025
@Hiroaki0422
Copy link
Author

@malfet
I pushed the new commit to fix the linter from the earlier ci test but it looks like @pytorchbot had dropped the ciflow/mps label. Could you please re-add the label?
Thank you so much for reviewing!

@soulitzer soulitzer added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Dec 12, 2025
Copy link
Collaborator

@kurtamohler kurtamohler left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! I left a few suggestions

@@ -6075,6 +6075,38 @@ def interp(x):
return F.interpolate(x, 3, mode='linear', align_corners=align_corners)
self.assertEqual(interp(inp).cpu(), interp(inp.cpu()))

def test_interpolate_bicubic2d_aa(self):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this test specifically add something that the existing OpInfo tests don't? If not, I think it can probably be removed

uint thread_index [[thread_position_in_grid]]) {
auto output_x = thread_index % static_cast<uint>(output_sizes.w);
auto output_y = thread_index / static_cast<uint>(output_sizes.w);
(void)align_corners; // Align corners is unused for AA algorithm
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: This line isn't really necessary is it?

constant bool& align_corners [[buffer(7)]], \
uint thread_index [[thread_position_in_grid]])

#define INSTANTIATE_UPSAMPLE_2D_AA_BACKWARD(NAME, FUNCTOR, DTYPE) \
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like this is an exact duplicate of the one above, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

MPS operator coverage tracking issue (2.6+ version)

5 participants