// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Mehdi Goli Codeplay Software Ltd. // Ralph Potter Codeplay Software Ltd. // Luke Iwanski Codeplay Software Ltd. // Contact: // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. /***************************************************************** * TensorSyclextractFunctors.h * * \brief: * Used to extract all the functors allocated to each node of the expression *tree. * *****************************************************************/ #ifndef UNSUPPORTED_EIGEN_CXX11_SRC_TENSOR_TENSORSYCL_EXTRACT_FUNCTORS_HPP #define UNSUPPORTED_EIGEN_CXX11_SRC_TENSOR_TENSORSYCL_EXTRACT_FUNCTORS_HPP namespace Eigen { namespace TensorSycl { namespace internal { /// \struct FunctorExtractor: This struct is used to extract the functors /// constructed on /// the host-side, to pack them and reuse them in reconstruction of the /// expression on the device. /// We have to do that as in Eigen the functors are not stateless so we cannot /// re-instantiate them on the device. /// We have to pass instantiated functors to the device. // This struct is used for leafNode (TensorMap) and nodes behaving like leafNode (TensorForcedEval). template struct FunctorExtractor{ typedef typename Evaluator::Dimensions Dimensions; const Dimensions m_dimensions; EIGEN_STRONG_INLINE const Dimensions& dimensions() const { return m_dimensions; } FunctorExtractor(const Evaluator& expr) : m_dimensions(expr.dimensions()) {} }; /// specialisation of the \ref FunctorExtractor struct when the node type does not require anything ///TensorConversionOp #define SYCLEXTRFUNCCONVERSION(ExprNode, CVQual)\ template \ struct FunctorExtractor, Dev> > {\ FunctorExtractor > subExpr;\ FunctorExtractor(const TensorEvaluator, Dev>& expr)\ : subExpr(expr.impl()) {}\ }; SYCLEXTRFUNCCONVERSION(TensorConversionOp, const) SYCLEXTRFUNCCONVERSION(TensorConversionOp, ) #undef SYCLEXTRFUNCCONVERSION #define SYCLEXTRTENSORMAPFIXEDSIZE(CVQual)\ template class MakePointer_, typename Dev>\ struct FunctorExtractor< TensorEvaluator , Options_, MakePointer_> , Dev> >{\ FunctorExtractor(const TensorEvaluator , Options_, MakePointer_> , Dev>& ){}\ }; SYCLEXTRTENSORMAPFIXEDSIZE(const) SYCLEXTRTENSORMAPFIXEDSIZE() #undef SYCLEXTRTENSORMAPFIXEDSIZE /// specialisation of the \ref FunctorExtractor struct when the node type is /// TensorCwiseNullaryOp, TensorCwiseUnaryOp, and TensorBroadcastingOp #define SYCLEXTRFUNCUNARY(CVQual)\ template