Loading...
Searching...
No Matches
TensorSyclConvertToDeviceExpression.h
1// This file is part of Eigen, a lightweight C++ template library
2// for linear algebra.
3//
4// Mehdi Goli Codeplay Software Ltd.
5// Ralph Potter Codeplay Software Ltd.
6// Luke Iwanski Codeplay Software Ltd.
7// Contact: <eigen@codeplay.com>
8//
9// This Source Code Form is subject to the terms of the Mozilla
10// Public License v. 2.0. If a copy of the MPL was not distributed
11// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
12
13/*****************************************************************
14 * TensorSyclConvertToDeviceExpression.h
15 *
16 * \brief:
17 * Conversion from host pointer to device pointer
18 * inside leaf nodes of the expression.
19 *
20*****************************************************************/
21
22#ifndef UNSUPPORTED_EIGEN_CXX11_SRC_TENSOR_TENSORSYCL_CONVERT_TO_DEVICE_EXPRESSION_HPP
23#define UNSUPPORTED_EIGEN_CXX11_SRC_TENSOR_TENSORSYCL_CONVERT_TO_DEVICE_EXPRESSION_HPP
24
25namespace Eigen {
26namespace TensorSycl {
27namespace internal {
28
34template <typename Expr>
35struct ConvertToDeviceExpression;
36
37template<template<class...> class NonOpCategory, bool IsConst, typename... Args>
38struct NonOpConversion{
39 typedef typename GetType<IsConst, NonOpCategory<typename ConvertToDeviceExpression<Args>::Type...> >::Type Type;
40};
41
42
43template<template<class, template <class> class > class NonOpCategory, bool IsConst, typename Args>
44struct DeviceConvertor{
45 typedef typename GetType<IsConst, NonOpCategory<typename ConvertToDeviceExpression<Args>::Type, MakeGlobalPointer> >::Type Type;
46};
47
50#define TENSORMAPCONVERT(CVQual)\
51template <typename Scalar_, int Options_, int Options2_, int NumIndices_, typename IndexType_, template <class> class MakePointer_>\
52struct ConvertToDeviceExpression<CVQual TensorMap<Tensor<Scalar_, NumIndices_, Options_, IndexType_>, Options2_, MakePointer_> > {\
53 typedef CVQual TensorMap<Tensor<Scalar_, NumIndices_, Options_, IndexType_>, Options2_, MakeGlobalPointer> Type;\
54};
55
56TENSORMAPCONVERT(const)
57TENSORMAPCONVERT()
58#undef TENSORMAPCONVERT
59
62#define CATEGORYCONVERT(CVQual)\
63template <template<class, class...> class Category, typename OP, typename... subExprs>\
64struct ConvertToDeviceExpression<CVQual Category<OP, subExprs...> > {\
65 typedef CVQual Category<OP, typename ConvertToDeviceExpression<subExprs>::Type... > Type;\
66};
67CATEGORYCONVERT(const)
68CATEGORYCONVERT()
69#undef CATEGORYCONVERT
70
71
74#define SELECTOPCONVERT(CVQual, Res)\
75template <typename IfExpr, typename ThenExpr, typename ElseExpr>\
76struct ConvertToDeviceExpression<CVQual TensorSelectOp<IfExpr, ThenExpr, ElseExpr> >\
77: NonOpConversion<TensorSelectOp, Res, IfExpr, ThenExpr, ElseExpr> {};
78SELECTOPCONVERT(const, true)
79SELECTOPCONVERT(, false)
80#undef SELECTOPCONVERT
81
84#define ASSIGNCONVERT(CVQual, Res)\
85template <typename LHSExpr, typename RHSExpr>\
86struct ConvertToDeviceExpression<CVQual TensorAssignOp<LHSExpr, RHSExpr> >\
87: NonOpConversion<TensorAssignOp, Res, LHSExpr, RHSExpr>{};
88
89ASSIGNCONVERT(const, true)
90ASSIGNCONVERT(, false)
91#undef ASSIGNCONVERT
92
95#define KERNELBROKERCONVERT(CVQual, Res, ExprNode)\
96template <typename Expr>\
97struct ConvertToDeviceExpression<CVQual ExprNode<Expr> > \
98: DeviceConvertor<ExprNode, Res, Expr>{};
99
100KERNELBROKERCONVERT(const, true, TensorForcedEvalOp)
101KERNELBROKERCONVERT(, false, TensorForcedEvalOp)
102KERNELBROKERCONVERT(const, true, TensorEvalToOp)
103KERNELBROKERCONVERT(, false, TensorEvalToOp)
104#undef KERNELBROKERCONVERT
105
107#define KERNELBROKERCONVERTREDUCTION(CVQual)\
108template <typename OP, typename Dim, typename subExpr, template <class> class MakePointer_>\
109struct ConvertToDeviceExpression<CVQual TensorReductionOp<OP, Dim, subExpr, MakePointer_> > {\
110 typedef CVQual TensorReductionOp<OP, Dim, typename ConvertToDeviceExpression<subExpr>::Type, MakeGlobalPointer> Type;\
111};
112
113KERNELBROKERCONVERTREDUCTION(const)
114KERNELBROKERCONVERTREDUCTION()
115#undef KERNELBROKERCONVERTREDUCTION
116
117} // namespace internal
118} // namespace TensorSycl
119} // namespace Eigen
120
121#endif // UNSUPPORTED_EIGEN_CXX1
Namespace containing all symbols from the Eigen library.
Definition: AdolcForward:45