aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src
diff options
context:
space:
mode:
authorGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2016-02-19 10:05:59 -0800
committerGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2016-02-19 10:05:59 -0800
commit180156ba1aefceae0bd93f056e5807a83ccbb1b5 (patch)
treede29c755cead6e1d6b1c55c58f78c003bd6799f6 /Eigen/src
parent5c4901b83a3ec15988521e195abc05e804c541dc (diff)
Added support for tensor reductions on half floats
Diffstat (limited to 'Eigen/src')
-rw-r--r--Eigen/src/Core/arch/CUDA/TypeCasting.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/Eigen/src/Core/arch/CUDA/TypeCasting.h b/Eigen/src/Core/arch/CUDA/TypeCasting.h
index 279fd4fd0..2742a4e7b 100644
--- a/Eigen/src/Core/arch/CUDA/TypeCasting.h
+++ b/Eigen/src/Core/arch/CUDA/TypeCasting.h
@@ -34,6 +34,26 @@ template<>
struct functor_traits<scalar_cast_op<float, half> >
{ enum { Cost = NumTraits<float>::AddCost, PacketAccess = false }; };
+
+template<>
+struct scalar_cast_op<int, half> {
+ EIGEN_EMPTY_STRUCT_CTOR(scalar_cast_op)
+ typedef half result_type;
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE half operator() (const int& a) const {
+ #if defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 530
+ return __float2half(static_cast<float>(a));
+ #else
+ assert(false && "tbd");
+ return half();
+ #endif
+ }
+};
+
+template<>
+struct functor_traits<scalar_cast_op<int, half> >
+{ enum { Cost = NumTraits<float>::AddCost, PacketAccess = false }; };
+
+
template<>
struct scalar_cast_op<half, float> {
EIGEN_EMPTY_STRUCT_CTOR(scalar_cast_op)