[BE] Update TensorPipe pin (#159834)

No functional changes, just:
- Update C++ standard to C++17
- Update `cmake` min version to 3.18
- Update `libuv` dependency to 1.51 (to move its cmake min version to 3.10)
- Replace boost optional implementation with `std::optional` wrapper
- Make it compilable with gcc-14.x plus by including `cstddef` in few headers
-  Avoid using deprecated enums for MacOS builds

Pull Request resolved: https://github.com/pytorch/pytorch/pull/159834
Approved by: https://github.com/Skylion007
This commit is contained in:
Nikita Shulga
2025-08-05 11:59:20 -07:00
committed by PyTorch MergeBot
parent eb25a95a6e
commit 9b953bb3fb
6 changed files with 6 additions and 19 deletions

View File

@ -1166,17 +1166,10 @@ if(USE_DISTRIBUTED AND USE_TENSORPIPE)
# Tensorpipe uses cuda_add_library # Tensorpipe uses cuda_add_library
torch_update_find_cuda_flags() torch_update_find_cuda_flags()
if(CMAKE_VERSION VERSION_GREATER_EQUAL "4.0.0")
message(WARNING "Archived TensorPipe forces CMake compatibility mode")
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
endif()
add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/tensorpipe) add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/tensorpipe)
# Suppress warning to unblock libnop compilation by clang-17 # Suppress warning to unblock libnop compilation by clang-17
# See https://github.com/pytorch/pytorch/issues/151316 # See https://github.com/pytorch/pytorch/issues/151316
target_compile_options_if_supported(tensorpipe -Wno-missing-template-arg-list-after-template-kw) target_compile_options_if_supported(tensorpipe -Wno-missing-template-arg-list-after-template-kw)
if(CMAKE_VERSION VERSION_GREATER_EQUAL "4.0.0")
unset(CMAKE_POLICY_VERSION_MINIMUM)
endif()
list(APPEND Caffe2_DEPENDENCY_LIBS tensorpipe) list(APPEND Caffe2_DEPENDENCY_LIBS tensorpipe)
list(APPEND Caffe2_DEPENDENCY_LIBS nlohmann) list(APPEND Caffe2_DEPENDENCY_LIBS nlohmann)

View File

@ -7,6 +7,7 @@ LIBUV_COMMON_SRCS = [
"third_party/libuv/src/inet.c", "third_party/libuv/src/inet.c",
"third_party/libuv/src/random.c", "third_party/libuv/src/random.c",
"third_party/libuv/src/strscpy.c", "third_party/libuv/src/strscpy.c",
"third_party/libuv/src/strtok.c",
"third_party/libuv/src/threadpool.c", "third_party/libuv/src/threadpool.c",
"third_party/libuv/src/timer.c", "third_party/libuv/src/timer.c",
"third_party/libuv/src/uv-common.c", "third_party/libuv/src/uv-common.c",
@ -37,9 +38,7 @@ LIBUV_POSIX_SRCS = [
LIBUV_LINUX_SRCS = LIBUV_POSIX_SRCS + [ LIBUV_LINUX_SRCS = LIBUV_POSIX_SRCS + [
"third_party/libuv/src/unix/proctitle.c", "third_party/libuv/src/unix/proctitle.c",
"third_party/libuv/src/unix/linux-core.c", "third_party/libuv/src/unix/linux.c",
"third_party/libuv/src/unix/linux-inotify.c",
"third_party/libuv/src/unix/linux-syscalls.c",
"third_party/libuv/src/unix/procfs-exepath.c", "third_party/libuv/src/unix/procfs-exepath.c",
"third_party/libuv/src/unix/random-getrandom.c", "third_party/libuv/src/unix/random-getrandom.c",
"third_party/libuv/src/unix/random-sysctl-linux.c", "third_party/libuv/src/unix/random-sysctl-linux.c",
@ -60,6 +59,7 @@ cc_library(
"third_party/libuv/src/unix/*.h", "third_party/libuv/src/unix/*.h",
], ],
), ),
copts = ["-D_GNU_SOURCE"],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )
@ -151,7 +151,7 @@ cc_library(
".", ".",
], ],
copts = [ copts = [
"-std=c++14", "-std=c++17",
], ],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
@ -168,7 +168,7 @@ cc_library(
".", ".",
], ],
copts = [ copts = [
"-std=c++14", "-std=c++17",
], ],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [

View File

@ -8,10 +8,8 @@
#include <fmt/format.h> #include <fmt/format.h>
C10_DIAGNOSTIC_PUSH_AND_IGNORED_IF_DEFINED("-Wdeprecated") C10_DIAGNOSTIC_PUSH_AND_IGNORED_IF_DEFINED("-Wdeprecated")
C10_DIAGNOSTIC_PUSH_AND_IGNORED_IF_DEFINED("-Wextra-semi")
#include <tensorpipe/tensorpipe.h> #include <tensorpipe/tensorpipe.h>
C10_DIAGNOSTIC_POP() C10_DIAGNOSTIC_POP()
C10_DIAGNOSTIC_POP()
#include <torch/csrc/distributed/rpc/agent_utils.h> #include <torch/csrc/distributed/rpc/agent_utils.h>
#include <torch/csrc/distributed/rpc/tensorpipe_utils.h> #include <torch/csrc/distributed/rpc/tensorpipe_utils.h>

View File

@ -7,12 +7,10 @@
#include <c10/cuda/CUDAGuard.h> #include <c10/cuda/CUDAGuard.h>
#include <c10/cuda/CUDAStream.h> #include <c10/cuda/CUDAStream.h>
C10_DIAGNOSTIC_PUSH_AND_IGNORED_IF_DEFINED("-Wextra-semi")
C10_DIAGNOSTIC_PUSH_AND_IGNORED_IF_DEFINED("-Wdeprecated") C10_DIAGNOSTIC_PUSH_AND_IGNORED_IF_DEFINED("-Wdeprecated")
#include <tensorpipe/tensorpipe.h> #include <tensorpipe/tensorpipe.h>
#include <tensorpipe/tensorpipe_cuda.h> #include <tensorpipe/tensorpipe_cuda.h>
C10_DIAGNOSTIC_POP() C10_DIAGNOSTIC_POP()
C10_DIAGNOSTIC_POP()
namespace torch::distributed::rpc { namespace torch::distributed::rpc {
namespace { namespace {

View File

@ -6,10 +6,8 @@
#include <limits> #include <limits>
C10_DIAGNOSTIC_PUSH_AND_IGNORED_IF_DEFINED("-Wdeprecated") C10_DIAGNOSTIC_PUSH_AND_IGNORED_IF_DEFINED("-Wdeprecated")
C10_DIAGNOSTIC_PUSH_AND_IGNORED_IF_DEFINED("-Wextra-semi")
#include <tensorpipe/tensorpipe.h> #include <tensorpipe/tensorpipe.h>
C10_DIAGNOSTIC_POP() C10_DIAGNOSTIC_POP()
C10_DIAGNOSTIC_POP()
namespace torch::distributed::rpc { namespace torch::distributed::rpc {
namespace { namespace {