Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 0 additions & 53 deletions torch_patches/17559.diff

This file was deleted.

98 changes: 98 additions & 0 deletions torch_patches/17661.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
commit b05d5fd2ead8bf98976c5b3a6bd20eea61c19407
Author: Davide Libenzi <dlibenzi@google.com>
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<int64_t> {

template <>
struct numeric_limits<at::Half> {
- 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<c10::Half> {
static constexpr auto tinyness_before =
numeric_limits<float>::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<Half>::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__