Skip to content

[Test] Port roi_align (MPS) to stable ABI. - #9574

Draft
adabeyta wants to merge 2 commits into
adabeyta/roi-align-cuda-stablefrom
adabeyta/roi-align-mps-stable
Draft

[Test] Port roi_align (MPS) to stable ABI. #9574
adabeyta wants to merge 2 commits into
adabeyta/roi-align-cuda-stablefrom
adabeyta/roi-align-mps-stable

Conversation

@adabeyta

@adabeyta adabeyta commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Ports the roi_align MPS kernels to the stable ABI.

Notes

  • Requires [Stable ABI] Add torch_mps_set_arg_bytes to the MPS shim. pytorch#190932
  • Metal scalar args are version-dispatched. torch ≥ 2.14 binds them with torch_mps_set_arg_bytes, older targets ride them in as 1-element tensors. Today's 2.11 pin builds the tensor path, so no torch floor changes anywhere. Bumping the pin later on switches paths with no code change.
  • Shader source moves to roi_align_metal_shader.h. Once every MPS op migrates, the per-op headers can consolidate to a mps_stable_kernels.h and mps_kernels.h gets dropped.
  • Determinism contract. The MPS backward's alert can't fire from a stable kernel, so the Python backward's gate becomes in ("cuda", "mps").

Stable-ABI audit (torch-abi-audit)

Ran torch-abi-audit (https://github.com/Quansight/torch-abi-audit) on both MPS builds:

      Package: torchvision
        Torch ABI:   UNSTABLE
        CPython ABI: n/a
        Bundled libs: 3
        -- bundled libs --
          [UNSTABLE] [not-abi3] _C.so            (stable_shim=0,  unstable=91)
          [STABLE  ] [not-abi3] _C_stable.so     (stable_shim=77, unstable=0)
          [STABLE  ] [not-abi3] image_stable.so  (stable_shim=70, unstable=0)

@pytorch-bot

pytorch-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 28 New Failures, 1 Unrelated Failure, 1 Unclassified Failure

As of commit b20333b with merge base 0b23e88 (image):

NEW FAILURES - The following jobs have failed:

UNCLASSIFIED FAILURE - DrCI could not classify the following job because the workflow did not run on the merge base. The failure may be pre-existing on trunk or introduced by this PR:

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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

@meta-cla meta-cla Bot added the cla signed label Jul 30, 2026
@adabeyta adabeyta changed the title Port roi_align (MPS) to stable ABI. [Test] Port roi_align (MPS) to stable ABI. Jul 30, 2026
Comment on lines +19 to +24
#if defined(TORCH_VERSION_2_14_0) && \
TORCH_FEATURE_VERSION >= TORCH_VERSION_2_14_0
#define ROI_ALIGN_MPS_HAS_SET_ARG_BYTES 1
#else
#define ROI_ALIGN_MPS_HAS_SET_ARG_BYTES 0
#endif

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for going our of your way to support multiple torch versions ! But let's simplify the problem: it's fine to have torch 2.14 as the minimal torch version. We can drop the torch < 2.14 parts

@NicolasHug
NicolasHug force-pushed the adabeyta/roi-align-mps-stable branch from 2bf14a3 to 34a1c35 Compare August 4, 2026 19:05
@adabeyta
adabeyta force-pushed the adabeyta/roi-align-mps-stable branch from 34a1c35 to b20333b Compare August 4, 2026 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants