Added some missing conversions to the Half class, and fixed the implementation of the < operator on cuda devices.

This commit is contained in:
Benoit Steiner 2016-04-06 09:59:51 -07:00
parent 10bdd8e378
commit cf7e73addd

View File

@ -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