22 #ifndef UNSUPPORTED_EIGEN_CXX11_SRC_TENSOR_TENSORSYCL_EXPR_CONSTRUCTOR_HPP 23 #define UNSUPPORTED_EIGEN_CXX11_SRC_TENSOR_TENSORSYCL_EXPR_CONSTRUCTOR_HPP 26 namespace TensorSycl {
30 template <
typename PtrType,
size_t N,
typename...
Params>
42 template <
typename OrigExpr,
typename IndexExpr,
typename...
Params>
47 #define TENSORMAP(CVQual)\ 48 template <typename Scalar_, int Options_, int Options2_, int Options3_, int NumIndices_, typename IndexType_,\ 49 template <class> class MakePointer_, size_t N, typename... Params>\ 50 struct ExprConstructor< CVQual TensorMap<Tensor<Scalar_, NumIndices_, Options_, IndexType_>, Options2_, MakeGlobalPointer>,\ 51 CVQual PlaceHolder<CVQual TensorMap<Tensor<Scalar_, NumIndices_, Options_, IndexType_>, Options3_, MakePointer_>, N>, Params...>{\ 52 typedef CVQual TensorMap<Tensor<Scalar_, NumIndices_, Options_, IndexType_>, Options2_, MakeGlobalPointer> Type;\ 54 template <typename FuncDetector>\ 55 ExprConstructor(FuncDetector &fd, const utility::tuple::Tuple<Params...> &t)\ 56 : expr(Type((&(*(utility::tuple::get<N>(t).get_pointer()))), fd.dimensions())) {}\ 63 #define UNARYCATEGORY(CVQual)\ 64 template <template<class, class> class UnaryCategory, typename OP, typename OrigRHSExpr, typename RHSExpr, typename... Params>\ 65 struct ExprConstructor<CVQual UnaryCategory<OP, OrigRHSExpr>, CVQual UnaryCategory<OP, RHSExpr>, Params...> {\ 66 typedef ExprConstructor<OrigRHSExpr, RHSExpr, Params...> my_type;\ 68 typedef CVQual UnaryCategory<OP, typename my_type::Type> Type;\ 70 template <typename FuncDetector>\ 71 ExprConstructor(FuncDetector &funcD, const utility::tuple::Tuple<Params...> &t)\ 72 : rhsExpr(funcD.rhsExpr, t), expr(rhsExpr.expr, funcD.func) {}\ 81 #define BINARYCATEGORY(CVQual)\ 82 template <template<class, class, class> class BinaryCategory, typename OP, typename OrigLHSExpr, typename OrigRHSExpr, typename LHSExpr,\ 83 typename RHSExpr, typename... Params>\ 84 struct ExprConstructor<CVQual BinaryCategory<OP, OrigLHSExpr, OrigRHSExpr>, CVQual BinaryCategory<OP, LHSExpr, RHSExpr>, Params...> {\ 85 typedef ExprConstructor<OrigLHSExpr, LHSExpr, Params...> my_left_type;\ 86 typedef ExprConstructor<OrigRHSExpr, RHSExpr, Params...> my_right_type;\ 87 typedef CVQual BinaryCategory<OP, typename my_left_type::Type, typename my_right_type::Type> Type;\ 88 my_left_type lhsExpr;\ 89 my_right_type rhsExpr;\ 91 template <typename FuncDetector>\ 92 ExprConstructor(FuncDetector &funcD, const utility::tuple::Tuple<Params...> &t)\ 93 : lhsExpr(funcD.lhsExpr, t),rhsExpr(funcD.rhsExpr, t), expr(lhsExpr.expr, rhsExpr.expr, funcD.func) {}\ 102 #define TERNARYCATEGORY(CVQual)\ 103 template <template <class, class, class, class> class TernaryCategory, typename OP, typename OrigArg1Expr, typename OrigArg2Expr,typename OrigArg3Expr,\ 104 typename Arg1Expr, typename Arg2Expr, typename Arg3Expr, typename... Params>\ 105 struct ExprConstructor<CVQual TernaryCategory<OP, OrigArg1Expr, OrigArg2Expr, OrigArg3Expr>, CVQual TernaryCategory<OP, Arg1Expr, Arg2Expr, Arg3Expr>, Params...> {\ 106 typedef ExprConstructor<OrigArg1Expr, Arg1Expr, Params...> my_arg1_type;\ 107 typedef ExprConstructor<OrigArg2Expr, Arg2Expr, Params...> my_arg2_type;\ 108 typedef ExprConstructor<OrigArg3Expr, Arg3Expr, Params...> my_arg3_type;\ 109 typedef CVQual TernaryCategory<OP, typename my_arg1_type::Type, typename my_arg2_type::Type, typename my_arg3_type::Type> Type;\ 110 my_arg1_type arg1Expr;\ 111 my_arg2_type arg2Expr;\ 112 my_arg3_type arg3Expr;\ 114 template <typename FuncDetector>\ 115 ExprConstructor(FuncDetector &funcD,const utility::tuple::Tuple<Params...> &t)\ 116 : arg1Expr(funcD.arg1Expr, t), arg2Expr(funcD.arg2Expr, t), arg3Expr(funcD.arg3Expr, t), expr(arg1Expr.expr, arg2Expr.expr, arg3Expr.expr, funcD.func) {}\ 121 #undef TERNARYCATEGORY 125 #define SELECTOP(CVQual)\ 126 template <typename OrigIfExpr, typename OrigThenExpr, typename OrigElseExpr, typename IfExpr, typename ThenExpr, typename ElseExpr, typename... Params>\ 127 struct ExprConstructor< CVQual TensorSelectOp<OrigIfExpr, OrigThenExpr, OrigElseExpr>, CVQual TensorSelectOp<IfExpr, ThenExpr, ElseExpr>, Params...> {\ 128 typedef ExprConstructor<OrigIfExpr, IfExpr, Params...> my_if_type;\ 129 typedef ExprConstructor<OrigThenExpr, ThenExpr, Params...> my_then_type;\ 130 typedef ExprConstructor<OrigElseExpr, ElseExpr, Params...> my_else_type;\ 131 typedef CVQual TensorSelectOp<typename my_if_type::Type, typename my_then_type::Type, typename my_else_type::Type> Type;\ 133 my_then_type thenExpr;\ 134 my_else_type elseExpr;\ 136 template <typename FuncDetector>\ 137 ExprConstructor(FuncDetector &funcD, const utility::tuple::Tuple<Params...> &t)\ 138 : ifExpr(funcD.ifExpr, t), thenExpr(funcD.thenExpr, t), elseExpr(funcD.elseExpr, t), expr(ifExpr.expr, thenExpr.expr, elseExpr.expr) {}\ 147 #define ASSIGN(CVQual)\ 148 template <typename OrigLHSExpr, typename OrigRHSExpr, typename LHSExpr, typename RHSExpr, typename... Params>\ 149 struct ExprConstructor<CVQual TensorAssignOp<OrigLHSExpr, OrigRHSExpr>, CVQual TensorAssignOp<LHSExpr, RHSExpr>, Params...> {\ 150 typedef ExprConstructor<OrigLHSExpr, LHSExpr, Params...> my_left_type;\ 151 typedef ExprConstructor<OrigRHSExpr, RHSExpr, Params...> my_right_type;\ 152 typedef CVQual TensorAssignOp<typename my_left_type::Type, typename my_right_type::Type> Type;\ 153 my_left_type lhsExpr;\ 154 my_right_type rhsExpr;\ 156 template <typename FuncDetector>\ 157 ExprConstructor(FuncDetector &funcD, const utility::tuple::Tuple<Params...> &t)\ 158 : lhsExpr(funcD.lhsExpr, t), rhsExpr(funcD.rhsExpr, t), expr(lhsExpr.expr, rhsExpr.expr) {}\ 164 #define EVALTO(CVQual)\ 167 template <typename OrigExpr, typename Expr, typename... Params>\ 168 struct ExprConstructor<CVQual TensorEvalToOp<OrigExpr, MakeGlobalPointer>, CVQual TensorEvalToOp<Expr>, Params...> {\ 169 typedef ExprConstructor<OrigExpr, Expr, Params...> my_expr_type;\ 170 typedef typename TensorEvalToOp<OrigExpr, MakeGlobalPointer>::PointerType my_buffer_type;\ 171 typedef CVQual TensorEvalToOp<typename my_expr_type::Type, MakeGlobalPointer> Type;\ 172 my_expr_type nestedExpression;\ 173 EvalToLHSConstructor<my_buffer_type, 0, Params...> buffer;\ 175 template <typename FuncDetector>\ 176 ExprConstructor(FuncDetector &funcD, const utility::tuple::Tuple<Params...> &t)\ 177 : nestedExpression(funcD.rhsExpr, t), buffer(t), expr(buffer.expr, nestedExpression.expr) {}\ 186 #define FORCEDEVAL(CVQual)\ 187 template <typename OrigExpr, typename DevExpr, size_t N, typename... Params>\ 188 struct ExprConstructor<CVQual TensorForcedEvalOp<OrigExpr, MakeGlobalPointer>,\ 189 CVQual PlaceHolder<CVQual TensorForcedEvalOp<DevExpr>, N>, Params...> {\ 190 typedef CVQual TensorMap<Tensor<typename TensorForcedEvalOp<DevExpr, MakeGlobalPointer>::Scalar,\ 191 TensorForcedEvalOp<DevExpr, MakeGlobalPointer>::NumDimensions, 0, typename TensorForcedEvalOp<DevExpr>::Index>, 0, MakeGlobalPointer> Type;\ 193 template <typename FuncDetector>\ 194 ExprConstructor(FuncDetector &fd, const utility::tuple::Tuple<Params...> &t)\ 195 : expr(Type((&(*(utility::tuple::get<N>(t).get_pointer()))), fd.dimensions())) {}\ 203 static const size_t Res =
X;
206 static const size_t Res =
Y;
210 #define SYCLREDUCTIONEXPR(CVQual)\ 211 template <typename OP, typename Dim, typename OrigExpr, typename DevExpr, size_t N, typename... Params>\ 212 struct ExprConstructor<CVQual TensorReductionOp<OP, Dim, OrigExpr, MakeGlobalPointer>,\ 213 CVQual PlaceHolder<CVQual TensorReductionOp<OP, Dim, DevExpr>, N>, Params...> {\ 214 static const size_t NumIndices= ValueCondition< TensorReductionOp<OP, Dim, DevExpr, MakeGlobalPointer>::NumDimensions==0, 1, TensorReductionOp<OP, Dim, DevExpr, MakeGlobalPointer>::NumDimensions >::Res;\ 215 typedef CVQual TensorMap<Tensor<typename TensorReductionOp<OP, Dim, DevExpr, MakeGlobalPointer>::Scalar,\ 216 NumIndices, 0, typename TensorReductionOp<OP, Dim, DevExpr>::Index>, 0, MakeGlobalPointer> Type;\ 218 template <typename FuncDetector>\ 219 ExprConstructor(FuncDetector &fd, const utility::tuple::Tuple<Params...> &t)\ 220 : expr(Type((&(*(utility::tuple::get<N>(t).get_pointer()))), fd.dimensions())) {}\ 225 #undef SYCLREDUCTIONEXPR 228 template <
typename OrigExpr,
typename IndexExpr,
typename FuncD,
typename...
Params>
239 #endif // UNSUPPORTED_EIGEN_CXX11_SRC_TENSOR_TENSORSYCL_EXPR_CONSTRUCTOR_HPP
auto createDeviceExpression(FuncD &funcD, const utility::tuple::Tuple< Params... > &t) -> decltype(ExprConstructor< OrigExpr, IndexExpr, Params... >(funcD, t))
template deduction for ExprConstructor struct
EvalToLHSConstructor(const utility::tuple::Tuple< Params... > &t)
Namespace containing all symbols from the Eigen library.
#define TERNARYCATEGORY(CVQual)
#define FORCEDEVAL(CVQual)
is a fixed-size collection of heterogeneous values
#define BINARYCATEGORY(CVQual)
#define SYCLREDUCTIONEXPR(CVQual)
specialisation of the ExprConstructor struct when the node type is TensorReductionOp ...
static boost::shared_ptr< PreintegratedCombinedMeasurements::Params > Params()
#define UNARYCATEGORY(CVQual)
#define TENSORMAP(CVQual)
Container::iterator get(Container &c, Position position)