Added support for operators +=, -=, *= and /= on CUDA half floats

This commit is contained in:
Benoit Steiner 2016-02-19 15:57:26 +00:00
parent dc26459b99
commit f7cb755299

View File

@ -39,6 +39,22 @@ __device__ half operator / (const half& a, const half& b) {
__device__ half operator - (const half& a) {
return __hneg(a);
}
__device__ half operator += (half& a, const half& b) {
a = __hadd(a, b);
return a;
}
__device__ half operator *= (half& a, const half& b) {
a = __hmul(a, b);
return a;
}
__device__ half operator -= (half& a, const half& b) {
a = __hsub(a, b);
return a;
}
__device__ half operator /= (half& a, const half& b) {
assert(false && "tbd");
return a;
}
template<> struct is_arithmetic<half2> { enum { value = true }; };