Scope third-party install rules out of the wheel via CMake components#184873
Open
zklaus wants to merge 1 commit into
Open
Scope third-party install rules out of the wheel via CMake components#184873zklaus wants to merge 1 commit into
zklaus wants to merge 1 commit into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/184873
Note: Links to docs will display an error until the docs builds have been completed. ❌ 4 New Failures, 1 Pending, 12 Unrelated Failures, 1 Unclassified FailureAs of commit a29741f with merge base 04d232f ( 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:
UNSTABLE - The following jobs are marked as unstable, possibly due to flakiness on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
This was referenced May 22, 2026
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.
Stack from ghstack (oldest at bottom):
Move all install() rules onto named components so scikit-build-core
can restrict the wheel to the subset that actually belongs there.
The default component is "libtorch" (shared libraries, headers,
runtime data); explicit "torch" tags cover Python-side artifacts
(libtorch_python, the _C extension, version.py, type stubs, yaml /
jinja templates, torchgen packaged inputs, etc.); the existing "dev"
tag for find_package(Torch) configs is kept; and a new "third_party"
sentinel absorbs install rules from vendored subprojects so they
become no-ops at install time.
cmake/InstallComponents.cmake defines two helpers used at every
vendored subproject site:
pytorch_add_thirdparty_subdirectory() wraps add_subdirectory()
and temporarily overrides CMAKE_INSTALL_DEFAULT_COMPONENT_NAME
to "third_party" so the subproject's untagged install() rules
land in the suppressed component.
pytorch_install_thirdparty_headers() mirrors the subset of a
subproject's public headers that the wheel actually needs
(since we just suppressed the upstream install()), tagged with
"libtorch". This keeps libfbgemm.a, libkineto.a, libcpuinfo.a,
libtorch_xpu_ops.a, and the corresponding lib64/cmake/* configs
out of the wheel while preserving the include surface that
torch's public headers and downstream cpp_extension consumers
depend on.
Each add_subdirectory(third_party/...) site is rewritten to use the
wrap macro and, where the subproject contributes public headers, an
immediately-following pytorch_install_thirdparty_headers() (or, for
sleef's generated sleef.h and torch-xpu-ops' sycltla .so libraries,
an explicit install() rule). pyproject.toml selects the wheel
contents via install.components = ["libtorch", "torch", "dev"].
Co-Generated with Claude Code
cc @gujinghui @PenghuiCheng @XiaobingSuper @jianyuh @jgong5 @mingfeima @sanchitintel @ashokei @jingxu10 @min-jean-cho @yanbing-j @Guobing-Chen @Xia-Weiwen @snadampal