From bb3ff8e9d91bbab7165add8c6d2a991e7b9be02f Mon Sep 17 00:00:00 2001 From: Benoit Steiner Date: Wed, 18 May 2016 14:52:49 -0700 Subject: Advertize the packet api of the tensor reducers iff the corresponding packet primitives are available. --- unsupported/Eigen/CXX11/src/Tensor/TensorFunctors.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 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 c674fcfe1..3dd32e9d1 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorFunctors.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorFunctors.h @@ -87,7 +87,7 @@ struct functor_traits > { // Standard reduction functors template struct SumReducer { - static const bool PacketAccess = true; + static const bool PacketAccess = packet_traits::HasAdd; static const bool IsStateful = false; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reduce(const T t, T* accum) const { @@ -121,7 +121,7 @@ template struct SumReducer template struct MeanReducer { - static const bool PacketAccess = !NumTraits::IsInteger; + static const bool PacketAccess = packet_traits::HasAdd && !NumTraits::IsInteger; static const bool IsStateful = true; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE @@ -164,7 +164,7 @@ template struct MeanReducer template struct MaxReducer { - static const bool PacketAccess = true; + static const bool PacketAccess = packet_traits::HasMax; static const bool IsStateful = false; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reduce(const T t, T* accum) const { @@ -197,7 +197,7 @@ template struct MaxReducer template struct MinReducer { - static const bool PacketAccess = true; + static const bool PacketAccess = packet_traits::HasMin; static const bool IsStateful = false; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reduce(const T t, T* accum) const { @@ -231,7 +231,7 @@ template struct MinReducer template struct ProdReducer { - static const bool PacketAccess = true; + static const bool PacketAccess = packet_traits::HasMul; static const bool IsStateful = false; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reduce(const T t, T* accum) const { -- cgit v1.2.3