aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/arch
diff options
context:
space:
mode:
authorGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2016-02-21 20:24:11 +0000
committerGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2016-02-21 20:24:11 +0000
commit95fceb6452cb3337bb46a637a8244dd9709b2621 (patch)
treeee21ebd2b23b5d46c9f6111a2167b66dfd8699a0 /Eigen/src/Core/arch
parent203490017f53505176be8d88206a04a2f4ce7be8 (diff)
Added the ability to compute the absolute value of a half float
Diffstat (limited to 'Eigen/src/Core/arch')
-rw-r--r--Eigen/src/Core/arch/CUDA/PacketMathHalf.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/Eigen/src/Core/arch/CUDA/PacketMathHalf.h b/Eigen/src/Core/arch/CUDA/PacketMathHalf.h
index 7af0bdc60..4a10e4fa5 100644
--- a/Eigen/src/Core/arch/CUDA/PacketMathHalf.h
+++ b/Eigen/src/Core/arch/CUDA/PacketMathHalf.h
@@ -52,9 +52,13 @@ __device__ half operator /= (half& a, const half& b) {
a = a / b;
return a;
}
-__device__ half __shfl_xor(half a, int) {
- assert(false && "tbd");
- return a;
+
+namespace std {
+__device__ half abs(const half& a) {
+ half result;
+ result.x = a.x & 0x7FFF;
+ return result;
+}
}
namespace Eigen {
@@ -214,8 +218,9 @@ template<> EIGEN_DEVICE_FUNC inline half predux_mul<half2>(const half2& a) {
}
template<> EIGEN_DEVICE_FUNC inline half2 pabs<half2>(const half2& a) {
- assert(false && "tbd");
- return half2();
+ half2 result;
+ result.x = a.x & 0x7FFF7FFF;
+ return result;
}