diff --git a/.ci/docker/ci_commit_pins/pytorch.txt b/.ci/docker/ci_commit_pins/pytorch.txt index bbae77aa463..61b7ab7807e 100644 --- a/.ci/docker/ci_commit_pins/pytorch.txt +++ b/.ci/docker/ci_commit_pins/pytorch.txt @@ -1 +1 @@ -556fc09a9f67f24ca5591ec049c5d0c347c5f62a +b31bad1b8f1331bf43d47f46602cf6141db56844 diff --git a/install_requirements.py b/install_requirements.py index b84e250cf87..4a8d9ed8870 100644 --- a/install_requirements.py +++ b/install_requirements.py @@ -130,7 +130,11 @@ def install_optional_example_requirements(use_pytorch_nightly): if use_pytorch_nightly else "torchvision" ), - f"torchaudio==2.8.0.{NIGHTLY_VERSION}" if use_pytorch_nightly else "torchaudio", + ( + f"torchaudio==2.10.0.{NIGHTLY_VERSION}" + if use_pytorch_nightly + else "torchaudio" + ), ] # Then install domain libraries subprocess.run( diff --git a/runtime/core/portable_type/c10/torch/headeronly/macros/Macros.h b/runtime/core/portable_type/c10/torch/headeronly/macros/Macros.h index e340e7626a0..7c46eda0912 100644 --- a/runtime/core/portable_type/c10/torch/headeronly/macros/Macros.h +++ b/runtime/core/portable_type/c10/torch/headeronly/macros/Macros.h @@ -611,4 +611,60 @@ __host__ __device__ #define C10_RETURN_MOVE_IF_OLD_COMPILER 0 #endif +// The HIDDEN_NAMESPACE_BEGIN and HIDDEN_NAMESPACE_END below +// are needed for maintaining robustness in our header APIs in +// torch/headeronly and torch/csrc/stable under the namespaces +// torch::headeronly and torch::stable respectively. We enforce +// hidden visibility for these APIs because we want to enable +// loading custom extensions compiled against different libtorch +// versions where these APIs may have changed. + +// Helper macros for nested namespace expansion +#define _EXPAND(...) __VA_ARGS__ + +// Macros to handle 1-3 hidden namespace levels when not windows +#define _HIDDEN_NS_GET_MACRO(_1, _2, _3, NAME, ...) NAME +#define _HIDDEN_NS_1(n1) namespace n1 __attribute__((visibility("hidden"))) { +#define _HIDDEN_NS_2(n1, n2) \ + namespace n1 { \ + namespace n2 __attribute__((visibility("hidden"))) { +#define _HIDDEN_NS_3(n1, n2, n3) \ + namespace n1::n2 { \ + namespace n3 __attribute__((visibility("hidden"))) { + +// Macros to close namespaces when not windows +#define _HIDDEN_NS_END_1(n1) } +#define _HIDDEN_NS_END_N(n1, ...) \ + } \ + } + +// Macros to join strs with :: (for win, where symbols are hidden by default) +#define _JOIN_GET_MACRO(_1, _2, _3, NAME, ...) NAME +#define _JOIN_NS1(a) a +#define _JOIN_NS2(a, b) a::b +#define _JOIN_NS3(a, b, c) a::b::c + +#if !defined(HIDDEN_NAMESPACE_BEGIN) +#if defined(__GNUG__) && !defined(_WIN32) +#define HIDDEN_NAMESPACE_BEGIN(...) \ + _EXPAND(_HIDDEN_NS_GET_MACRO( \ + __VA_ARGS__, _HIDDEN_NS_3, _HIDDEN_NS_2, _HIDDEN_NS_1)(__VA_ARGS__)) +#else +#define HIDDEN_NAMESPACE_BEGIN(...) \ + namespace _EXPAND(_JOIN_GET_MACRO( \ + __VA_ARGS__, _JOIN_NS3, _JOIN_NS2, _JOIN_NS1)(__VA_ARGS__)) { +#endif +#endif + +#if !defined(HIDDEN_NAMESPACE_END) +#if defined(__GNUG__) && !defined(_WIN32) +#define HIDDEN_NAMESPACE_END(...) \ + _EXPAND(_HIDDEN_NS_GET_MACRO( \ + __VA_ARGS__, _HIDDEN_NS_END_N, _HIDDEN_NS_END_N, _HIDDEN_NS_END_1)( \ + __VA_ARGS__)) +#else +#define HIDDEN_NAMESPACE_END(...) } +#endif +#endif + #endif // C10_MACROS_MACROS_H_ diff --git a/runtime/core/portable_type/c10/torch/headeronly/util/BFloat16.h b/runtime/core/portable_type/c10/torch/headeronly/util/BFloat16.h index ac47e3f844a..64479ba36f1 100644 --- a/runtime/core/portable_type/c10/torch/headeronly/util/BFloat16.h +++ b/runtime/core/portable_type/c10/torch/headeronly/util/BFloat16.h @@ -395,7 +395,7 @@ inline C10_HOST_DEVICE bool operator<(BFloat16& lhs, BFloat16& rhs) { C10_CLANG_DIAGNOSTIC_POP() } // namespace c10 -namespace torch::headeronly { +HIDDEN_NAMESPACE_BEGIN(torch, headeronly) namespace detail { using c10::detail::bits_from_f32; @@ -415,7 +415,7 @@ using c10::operator/=; using c10::operator<; using c10::operator>; using c10::operator<<; -} // namespace torch::headeronly +HIDDEN_NAMESPACE_END(torch, headeronly) namespace std { diff --git a/runtime/core/portable_type/c10/torch/headeronly/util/Half.h b/runtime/core/portable_type/c10/torch/headeronly/util/Half.h index 9673301e2de..a9c0b166ba2 100644 --- a/runtime/core/portable_type/c10/torch/headeronly/util/Half.h +++ b/runtime/core/portable_type/c10/torch/headeronly/util/Half.h @@ -698,7 +698,7 @@ C10_CLANG_DIAGNOSTIC_POP() } // namespace c10 -namespace torch::headeronly { +HIDDEN_NAMESPACE_BEGIN(torch, headeronly) using c10::Half; using c10::operator+; @@ -724,7 +724,7 @@ using c10::detail::fp16_ieee_to_fp32_bits; using c10::detail::fp16_ieee_to_fp32_value; } // namespace detail -} // namespace torch::headeronly +HIDDEN_NAMESPACE_END(torch, headeronly) namespace std { diff --git a/runtime/core/portable_type/c10/torch/headeronly/util/TypeSafeSignMath.h b/runtime/core/portable_type/c10/torch/headeronly/util/TypeSafeSignMath.h index 561ea0467a0..f41269082d9 100644 --- a/runtime/core/portable_type/c10/torch/headeronly/util/TypeSafeSignMath.h +++ b/runtime/core/portable_type/c10/torch/headeronly/util/TypeSafeSignMath.h @@ -139,10 +139,10 @@ inline constexpr bool less_than_lowest(const T& x) { C10_CLANG_DIAGNOSTIC_POP() -namespace torch::headeronly { +HIDDEN_NAMESPACE_BEGIN(torch, headeronly) using c10::greater_than_max; using c10::is_negative; using c10::less_than_lowest; using c10::signs_differ; using c10::signum; -} // namespace torch::headeronly +HIDDEN_NAMESPACE_END(torch, headeronly) diff --git a/runtime/core/portable_type/c10/torch/headeronly/util/bit_cast.h b/runtime/core/portable_type/c10/torch/headeronly/util/bit_cast.h index 334ba5b8e5b..3f357f8a06a 100644 --- a/runtime/core/portable_type/c10/torch/headeronly/util/bit_cast.h +++ b/runtime/core/portable_type/c10/torch/headeronly/util/bit_cast.h @@ -13,7 +13,7 @@ #endif // __has_include() && (__cplusplus >= 202002L || // (defined(__cpp_lib_bit_cast) && __cpp_lib_bit_cast >= 201806L)) -namespace torch::headeronly { +HIDDEN_NAMESPACE_BEGIN(torch, headeronly) #if C10_HAVE_STD_BIT_CAST using std::bit_cast; @@ -43,7 +43,7 @@ bit_cast(const From& src) noexcept { #endif // C10_HAVE_STD_BIT_CAST #undef C10_HAVE_STD_BIT_CAST -} // namespace torch::headeronly +HIDDEN_NAMESPACE_END(torch, headeronly) namespace c10 { using torch::headeronly::bit_cast; diff --git a/runtime/core/portable_type/c10/torch/headeronly/util/complex.h b/runtime/core/portable_type/c10/torch/headeronly/util/complex.h index e0a356436ac..733a22d5dbb 100644 --- a/runtime/core/portable_type/c10/torch/headeronly/util/complex.h +++ b/runtime/core/portable_type/c10/torch/headeronly/util/complex.h @@ -590,7 +590,7 @@ struct alignas(4) complex { } // namespace c10 -namespace torch::headeronly { +HIDDEN_NAMESPACE_BEGIN(torch, headeronly) using c10::complex; using c10::operator+; using c10::operator-; @@ -611,6 +611,6 @@ using c10::complex_literals::operator""_if; using c10::complex_literals::operator""_id; } // namespace complex_literals -} // namespace torch::headeronly +HIDDEN_NAMESPACE_END(torch, headeronly) C10_CLANG_DIAGNOSTIC_POP() diff --git a/runtime/core/portable_type/c10/torch/headeronly/util/floating_point_utils.h b/runtime/core/portable_type/c10/torch/headeronly/util/floating_point_utils.h index c469cc6a4f6..1e60bd85c10 100644 --- a/runtime/core/portable_type/c10/torch/headeronly/util/floating_point_utils.h +++ b/runtime/core/portable_type/c10/torch/headeronly/util/floating_point_utils.h @@ -4,7 +4,7 @@ #include #include -namespace torch::headeronly::detail { +HIDDEN_NAMESPACE_BEGIN(torch, headeronly, detail) C10_HOST_DEVICE inline float fp32_from_bits(uint32_t w) { #if defined(__OPENCL_VERSION__) @@ -30,7 +30,7 @@ C10_HOST_DEVICE inline uint32_t fp32_to_bits(float f) { #endif } -} // namespace torch::headeronly::detail +HIDDEN_NAMESPACE_END(torch, headeronly, detail) namespace c10::detail { using torch::headeronly::detail::fp32_from_bits; diff --git a/torch_pin.py b/torch_pin.py index 811d81279b7..ffdde14bdb5 100644 --- a/torch_pin.py +++ b/torch_pin.py @@ -1,2 +1,2 @@ TORCH_VERSION = "2.10.0" -NIGHTLY_VERSION = "dev20251017" +NIGHTLY_VERSION = "dev20251025"