From e46e7223817cfd982edec6d8e25c77e8e2493d78 Mon Sep 17 00:00:00 2001 From: Mehdi Goli Date: Mon, 16 Jan 2017 13:58:49 +0000 Subject: Adding Tensor ReverseOp; TensorStriding; TensorConversionOp; Modifying Tensor Contractsycl to be located in any place in the expression tree. --- unsupported/Eigen/CXX11/src/Tensor/TensorStriding.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorStriding.h') diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorStriding.h b/unsupported/Eigen/CXX11/src/Tensor/TensorStriding.h index 6c35bfdb6..93615e5c2 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorStriding.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorStriding.h @@ -117,11 +117,15 @@ struct TensorEvaluator, Device> }; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorEvaluator(const XprType& op, const Device& device) - : m_impl(op.expression(), device) + : m_impl(op.expression(), device), m_strides(op.strides()) { m_dimensions = m_impl.dimensions(); for (int i = 0; i < NumDims; ++i) { +#ifndef __SYCL_DEVICE_ONLY__ m_dimensions[i] = ceilf(static_cast(m_dimensions[i]) / op.strides()[i]); +#else + m_dimensions[i] = cl::sycl::ceil(static_cast(m_dimensions[i]) / op.strides()[i]); +#endif } const typename TensorEvaluator::Dimensions& input_dims = m_impl.dimensions(); @@ -224,6 +228,13 @@ struct TensorEvaluator, Device> EIGEN_DEVICE_FUNC Scalar* data() const { return NULL; } + /// required by sycl in order to extract the accessor + const TensorEvaluator& impl() const { return m_impl; } + /// required by sycl in order to extract the accessor + Strides functor() const { return m_strides; } + + + protected: EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index srcCoeff(Index index) const { @@ -250,6 +261,7 @@ struct TensorEvaluator, Device> array m_outputStrides; array m_inputStrides; TensorEvaluator m_impl; + const Strides m_strides; }; @@ -286,6 +298,12 @@ struct TensorEvaluator, Device> return this->m_impl.coeffRef(this->srcCoeff(index)); } + /// required by sycl in order to extract the accessor + const TensorEvaluator& impl() const { return this->m_impl; } + /// required by sycl in order to extract the accessor + Strides functor() const { return this->m_strides; } + + template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacket(Index index, const PacketReturnType& x) { -- cgit v1.2.3