diff --git a/torch_patches/17559.diff b/torch_patches/17559.diff deleted file mode 100644 index f2f907f503c2..000000000000 --- a/torch_patches/17559.diff +++ /dev/null @@ -1,53 +0,0 @@ -commit 025381c9b6abd0f13a1ca14d63462928b525a351 -Author: Davide Libenzi -Date: Fri Mar 1 10:53:42 2019 -0800 - - Tag the Half structure with proper visibility attribute. - -diff --git a/c10/macros/Export.h b/c10/macros/Export.h -index 977d28a11..f43db9616 100644 ---- a/c10/macros/Export.h -+++ b/c10/macros/Export.h -@@ -38,13 +38,18 @@ - #define C10_EXPORT - #define C10_IMPORT - #endif -+#define C10_EXPORT_ALIGNED(n) C10_EXPORT alignas(n) -+#define C10_IMPORT_ALIGNED(n) C10_IMPORT alignas(n) - #else // _WIN32 - #if defined(__GNUC__) - #define C10_EXPORT __attribute__((__visibility__("default"))) -+#define C10_EXPORT_ALIGNED(n) __attribute__((__visibility__("default"), aligned(n))) - #else // defined(__GNUC__) - #define C10_EXPORT -+#define C10_EXPORT_ALIGNED(n) alignas(n) - #endif // defined(__GNUC__) - #define C10_IMPORT C10_EXPORT -+#define C10_IMPORT_ALIGNED(n) C10_EXPORT_ALIGNED(n) - #endif // _WIN32 - - // Definition of an adaptive XX_API macro, that depends on whether you are -@@ -65,8 +70,10 @@ - // This one is being used by libc10.so - #ifdef C10_BUILD_MAIN_LIB - #define C10_API C10_EXPORT -+#define C10_API_ALIGNED(n) C10_EXPORT_ALIGNED(n) - #else - #define C10_API C10_IMPORT -+#define C10_API_ALIGNED(n) C10_IMPORT_ALIGNED(n) - #endif - - // This one is being used by libcaffe2.so -diff --git a/c10/util/Half.h b/c10/util/Half.h -index e3ba80419..0c0eb0d3f 100644 ---- a/c10/util/Half.h -+++ b/c10/util/Half.h -@@ -321,7 +321,7 @@ namespace detail { - - } // namespace detail - --struct alignas(2) Half { -+struct C10_API_ALIGNED(2) Half { - unsigned short x; - - struct from_bits_t {}; diff --git a/torch_patches/17661.diff b/torch_patches/17661.diff new file mode 100644 index 000000000000..b50d2ec6f077 --- /dev/null +++ b/torch_patches/17661.diff @@ -0,0 +1,98 @@ +commit b05d5fd2ead8bf98976c5b3a6bd20eea61c19407 +Author: Davide Libenzi +Date: Mon Mar 4 10:35:16 2019 -0800 + + Turn the Half::from_bits into a constexpr function to avoid unresolved symbol errors when building in DEBUG mode. + +diff --git a/aten/src/ATen/cuda/NumericLimits.cuh b/aten/src/ATen/cuda/NumericLimits.cuh +index 981bf8c1c..83ac56620 100644 +--- a/aten/src/ATen/cuda/NumericLimits.cuh ++++ b/aten/src/ATen/cuda/NumericLimits.cuh +@@ -80,10 +80,10 @@ struct numeric_limits { + + template <> + struct numeric_limits { +- static inline __host__ __device__ at::Half lowest() { return at::Half(0xFBFF, at::Half::from_bits); } +- static inline __host__ __device__ at::Half max() { return at::Half(0x7BFF, at::Half::from_bits); } +- static inline __host__ __device__ at::Half lower_bound() { return at::Half(0xFC00, at::Half::from_bits); } +- static inline __host__ __device__ at::Half upper_bound() { return at::Half(0x7C00, at::Half::from_bits); } ++ static inline __host__ __device__ at::Half lowest() { return at::Half(0xFBFF, at::Half::from_bits()); } ++ static inline __host__ __device__ at::Half max() { return at::Half(0x7BFF, at::Half::from_bits()); } ++ static inline __host__ __device__ at::Half lower_bound() { return at::Half(0xFC00, at::Half::from_bits()); } ++ static inline __host__ __device__ at::Half upper_bound() { return at::Half(0x7C00, at::Half::from_bits()); } + }; + + template <> +diff --git a/c10/util/Half-inl.h b/c10/util/Half-inl.h +index 966d55f1f..e376aa3df 100644 +--- a/c10/util/Half-inl.h ++++ b/c10/util/Half-inl.h +@@ -254,31 +254,31 @@ class numeric_limits { + static constexpr auto tinyness_before = + numeric_limits::tinyness_before; + static constexpr c10::Half min() { +- return c10::Half(0x0400, c10::Half::from_bits); ++ return c10::Half(0x0400, c10::Half::from_bits()); + } + static constexpr c10::Half lowest() { +- return c10::Half(0xFBFF, c10::Half::from_bits); ++ return c10::Half(0xFBFF, c10::Half::from_bits()); + } + static constexpr c10::Half max() { +- return c10::Half(0x7BFF, c10::Half::from_bits); ++ return c10::Half(0x7BFF, c10::Half::from_bits()); + } + static constexpr c10::Half epsilon() { +- return c10::Half(0x1400, c10::Half::from_bits); ++ return c10::Half(0x1400, c10::Half::from_bits()); + } + static constexpr c10::Half round_error() { +- return c10::Half(0x3800, c10::Half::from_bits); ++ return c10::Half(0x3800, c10::Half::from_bits()); + } + static constexpr c10::Half infinity() { +- return c10::Half(0x7C00, c10::Half::from_bits); ++ return c10::Half(0x7C00, c10::Half::from_bits()); + } + static constexpr c10::Half quiet_NaN() { +- return c10::Half(0x7E00, c10::Half::from_bits); ++ return c10::Half(0x7E00, c10::Half::from_bits()); + } + static constexpr c10::Half signaling_NaN() { +- return c10::Half(0x7D00, c10::Half::from_bits); ++ return c10::Half(0x7D00, c10::Half::from_bits()); + } + static constexpr c10::Half denorm_min() { +- return c10::Half(0x0001, c10::Half::from_bits); ++ return c10::Half(0x0001, c10::Half::from_bits()); + } + }; + +diff --git a/c10/util/Half.cpp b/c10/util/Half.cpp +index 95ec7120d..76e36ea59 100644 +--- a/c10/util/Half.cpp ++++ b/c10/util/Half.cpp +@@ -4,8 +4,6 @@ + + namespace c10 { + +-constexpr Half::from_bits_t Half::from_bits; +- + static_assert( + std::is_standard_layout::value, + "c10::Half must be standard layout."); +diff --git a/c10/util/Half.h b/c10/util/Half.h +index e3ba80419..37d12b162 100644 +--- a/c10/util/Half.h ++++ b/c10/util/Half.h +@@ -325,7 +325,9 @@ struct alignas(2) Half { + unsigned short x; + + struct from_bits_t {}; +- static constexpr from_bits_t from_bits = from_bits_t(); ++ static constexpr from_bits_t from_bits() { ++ return from_bits_t(); ++ } + + // HIP wants __host__ __device__ tag, CUDA does not + #ifdef __HIP_PLATFORM_HCC__