From 13e93ca8b726a42bd8fcac24387cbb2507cc948e Mon Sep 17 00:00:00 2001 From: Rasmus Munk Larsen Date: Fri, 2 Sep 2016 13:41:36 -0700 Subject: Fix CUDA build broken by changes to min and max reduction. --- .../Eigen/CXX11/src/Tensor/TensorFunctors.h | 38 ++++++++++++++++------ 1 file changed, 28 insertions(+), 10 deletions(-) (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorFunctors.h') diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorFunctors.h b/unsupported/Eigen/CXX11/src/Tensor/TensorFunctors.h index f73178b30..3f623afa4 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorFunctors.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorFunctors.h @@ -188,6 +188,32 @@ struct reducer_traits, Device> { }; +template +struct MinMaxBottomValue { + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE static T bottom_value() { + return Eigen::NumTraits::lowest(); + } +}; +template +struct MinMaxBottomValue { + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE static T bottom_value() { + return -Eigen::NumTraits::infinity(); + } +}; +template +struct MinMaxBottomValue { + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE static T bottom_value() { + return Eigen::NumTraits::highest(); + } +}; +template +struct MinMaxBottomValue { + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE static T bottom_value() { + return Eigen::NumTraits::infinity(); + } +}; + + template struct MaxReducer { static const bool PacketAccess = packet_traits::HasMax; @@ -201,11 +227,7 @@ template struct MaxReducer (*accum) = pmax(*accum, p); } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T initialize() const { - if (Eigen::NumTraits::IsInteger) { - return Eigen::NumTraits::lowest(); - } else { - return -Eigen::NumTraits::infinity(); - } + return MinMaxBottomValue::IsInteger>::bottom_value(); } template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet initializePacket() const { @@ -246,11 +268,7 @@ template struct MinReducer (*accum) = pmin(*accum, p); } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T initialize() const { - if (Eigen::NumTraits::IsInteger) { - return Eigen::NumTraits::highest(); - } else { - return Eigen::NumTraits::infinity(); - } + return MinMaxBottomValue::IsInteger>::bottom_value(); } template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet initializePacket() const { -- cgit v1.2.3