[libtorch] update to 2.12 #52046
Draft
EvilMcStevil wants to merge 35 commits into
Draft
Conversation
…e fallback Add libtorch-212 port and fix CUDA 13.2 build deps - ports/libtorch-212: new PyTorch 2.12.0 vcpkg port with CUDA 13.2 support (gflags, glog, zstd features; opencv opt-in only to avoid headless-container UI dep failures; FindCUDAToolkit stub to fix cmake install step) - ports/kineto: renamed from unofficial-kineto - ports/gloo: CUDA 13 / GCC 16 compat patches + missing <cstdint> patch - ports/libtorch: fix-cufft and fix-find-cub patches for CUDA 13.2 - ports/nccl: minor FindNCCL and portfile fixes - build-libtorch.sh: container build script (GCC 13, gfortran-13, ccache) - buildtrees: remove stale third_party/kineto source snapshot Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove 12 dependencies that are either bundled from third_party/ or not referenced by the PyTorch 2.12.0 build system: Bundled (use third_party/ headers, not system packages): cpp-httplib, nlohmann-json, pocketfft, flatbuffers (non-host), gemmlowp (only used by pytorch_qnnpack which is OFF) Not referenced in cmake at all: foxi, lmdb, onnx-optimizer Disabled / duplicate: unofficial-kineto (renamed to kineto), kineto (USE_KINETO=OFF in portfile), mimalloc (USE_MIMALLOC=OFF default, uses bundled when on) Moved to opt-in feature: fbgemm → [fbgemm] feature (USE_FBGEMM already gated by portfile feature mapping; was always OFF since no vcpkg feature existed) flatbuffers host:true is kept — flatc is still needed for mobile_bytecode codegen. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace PyTorch's hard-wired third_party/ targets with system vcpkg
packages. Each change is in its own focused patch file:
fix-system-flatbuffers.patch — cmake/FlatBuffers.cmake: replace bundled
INTERFACE target with find_package(FlatBuffers)/ALIAS; remove no-longer-
needed add_dependencies(torch_python flatbuffers) from torch/CMakeLists.txt
fix-system-httplib.patch — cmake/Dependencies.cmake: replace bundled
add_library(httplib INTERFACE IMPORTED) with find_package(httplib)/ALIAS
fix-system-nlohmann.patch — cmake/Dependencies.cmake: replace bundled
add_library(nlohmann INTERFACE IMPORTED) with
find_package(nlohmann_json)/ALIAS
fix-cmake.patch: extend torch/CMakeLists.txt hunk to also strip the
third_party include dirs for flatbuffers, cpp-httplib and nlohmann
(previously only kineto was removed).
vcpkg.json: re-add cpp-httplib, flatbuffers (lib), nlohmann-json, pocketfft
as explicit dependencies now that we redirect to their vcpkg builds.
(pocketfft header is still copied to third_party/ via portfile; the other
three now route through cmake find_package.)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… to vcpkg Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…e fetch Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove duplicate BUILD_PYTHON=OFF, USE_KINETO=OFF, USE_SYSTEM_LIBS=ON
- Remove unused TARGET_IS_MOBILE / TARGET_IS_APPLE variables
- Remove undefined ${BLAS_OPTIONS} reference
- Remove opencl/mkldnn from vcpkg_check_features (neither is a vcpkg feature)
- Drop cmake options cmake doesn't recognize: USE_METAL, USE_ROCKSDB
- Fix MAYBE_UNUSED_VARIABLES: remove stale entries (USE_SYSTEM_BIND11 typo,
MKLDNN_CPU_RUNTIME/PYTHON_LIBRARY not in OPTIONS); add AT_CUDNN_ENABLED,
USE_VULKAN which are passed but not consumed by PyTorch 2.12 cmake
- Annotate remaining no-op cmake vars (USE_ZSTD, USE_OPENCV) explaining they
still ensure the libraries are installed for auto-detection
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
USE_ZSTD, USE_OPENCV, AT_CUDNN_ENABLED are not referenced by PyTorch 2.12 cmake at all — passing them does nothing. The zstd/opencv vcpkg features still install the libraries; cmake finds them via USE_SYSTEM_LIBS auto-detection. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
./vcpkg x-add-version --alland committing the result.