From f7cb755299b8cdee3b8eaffd2941af9ee6d08b04 Mon Sep 17 00:00:00 2001 From: Benoit Steiner Date: Fri, 19 Feb 2016 15:57:26 +0000 Subject: [PATCH] Added support for operators +=, -=, *= and /= on CUDA half floats --- Eigen/src/Core/arch/CUDA/PacketMathHalf.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Eigen/src/Core/arch/CUDA/PacketMathHalf.h b/Eigen/src/Core/arch/CUDA/PacketMathHalf.h index 7f99376fb..c99c1acf7 100644 --- a/Eigen/src/Core/arch/CUDA/PacketMathHalf.h +++ b/Eigen/src/Core/arch/CUDA/PacketMathHalf.h @@ -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 { enum { value = true }; };