From cf7e73addd6405a132f9848d1d2c7bf93d8afdc0 Mon Sep 17 00:00:00 2001 From: Benoit Steiner Date: Wed, 6 Apr 2016 09:59:51 -0700 Subject: [PATCH] Added some missing conversions to the Half class, and fixed the implementation of the < operator on cuda devices. --- Eigen/src/Core/arch/CUDA/Half.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Eigen/src/Core/arch/CUDA/Half.h b/Eigen/src/Core/arch/CUDA/Half.h index 7f484b636..927be0493 100644 --- a/Eigen/src/Core/arch/CUDA/Half.h +++ b/Eigen/src/Core/arch/CUDA/Half.h @@ -175,11 +175,17 @@ __device__ bool operator != (const half& a, const half& b) { return __hne(a, b); } __device__ bool operator < (const half& a, const half& b) { + return __hlt(a, b); +} +__device__ bool operator <= (const half& a, const half& b) { return __hle(a, b); } __device__ bool operator > (const half& a, const half& b) { return __hgt(a, b); } +__device__ bool operator >= (const half& a, const half& b) { + return __hge(a, b); +} #else // Emulate support for half floats @@ -228,9 +234,15 @@ static inline EIGEN_DEVICE_FUNC bool operator != (const half& a, const half& b) static inline EIGEN_DEVICE_FUNC bool operator < (const half& a, const half& b) { return float(a) < float(b); } +static inline EIGEN_DEVICE_FUNC bool operator <= (const half& a, const half& b) { + return float(a) <= float(b); +} static inline EIGEN_DEVICE_FUNC bool operator > (const half& a, const half& b) { return float(a) > float(b); } +static inline EIGEN_DEVICE_FUNC bool operator >= (const half& a, const half& b) { + return float(a) >= float(b); +} #endif // Emulate support for half floats