From 2386fc8528fa8f923b0300af6ddc4cd46a178afd Mon Sep 17 00:00:00 2001 From: Benoit Steiner Date: Fri, 27 Feb 2015 12:57:13 -0800 Subject: Added support for 32bit index on a per tensor/tensor expression. This enables us to use 32bit indices to evaluate expressions on GPU faster while keeping the ability to use 64 bit indices to manipulate large tensors on CPU in the same binary. --- unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h') diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h b/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h index a844a4d68..424bb24eb 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h @@ -43,13 +43,24 @@ class compute_tensor_flags enum { ret = packet_access_bit | aligned_bit}; }; +template +struct compute_index_type { + typedef DenseIndex type; +}; + +template<> +struct compute_index_type { + typedef int type; +}; + + template struct traits > { typedef Scalar_ Scalar; typedef Dense StorageKind; - typedef DenseIndex Index; + typedef typename compute_index_type::type Index; static const int NumDimensions = NumIndices_; static const int Layout = Options_ & RowMajor ? RowMajor : ColMajor; enum { @@ -64,7 +75,7 @@ struct traits > { typedef Scalar_ Scalar; typedef Dense StorageKind; - typedef DenseIndex Index; + typedef typename compute_index_type::type Index; static const int NumDimensions = array_size::value; static const int Layout = Options_ & RowMajor ? RowMajor : ColMajor; enum { -- cgit v1.2.3