Consolidate CUDA helpers and remove the legacy _C extension in place of Stable-ABI - #9633
Merged
Merged
Conversation
Every stable CUDA kernel fetched its stream through the same four line shim snippet. It now lives once in cuda_helpers.h as get_current_cuda_stream(), the stable counterpart of the single at::cuda::getCurrentCUDAStream() call the legacy kernels used.
With every op ported the only thing left in _C was the _cuda_version registration. It moves to vision_stable.cpp, vision.cpp is removed, and setup.py / CMakeLists.txt build a single stable extension with the torch version pin applied library wide.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/9633
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 Unclassified FailureAs of commit 3b01b14 with merge base 541c083 ( 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:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
adabeyta
marked this pull request as ready for review
August 26, 2026 17:59
NicolasHug
approved these changes
Aug 27, 2026
Member
|
Thank you so much for the fantastic work @adabeyta !! I'm very happy that torchvision is stable now. I'll cherry-pick all of this into the 2.14 release branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#9626 ported the last op out of
_C, so the legacy unstable extension along with dual build is no longer needed. This PR removes and builds every source into_C_stable.Notes
setup.py:make_C_extension(),STABLE_SOURCES,_not_stable()and_stable()are removed.make_C_stable_extension()globs everything undercsrc/(minusio/image) instead of filtering by list, so there is no longer a hand-maintained source list to keep in sync.CMakeLists.txt: theTORCHVISION_STABLE_SOURCESlist is deleted for the same reason.get_stable_macros_and_flags()is merged intoget_macros_and_flags()per its TODO(stable-abi). The flags are moved, not changed:TORCH_TARGET_VERSION,USE_CUDA(non-ROCm) andUSE_MPSare now library-wide since every source is stable.ops/cuda/cuda_helpers.hafter the CUDA helper consolidation in this PR.torchvision/csrc/vision.cppis no longer needed asvision_stable.cpp(WindowsPyInitstub,cuda_version(), the_cuda_versionop registration) now live behind the stable API.torchvision/extension.pyloads only_C_stable.Stable-ABI audit (
torch-abi-audit)Ran
torch-abi-audit._C.sono longer exists, so the package as a whole now audits STABLE.