Skip to content

[Python STABLE ABI] Port pybind11 extension modules to torch stable libraries#4157

Merged
pearu merged 17 commits into
pytorch:mainfrom
pearu:pearu/sunset-pybind11
Dec 17, 2025
Merged

[Python STABLE ABI] Port pybind11 extension modules to torch stable libraries#4157
pearu merged 17 commits into
pytorch:mainfrom
pearu:pearu/sunset-pybind11

Conversation

@pearu
Copy link
Copy Markdown
Collaborator

@pearu pearu commented Dec 13, 2025

As in the title.

In addition, the PR removes cmake dependency as unused.

PLEASE NOTE THAT THE TORCHAUDIO REPOSITORY IS NO LONGER ACTIVELY MONITORED. You may not get a response. For open discussions, visit https://discuss.pytorch.org/.

@pearu pearu requested a review from a team as a code owner December 13, 2025 17:04
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented Dec 13, 2025

🔗 Helpful Links

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

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

✅ No Failures

As of commit d77d279 with merge base a004389 (image):
💚 Looks good so far! There are no failures yet. 💚

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

@pearu pearu force-pushed the pearu/sunset-pybind11 branch 2 times, most recently from 4bbff44 to 531ddeb Compare December 14, 2025 11:13
@pearu pearu force-pushed the pearu/sunset-pybind11 branch from 531ddeb to ee273ca Compare December 14, 2025 11:35
@pearu pearu force-pushed the pearu/sunset-pybind11 branch 9 times, most recently from fc8ba7a to 2d37922 Compare December 15, 2025 11:38
@pearu pearu force-pushed the pearu/sunset-pybind11 branch 2 times, most recently from 9aa5c3d to 7c02610 Compare December 15, 2025 13:31
@pearu pearu force-pushed the pearu/sunset-pybind11 branch from 7c02610 to 4d3f4fa Compare December 15, 2025 14:06
@pearu pearu force-pushed the pearu/sunset-pybind11 branch 5 times, most recently from 289804c to de13de9 Compare December 15, 2025 21:53
@pearu pearu force-pushed the pearu/sunset-pybind11 branch from de13de9 to be6e2b6 Compare December 15, 2025 23:04
@pearu pearu added this to the 2.11 milestone Dec 16, 2025
@pearu pearu force-pushed the pearu/sunset-pybind11 branch from 74da408 to 154e43d Compare December 16, 2025 11:20
(forced_align_impl<scalar_t, int64_t>(
logProbs, targets, blank, paths));
} else if (targets.scalar_type() == ScalarType::Int) {
(forced_align_impl<scalar_t, int32_t>(
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This change fixes access violation in one of the autograd tests on Windows CPU.
It is likely related to MSVC compiler handling of templates that sometimes have mysterious (d)effects.

path = _get_lib_path(lib)
if not path.exists():
suffix = ".pyd" if os.name == "nt" else ".so"
paths = list(_LIB_DIR.glob(f"{lib}*{suffix}"))
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

To support ABI components in library paths.

Comment on lines +68 to +71
extension = CppExtension

if _USE_CUDA:
extension = CUDAExtension
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The libtorch ABI libraries are really not Python extension modules, so it's weird to use Cpp/CudaExtension here. Using Cpp/CudaLibrary is more appropriate but torch/tools/cpp_extension does not have these. Although, Cpp/CudaExtension and Cpp/CudaLibrary are fairly similar in their functionalities.

export FFMPEG_VERSION="${{ matrix.ffmpeg-version }}"
export PIP_PROGRESS_BAR=off
export CONDA_QUIET=1
export NO_COLOR=1
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

To avoid garbage from pytest output in logs.

@pearu pearu marked this pull request as ready for review December 16, 2025 15:42
@pearu pearu merged commit fbf1d75 into pytorch:main Dec 17, 2025
55 of 57 checks passed
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.

1 participant