From f5107010eebfa3b9422b95fa896cd0d9fd97adb4 Mon Sep 17 00:00:00 2001 From: Benoit Steiner Date: Wed, 30 Nov 2016 19:57:28 -0800 Subject: Udated the Sizes class to work on AMD gpus without requiring a separate implementation --- .../Eigen/CXX11/src/Tensor/TensorDimensions.h | 23 +++++++--------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h') diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h b/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h index ff604bf54..fc94c68d8 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h @@ -69,12 +69,7 @@ struct fixed_size_tensor_index_extraction_helper { const Index mult = (index == n-1) ? 1 : 0; return -#ifdef EIGEN_USE_SYCL - utility::tuple::get(dimensions) -#else - array_get(dimensions) -#endif - * mult + + array_get(dimensions) * mult + fixed_size_tensor_index_extraction_helper::run(index, dimensions); } }; @@ -96,12 +91,12 @@ struct fixed_size_tensor_index_extraction_helper // Fixed size #ifndef EIGEN_EMULATE_CXX11_META_H template -struct Sizes : internal::numeric_list { +struct Sizes { typedef internal::numeric_list Base; - #ifdef EIGEN_USE_SYCL - const decltype(utility::tuple::make_tuple(Indices...)) t= utility::tuple::make_tuple(Indices...); - #endif + const Base t = Base(); static const std::ptrdiff_t total_size = internal::arg_prod(Indices...); + static const size_t count = Base::count; + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE std::ptrdiff_t rank() const { return Base::count; @@ -129,20 +124,16 @@ struct Sizes : internal::numeric_list { } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE std::ptrdiff_t operator[] (const std::size_t index) const { -#ifdef EIGEN_USE_SYCL return internal::fixed_size_tensor_index_extraction_helper::run(index, t); -#else - return internal::fixed_size_tensor_index_extraction_helper::run(index, *this); -#endif } template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE size_t IndexOfColMajor(const array& indices) const { - return internal::fixed_size_tensor_index_linearization_helper::run(indices, *static_cast(this)); + return internal::fixed_size_tensor_index_linearization_helper::run(indices, t); } template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE size_t IndexOfRowMajor(const array& indices) const { - return internal::fixed_size_tensor_index_linearization_helper::run(indices, *static_cast(this)); + return internal::fixed_size_tensor_index_linearization_helper::run(indices, t); } }; -- cgit v1.2.3