Skip to content

[libtorch] update to 2.12 #52046

Draft
EvilMcStevil wants to merge 35 commits into
microsoft:masterfrom
EvilMcStevil:torch-2.12-2
Draft

[libtorch] update to 2.12 #52046
EvilMcStevil wants to merge 35 commits into
microsoft:masterfrom
EvilMcStevil:torch-2.12-2

Conversation

@EvilMcStevil
Copy link
Copy Markdown
Contributor

@EvilMcStevil EvilMcStevil commented May 27, 2026

  • Changes comply with the maintainer guide.
  • SHA512s are updated for each updated download.
  • The "supports" clause reflects platforms that may be fixed by this new version, or no changes were necessary.
  • Any fixed CI baseline and CI feature baseline entries are removed from that file, or no entries needed to be changed.
  • All patch files in the port are applied and succeed.
  • The version database is fixed by rerunning ./vcpkg x-add-version --all and committing the result.
  • Exactly one version is added in each modified versions file.

Steve Brain and others added 30 commits April 12, 2026 18:48
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant