diff --git a/ports/libtorch/fix-disable-xnnpack.patch b/ports/libtorch/fix-disable-xnnpack.patch new file mode 100644 index 00000000000000..11f67491511493 --- /dev/null +++ b/ports/libtorch/fix-disable-xnnpack.patch @@ -0,0 +1,9 @@ +--- a/cmake/Dependencies.cmake ++++ b/cmake/Dependencies.cmake +@@ -610,5 +610,5 @@ if(USE_XNNPACK AND NOT USE_SYSTEM_XNNPACK) + include_directories(SYSTEM ${XNNPACK_INCLUDE_DIR}) + list(APPEND Caffe2_DEPENDENCY_LIBS XNNPACK microkernels-prod) +-elseif(NOT TARGET XNNPACK AND USE_SYSTEM_XNNPACK) ++elseif(USE_XNNPACK AND NOT TARGET XNNPACK AND USE_SYSTEM_XNNPACK) + add_library(XNNPACK SHARED IMPORTED) + add_library(microkernels-prod SHARED IMPORTED) diff --git a/ports/libtorch/fix-fbgemm-arch-check.patch b/ports/libtorch/fix-fbgemm-arch-check.patch new file mode 100644 index 00000000000000..5c566c5c06a24b --- /dev/null +++ b/ports/libtorch/fix-fbgemm-arch-check.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -913,7 +913,7 @@ include(ExternalProject) + + # ---[ Dependencies ---[ FBGEMM doesn't work on x86 32bit and + # CMAKE_SYSTEM_PROCESSOR thinks its 64bit +-if(USE_FBGEMM AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|aarch64)$") ++if(USE_FBGEMM AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|AMD64|aarch64|ARM64)$") + message(WARNING + "x86_64 or aarch64 required for FBGEMM. " + "Not compiling with FBGEMM. " diff --git a/ports/libtorch/fix-glog.patch b/ports/libtorch/fix-glog.patch index c3e7d9ad79fb42..9160cb7c8d23ab 100644 --- a/ports/libtorch/fix-glog.patch +++ b/ports/libtorch/fix-glog.patch @@ -45,3 +45,33 @@ } } // namespace c10 +--- a/c10/util/Exception.cpp ++++ b/c10/util/Exception.cpp +@@ -9,18 +9,6 @@ + #include + #include + +-// Google glog's api does not have an external function that allows one to check +-// if glog is initialized or not. It does have an internal function - so we are +-// declaring it here. This is a hack but has been used by a bunch of others too +-// (e.g. Torch, common/init). See also Logging.cpp in this directory. +-#ifdef C10_USE_GLOG +-namespace google { +-namespace glog_internal_namespace_ { +-bool IsGoogleLoggingInitialized(); +-} // namespace glog_internal_namespace_ +-} // namespace google +-#endif +- + namespace c10 { + + Error::Error(std::string msg, Backtrace backtrace, const void* caller) +@@ -265,7 +253,7 @@ + // During static initialization (before InitGoogleLogging), glog's global + // flags may not be constructed yet. Accessing them causes SIOF crashes + // (T253115013, D96553733). Fall back to stderr in that case. +- if (!::google::glog_internal_namespace_::IsGoogleLoggingInitialized()) { ++ if (!::google::IsGoogleLoggingInitialized()) { + std::cerr << warning.source_location().file << ':' + << warning.source_location().line + << ": Warning: " << warning.msg() << " (function " diff --git a/ports/libtorch/fix-headeronly-glob.patch b/ports/libtorch/fix-headeronly-glob.patch new file mode 100644 index 00000000000000..41f0526e0c112a --- /dev/null +++ b/ports/libtorch/fix-headeronly-glob.patch @@ -0,0 +1,19 @@ +--- a/torch/headeronly/CMakeLists.txt ++++ b/torch/headeronly/CMakeLists.txt +@@ -19,13 +19,15 @@ configure_file( + ${CMAKE_BINARY_DIR}/torch/headeronly/macros/cmake_macros.h) + + file(GLOB HEADERONLY_HEADERS CONFIGURE_DEPENDS +- *.h + core/**/*.h + cpu/**/*.h + macros/*.h + util/*.h + ) + ++set_source_files_properties(version.h PROPERTIES GENERATED TRUE) ++list(APPEND HEADERONLY_HEADERS ${CMAKE_CURRENT_LIST_DIR}/version.h) ++ + add_library(headeronly INTERFACE ${HEADERONLY_HEADERS}) + + install(FILES ${CMAKE_BINARY_DIR}/torch/headeronly/macros/cmake_macros.h diff --git a/ports/libtorch/fix-httplib-params.patch b/ports/libtorch/fix-httplib-params.patch new file mode 100644 index 00000000000000..87eb111618e797 --- /dev/null +++ b/ports/libtorch/fix-httplib-params.patch @@ -0,0 +1,26 @@ +--- a/torch/csrc/distributed/c10d/control_plane/WorkerServer.cpp ++++ b/torch/csrc/distributed/c10d/control_plane/WorkerServer.cpp +@@ -13,19 +13,21 @@ namespace c10d::control_plane { + namespace { + class RequestImpl : public Request { + public: +- RequestImpl(const httplib::Request& req) : req_(req) {} ++ RequestImpl(const httplib::Request& req) ++ : req_(req), params_(req.params.begin(), req.params.end()) {} + + const std::string& body() const override { + return req_.body; + } + + const std::multimap& params() const override { +- return req_.params; ++ return params_; + } + + private: + // NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members) + const httplib::Request& req_; ++ std::multimap params_; + }; + + class ResponseImpl : public Response { diff --git a/ports/libtorch/fix-python-package-data.patch b/ports/libtorch/fix-python-package-data.patch new file mode 100644 index 00000000000000..e04c533c607d69 --- /dev/null +++ b/ports/libtorch/fix-python-package-data.patch @@ -0,0 +1,22 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1466,13 +1466,17 @@ + # inductor templates, and symlink-replacement copies. Previously handled + # by setup.py; now consolidated here for both scikit-build-core and + # setuptools builds. +-include(cmake/FileMirroring.cmake) ++if(BUILD_PYTHON) ++ include(cmake/FileMirroring.cmake) ++endif() + + # Package data: install non-Python data files (type stubs, templates, + # headers, etc.) into the torch package. Previously declared via + # setup.py package_data; now consolidated here for both scikit-build-core + # and setuptools builds. +-include(cmake/PackageData.cmake) ++if(BUILD_PYTHON) ++ include(cmake/PackageData.cmake) ++endif() + + include(cmake/PostBuildSteps.cmake) + diff --git a/ports/libtorch/fix-system-concurrentqueue.patch b/ports/libtorch/fix-system-concurrentqueue.patch new file mode 100644 index 00000000000000..c8acca75889206 --- /dev/null +++ b/ports/libtorch/fix-system-concurrentqueue.patch @@ -0,0 +1,10 @@ +--- a/cmake/Dependencies.cmake ++++ b/cmake/Dependencies.cmake +@@ -1774,3 +1774,5 @@ + # Include moodycamel +-add_library(moodycamel INTERFACE IMPORTED) +-include_directories(moodycamel SYSTEM INTERFACE ${PROJECT_SOURCE_DIR}/third_party/concurrentqueue) ++find_package(concurrentqueue CONFIG REQUIRED) ++add_library(moodycamel ALIAS concurrentqueue::concurrentqueue) ++get_target_property(moodycamel_INCLUDE_DIRS concurrentqueue::concurrentqueue INTERFACE_INCLUDE_DIRECTORIES) ++include_directories(SYSTEM ${moodycamel_INCLUDE_DIRS}) diff --git a/ports/libtorch/fix-system-fmt.patch b/ports/libtorch/fix-system-fmt.patch index ef1b28ffa230b0..072d79fdc2118f 100644 --- a/ports/libtorch/fix-system-fmt.patch +++ b/ports/libtorch/fix-system-fmt.patch @@ -1,7 +1,8 @@ +diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake +index 2baa187..65f9e01 100644 --- a/cmake/Dependencies.cmake +++ b/cmake/Dependencies.cmake -@@ -1597,22 +1597,24 @@ - # Install `fmtlib` header. +@@ -1633,6 +1633,7 @@ endif() # This was the default behavior before version 12.0.0. # Since PyTorch C API depends on it, make it available for projects that # depend on PyTorch. @@ -9,16 +10,9 @@ set(FMT_INSTALL ON) set(TEMP_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libs" FORCE) - add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/fmt) - - # Disable compiler feature checks for `fmt`. - # - # CMake compiles a little program to check compiler features. Some of our build - # configurations (notably the mobile build analyzer) will populate - # CMAKE_CXX_FLAGS in ways that break feature checks. Since we already know - # `fmt` is compatible with a superset of the compilers that PyTorch is, it - # shouldn't be too bad to just disable the checks. - set_target_properties(fmt-header-only PROPERTIES INTERFACE_COMPILE_FEATURES "") +@@ -1658,8 +1659,9 @@ target_compile_definitions(fmt PUBLIC "FMT_NO_UNIQUE_ADDRESS=${_fmt_no_unique_ad + target_compile_definitions(fmt-header-only INTERFACE "FMT_NO_UNIQUE_ADDRESS=${_fmt_no_unique_address}") + unset(_fmt_no_unique_address) +endif() +find_package(fmt REQUIRED) @@ -26,3 +20,4 @@ -set(BUILD_SHARED_LIBS ${TEMP_BUILD_SHARED_LIBS} CACHE BOOL "Build shared libs" FORCE) # ---[ Kineto + # edge profiler depends on KinetoProfiler but it only does cpu diff --git a/ports/libtorch/fix-system-xnnpack.patch b/ports/libtorch/fix-system-xnnpack.patch deleted file mode 100644 index 4df7389dd218dc..00000000000000 --- a/ports/libtorch/fix-system-xnnpack.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/cmake/Dependencies.cmake -+++ b/cmake/Dependencies.cmake -@@ -530,3 +530,9 @@ endif() - - # ---[ XNNPACK -+if(USE_XNNPACK) -+ find_package(unofficial-xnnpack CONFIG REQUIRED) -+ add_library(XNNPACK ALIAS unofficial::xnnpack::XNNPACK) -+ add_library(microkernels-prod ALIAS unofficial::xnnpack::microkernels-prod) -+ list(APPEND Caffe2_DEPENDENCY_LIBS XNNPACK microkernels-prod) -+endif() - if(USE_XNNPACK AND NOT USE_SYSTEM_XNNPACK) diff --git a/ports/libtorch/fix-torch-global-deps.patch b/ports/libtorch/fix-torch-global-deps.patch new file mode 100644 index 00000000000000..dae9d364a63e75 --- /dev/null +++ b/ports/libtorch/fix-torch-global-deps.patch @@ -0,0 +1,11 @@ +--- a/caffe2/CMakeLists.txt ++++ b/caffe2/CMakeLists.txt +@@ -1835,7 +1835,7 @@ endif() + # namespaces, so libtorch is loaded with all its dependencies in a local scope. + # That usually leads to missing symbol errors at run-time, so to avoid a situation like + # this we have to preload those libs in a global namespace. +-if(BUILD_SHARED_LIBS) ++if(BUILD_SHARED_LIBS AND BUILD_PYTHON) + add_library(torch_global_deps SHARED ${TORCH_SRC_DIR}/csrc/empty.c) + if(HAVE_SOVERSION) + set_target_properties(torch_global_deps PROPERTIES diff --git a/ports/libtorch/fix-windows-install-dirs.patch b/ports/libtorch/fix-windows-install-dirs.patch index eedeaca402c595..ee87416dc364bc 100644 --- a/ports/libtorch/fix-windows-install-dirs.patch +++ b/ports/libtorch/fix-windows-install-dirs.patch @@ -1,6 +1,8 @@ +diff --git a/c10/CMakeLists.txt b/c10/CMakeLists.txt +index bd138d2..8e63fe8 100644 --- a/c10/CMakeLists.txt +++ b/c10/CMakeLists.txt -@@ -161,7 +161,10 @@ +@@ -162,7 +162,10 @@ if(NOT BUILD_LIBTORCHLESS) # Note: for now, we will put all export path into one single Caffe2Targets group # to deal with the cmake deployment need. Inside the Caffe2Targets set, the # individual libraries like libc10.so and libcaffe2.so are still self-contained. @@ -12,9 +14,11 @@ endif() install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR} +diff --git a/c10/cuda/CMakeLists.txt b/c10/cuda/CMakeLists.txt +index a337614..425287e 100644 --- a/c10/cuda/CMakeLists.txt +++ b/c10/cuda/CMakeLists.txt -@@ -86,7 +86,10 @@ +@@ -86,7 +86,10 @@ if(NOT BUILD_LIBTORCHLESS) # Note: for now, we will put all export path into one single Caffe2Targets group # to deal with the cmake deployment need. Inside the Caffe2Targets set, the # individual libraries like libc10.so and libcaffe2.so are still self-contained. @@ -26,9 +30,11 @@ endif() +diff --git a/c10/hip/CMakeLists.txt b/c10/hip/CMakeLists.txt +index 0f86f03..64e0bb3 100644 --- a/c10/hip/CMakeLists.txt +++ b/c10/hip/CMakeLists.txt -@@ -56,7 +56,10 @@ +@@ -52,7 +52,10 @@ if(NOT BUILD_LIBTORCHLESS) $ $ $) @@ -40,9 +46,11 @@ set(C10_HIP_LIB c10_hip) endif() +diff --git a/c10/xpu/CMakeLists.txt b/c10/xpu/CMakeLists.txt +index 349b209..b1ba10e 100644 --- a/c10/xpu/CMakeLists.txt +++ b/c10/xpu/CMakeLists.txt -@@ -49,7 +49,10 @@ +@@ -49,7 +49,10 @@ if(NOT BUILD_LIBTORCHLESS) $ $ ) @@ -54,9 +62,11 @@ set(C10_XPU_LIB c10_xpu) add_subdirectory(test) endif() +diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt +index e4a0454..2901fc4 100644 --- a/caffe2/CMakeLists.txt +++ b/caffe2/CMakeLists.txt -@@ -573,7 +573,10 @@ +@@ -561,7 +561,10 @@ if(USE_CUDA) endif() target_link_libraries(caffe2_nvrtc PRIVATE caffe2::nvrtc ${DELAY_LOAD_FLAGS}) @@ -68,7 +78,7 @@ if(USE_NCCL) list(APPEND Caffe2_GPU_SRCS ${TORCH_SRC_DIR}/csrc/cuda/nccl.cpp) -@@ -656,7 +659,10 @@ +@@ -645,7 +648,10 @@ if(USE_ROCM) target_link_libraries(caffe2_nvrtc hip::amdhip64 hiprtc::hiprtc) target_include_directories(caffe2_nvrtc PRIVATE ${CMAKE_BINARY_DIR}) target_compile_definitions(caffe2_nvrtc PRIVATE USE_ROCM __HIP_PLATFORM_AMD__) @@ -80,7 +90,7 @@ endif() if(NOT NO_API AND NOT BUILD_LITE_INTERPRETER) -@@ -1067,7 +1073,10 @@ +@@ -1065,7 +1071,10 @@ elseif(USE_CUDA) target_compile_definitions(torch_cuda PUBLIC USE_NVSHMEM) target_compile_definitions(torch_nvshmem PUBLIC USE_NVSHMEM) target_link_libraries(torch_cuda PRIVATE torch_nvshmem) @@ -92,7 +102,7 @@ else() message(STATUS "NVSHMEM not found, not building with NVSHMEM support.") endif() -@@ -1130,7 +1139,10 @@ +@@ -1128,7 +1137,10 @@ elseif(USE_CUDA) CUDA::culibos ${CMAKE_DL_LIBS}) endif() set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/../aten/src/ATen/native/cuda/LinearAlgebraStubs.cpp PROPERTIES COMPILE_FLAGS "-DBUILD_LAZY_CUDA_LINALG") @@ -104,20 +114,20 @@ endif() if(USE_PRECOMPILED_HEADERS) -@@ -1528,8 +1540,10 @@ - target_link_libraries(torch_rocshmem PRIVATE roc::rocshmem) - target_link_libraries(torch_hip PRIVATE torch_rocshmem) +@@ -1520,8 +1532,10 @@ if(USE_ROCM) + target_link_libraries(torch_rocshmem PRIVATE roc::rocshmem) + target_link_libraries(torch_hip PRIVATE torch_rocshmem) -- install(TARGETS torch_rocshmem EXPORT Caffe2Targets DESTINATION -- "${TORCH_INSTALL_LIB_DIR}") -+ install(TARGETS torch_rocshmem EXPORT Caffe2Targets -+ RUNTIME DESTINATION "${TORCH_INSTALL_BIN_DIR}" -+ LIBRARY DESTINATION "${TORCH_INSTALL_LIB_DIR}" -+ ARCHIVE DESTINATION "${TORCH_INSTALL_LIB_DIR}") - elseif(rocshmem_FOUND) - message(STATUS - "rocSHMEM found but skipped: PYTORCH_ROCM_ARCH has no entry in " -@@ -1676,17 +1690,32 @@ +- install(TARGETS torch_rocshmem EXPORT Caffe2Targets DESTINATION +- "${TORCH_INSTALL_LIB_DIR}") ++ install(TARGETS torch_rocshmem EXPORT Caffe2Targets ++ RUNTIME DESTINATION "${TORCH_INSTALL_BIN_DIR}" ++ LIBRARY DESTINATION "${TORCH_INSTALL_LIB_DIR}" ++ ARCHIVE DESTINATION "${TORCH_INSTALL_LIB_DIR}") + else() + message(STATUS + "rocSHMEM found but skipped: PYTORCH_ROCM_ARCH has no entry in " +@@ -1673,17 +1687,32 @@ endif() caffe2_interface_library(torch torch_library) @@ -155,7 +165,7 @@ target_link_libraries(torch PUBLIC torch_cpu_library) -@@ -1829,7 +1858,10 @@ +@@ -1826,7 +1855,10 @@ if(BUILD_SHARED_LIBS) target_link_libraries(torch_global_deps torch::nvtoolsext) endif() endif() @@ -167,23 +177,11 @@ endif() # ---[ Caffe2 HIP sources. ---- a/torch/CMakeLists.txt -+++ b/torch/CMakeLists.txt -@@ -459,7 +459,10 @@ - set_target_properties(torch_python PROPERTIES LINK_FLAGS ${TORCH_PYTHON_LINK_FLAGS}) - endif() - --install(TARGETS torch_python DESTINATION "${TORCH_INSTALL_LIB_DIR}") -+install(TARGETS torch_python -+ RUNTIME DESTINATION "${TORCH_INSTALL_BIN_DIR}" -+ LIBRARY DESTINATION "${TORCH_INSTALL_LIB_DIR}" -+ ARCHIVE DESTINATION "${TORCH_INSTALL_LIB_DIR}") - - # Generate torch/version.py from the appropriate CMake cache variables. - if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") +diff --git a/test/cpp/c10d/CMakeLists.txt b/test/cpp/c10d/CMakeLists.txt +index aa98db5..616bba8 100644 --- a/test/cpp/c10d/CMakeLists.txt +++ b/test/cpp/c10d/CMakeLists.txt -@@ -79,7 +79,10 @@ +@@ -80,7 +80,10 @@ if(USE_CUDA) LINK_LIBRARIES torch_cpu c10d_cuda_test gtest_main __caffe2_nccl INSTALL_TEST ${INSTALL_TEST}) target_compile_definitions(NCCLDevCommManagerTest PRIVATE USE_CUDA USE_NCCL) if(INSTALL_TEST) @@ -195,7 +193,7 @@ endif() endif() if(USE_UCC AND USE_C10D_UCC) -@@ -91,7 +94,10 @@ +@@ -92,7 +95,10 @@ if(USE_CUDA) ProcessGroupUCCTest.cpp LINK_LIBRARIES torch_cpu c10d_cuda_test gtest_main __caffe2_ucc INSTALL_TEST ${INSTALL_TEST}) if(INSTALL_TEST) @@ -207,7 +205,7 @@ endif() endif() elseif(USE_ROCM) -@@ -107,7 +113,10 @@ +@@ -108,7 +114,10 @@ elseif(USE_ROCM) hip/ProcessGroupNCCLErrorsTest.cpp LINK_LIBRARIES torch_cpu c10d_hip_test gtest_main __caffe2_nccl INSTALL_TEST ${INSTALL_TEST}) if(INSTALL_TEST) @@ -219,7 +217,7 @@ endif() endif() if(USE_UCC AND USE_C10D_UCC) -@@ -115,7 +124,10 @@ +@@ -116,7 +125,10 @@ elseif(USE_ROCM) hip/ProcessGroupUCCTest.cpp LINK_LIBRARIES torch_cpu c10d_hip_test gtest_main __caffe2_ucc INSTALL_TEST ${INSTALL_TEST}) if(INSTALL_TEST) @@ -231,9 +229,11 @@ endif() endif() else() +diff --git a/test/cpp/jit/CMakeLists.txt b/test/cpp/jit/CMakeLists.txt +index 552f8cf..2299940 100644 --- a/test/cpp/jit/CMakeLists.txt +++ b/test/cpp/jit/CMakeLists.txt -@@ -32,9 +32,18 @@ +@@ -32,9 +32,18 @@ endif() target_link_libraries(backend_with_compiler torch) if(INSTALL_TEST) @@ -255,4 +255,19 @@ endif() # Build the cpp gtest binary containing the cpp-only tests. +diff --git a/torch/CMakeLists.txt b/torch/CMakeLists.txt +index 23aa88d..2381304 100644 +--- a/torch/CMakeLists.txt ++++ b/torch/CMakeLists.txt +@@ -439,7 +439,10 @@ if(NOT TORCH_PYTHON_LINK_FLAGS STREQUAL "") + set_target_properties(torch_python PROPERTIES LINK_FLAGS "${TORCH_PYTHON_LINK_FLAGS}") + endif() + +-install(TARGETS torch_python DESTINATION "${TORCH_INSTALL_LIB_DIR}") ++install(TARGETS torch_python ++ RUNTIME DESTINATION "${TORCH_INSTALL_BIN_DIR}" ++ LIBRARY DESTINATION "${TORCH_INSTALL_LIB_DIR}" ++ ARCHIVE DESTINATION "${TORCH_INSTALL_LIB_DIR}") + # Build the torch._C Python extension module from the thin stub that + # forwards to torch_python. This was historically built by setuptools; diff --git a/ports/libtorch/portfile.cmake b/ports/libtorch/portfile.cmake index fc83a1659f17a3..9c34a0767a7dda 100644 --- a/ports/libtorch/portfile.cmake +++ b/ports/libtorch/portfile.cmake @@ -4,7 +4,7 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO pytorch/pytorch REF "v${VERSION}" - SHA512 f5ab0f6933d88271f772b416f8c9b3b0d3e1ffaf8d00838b455206266b40d7c805e34003d84b01cddc7f1ad917dd72d6f79a05063b0962cbf223d9042cff3206 + SHA512 0f7465835ae9206746d507e1b927afb94f8860248473f2d1c5d71ccd40defbd23d0e3e27a1b09deb907e753a7c9008352830170b53441701ade0916d68a42562 HEAD_REF master PATCHES fix-osx-protobuf.patch @@ -19,12 +19,15 @@ vcpkg_from_github( fix-glog.patch fix-system-flatbuffers.patch fix-system-httplib.patch + fix-httplib-params.patch fix-system-nlohmann.patch + fix-system-concurrentqueue.patch fix-system-pthreadpool.patch fix-system-cpuinfo.patch - fix-system-xnnpack.patch + fix-disable-xnnpack.patch fix-system-onnx.patch fix-system-cutlass.patch + fix-fbgemm-arch-check.patch fix-system-fbgemm.patch fix-system-nnpack.patch fix-system-kleidiai.patch @@ -35,6 +38,9 @@ vcpkg_from_github( fix-cudnn-frontend.patch fix-windows-install-dirs.patch fix-async-mm-cutlass.patch + fix-python-package-data.patch + fix-headeronly-glob.patch + fix-torch-global-deps.patch ) file(REMOVE_RECURSE "${SOURCE_PATH}/caffe2/core/macros.h") # We must use generated header files @@ -175,17 +181,6 @@ if(VCPKG_TARGET_IS_LINUX AND VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") list(APPEND FEATURE_OPTIONS -DUSE_PRIORITIZED_TEXT_FOR_LD=OFF) endif() -if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") - # PyTorch ends up reporting "USE_XNNPACK: OFF" on x86-windows anyway (some - # later guard flips it), but fix-system-xnnpack.patch fires at Dependencies.cmake:530 - # while USE_XNNPACK is still ON and appends XNNPACK + microkernels-prod to - # Caffe2_DEPENDENCY_LIBS. That list never gets cleaned up, and the x86-windows - # imported targets fail the generate-time IMPORTED_IMPLIB check (x64-windows - # tolerates the same shape). Force the option off from the start so our patch - # branch is skipped entirely. - list(APPEND FEATURE_OPTIONS -DUSE_XNNPACK=OFF) -endif() - set(TARGET_IS_MOBILE OFF) if(VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_IOS) set(TARGET_IS_MOBILE ON) @@ -222,6 +217,7 @@ vcpkg_cmake_configure( -DUSE_PYTORCH_METAL=OFF -DUSE_PYTORCH_METAL_EXPORT=OFF -DUSE_PYTORCH_QNNPACK:BOOL=OFF + -DUSE_XNNPACK:BOOL=OFF # deprecated with PyTorch Mobile; off by default upstream -DUSE_ITT=OFF -DUSE_OBSERVERS=OFF -DUSE_KINETO=OFF @@ -294,8 +290,10 @@ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share" ) -vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") - - -set(VCPKG_POLICY_DLLS_WITHOUT_EXPORTS enabled) # torch_global_deps.dll is empty.c and just for linking deps - +# miniz is a fork carrying PyTorch-specific additions (MZ_ZIP_FLAG_DO_NOT_COMPUTE_CRC32, +# an m_pSeek hook), so it cannot be replaced by the vcpkg miniz port; it is compiled +# into torch_cpu and needs its own notice. +vcpkg_install_copyright(FILE_LIST + "${SOURCE_PATH}/LICENSE" + "${SOURCE_PATH}/third_party/miniz-3.0.2/LICENSE" +) diff --git a/ports/libtorch/vcpkg.json b/ports/libtorch/vcpkg.json index c578633192755d..55e0c2bec6d966 100644 --- a/ports/libtorch/vcpkg.json +++ b/ports/libtorch/vcpkg.json @@ -1,13 +1,19 @@ { "name": "libtorch", - "version": "2.12.0", + "version": "2.13.0", "description": "Tensors and Dynamic neural networks in Python with strong GPU acceleration", "homepage": "https://pytorch.org/", "license": null, "supports": "(windows & !static) | osx | linux", "dependencies": [ + "concurrentqueue", "cpp-httplib", - "cpuinfo", + { + "name": "cpuinfo", + "features": [ + "clog" + ] + }, "eigen3", { "name": "fbgemm", @@ -56,8 +62,7 @@ { "name": "vcpkg-get-python-packages", "host": true - }, - "xnnpack" + } ], "default-features": [ "blas" diff --git a/versions/baseline.json b/versions/baseline.json index 4aeeaac6f43e32..5c4d2ab0058d2e 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -5809,7 +5809,7 @@ "port-version": 3 }, "libtorch": { - "baseline": "2.12.0", + "baseline": "2.13.0", "port-version": 0 }, "libtorrent": { diff --git a/versions/l-/libtorch.json b/versions/l-/libtorch.json index 3c3884503c5744..27d7a07ed925c0 100644 --- a/versions/l-/libtorch.json +++ b/versions/l-/libtorch.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "c6fbf85724803f1b6df9c2f29f0a1632dee4c86b", + "version": "2.13.0", + "port-version": 0 + }, { "git-tree": "2fa89b0a6cafef5e0abc5a21d72441119738595e", "version": "2.12.0",