TensorForwardDeclarations.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2014 Benoit Steiner <benoit.steiner.goog@gmail.com>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 
10 #ifndef EIGEN_CXX11_TENSOR_TENSOR_FORWARD_DECLARATIONS_H
11 #define EIGEN_CXX11_TENSOR_TENSOR_FORWARD_DECLARATIONS_H
12 
13 // IWYU pragma: private
14 #include "./InternalHeaderCheck.h"
15 
16 namespace Eigen {
17 
18 // MakePointer class is used as a container of the address space of the pointer
19 // on the host and on the device. From the host side it generates the T* pointer
20 // and when EIGEN_USE_SYCL is used it construct a buffer with a map_allocator to
21 // T* m_data on the host. It is always called on the device.
22 // Specialisation of MakePointer class for creating the sycl buffer with
23 // map_allocator.
24 template <typename T>
25 struct MakePointer {
26  typedef T* Type;
27  typedef const T* ConstType;
28 };
29 
30 template <typename T>
32  return const_cast<T*>(data);
33 }
34 
35 // The StorageMemory class is a container of the device specific pointer
36 // used for referring to a Pointer on TensorEvaluator class. While the TensorExpression
37 // is a device-agnostic type and need MakePointer class for type conversion,
38 // the TensorEvaluator class can be specialized for a device, hence it is possible
39 // to construct different types of temporary storage memory in TensorEvaluator
40 // for different devices by specializing the following StorageMemory class.
41 template <typename T, typename device>
42 struct StorageMemory : MakePointer<T> {};
43 
44 namespace internal {
45 template <typename A, typename B>
47  static const bool val = false;
48 };
49 template <typename A>
51  static const bool val = true;
52 };
53 template <typename A, typename B>
55  typedef A* type;
56 };
57 } // namespace internal
58 
59 template <typename PlainObjectType, int Options_ = Unaligned, template <class> class MakePointer_ = MakePointer>
60 class TensorMap;
61 template <typename Scalar_, int NumIndices_, int Options_ = 0, typename IndexType = DenseIndex>
62 class Tensor;
63 template <typename Scalar_, typename Dimensions, int Options_ = 0, typename IndexType = DenseIndex>
64 class TensorFixedSize;
65 template <typename PlainObjectType>
66 class TensorRef;
67 template <typename Derived, int AccessLevel>
68 class TensorBase;
69 
70 template <typename NullaryOp, typename PlainObjectType>
72 template <typename UnaryOp, typename XprType>
73 class TensorCwiseUnaryOp;
74 template <typename BinaryOp, typename LeftXprType, typename RightXprType>
76 template <typename TernaryOp, typename Arg1XprType, typename Arg2XprType, typename Arg3XprType>
78 template <typename IfXprType, typename ThenXprType, typename ElseXprType>
79 class TensorSelectOp;
80 template <typename Op, typename Dims, typename XprType, template <class> class MakePointer_ = MakePointer>
81 class TensorReductionOp;
82 template <typename XprType>
83 class TensorIndexPairOp;
84 template <typename ReduceOp, typename Dims, typename XprType>
86 template <typename Axis, typename LeftXprType, typename RightXprType>
88 template <typename Dimensions, typename LeftXprType, typename RightXprType, typename OutputKernelType>
90 template <typename TargetType, typename XprType>
91 class TensorConversionOp;
92 template <typename Dimensions, typename InputXprType, typename KernelXprType>
94 template <typename FFT, typename XprType, int FFTDataType, int FFTDirection>
95 class TensorFFTOp;
96 template <typename PatchDim, typename XprType>
97 class TensorPatchOp;
98 template <DenseIndex Rows, DenseIndex Cols, typename XprType>
99 class TensorImagePatchOp;
100 template <DenseIndex Planes, DenseIndex Rows, DenseIndex Cols, typename XprType>
101 class TensorVolumePatchOp;
102 template <typename Broadcast, typename XprType>
104 template <DenseIndex DimId, typename XprType>
105 class TensorChippingOp;
106 template <typename NewDimensions, typename XprType>
107 class TensorReshapingOp;
108 template <typename XprType>
109 class TensorLayoutSwapOp;
110 template <typename StartIndices, typename Sizes, typename XprType>
111 class TensorSlicingOp;
112 template <typename ReverseDimensions, typename XprType>
113 class TensorReverseOp;
114 template <typename Rolls, typename XprType>
115 class TensorRollOp;
116 template <typename PaddingDimensions, typename XprType>
117 class TensorPaddingOp;
118 template <typename Shuffle, typename XprType>
119 class TensorShufflingOp;
120 template <typename Strides, typename XprType>
121 class TensorStridingOp;
122 template <typename StartIndices, typename StopIndices, typename Strides, typename XprType>
124 template <typename Strides, typename XprType>
125 class TensorInflationOp;
126 template <typename Generator, typename XprType>
127 class TensorGeneratorOp;
128 template <typename LeftXprType, typename RightXprType>
129 class TensorAssignOp;
130 template <typename Op, typename XprType>
131 class TensorScanOp;
132 template <typename Dims, typename XprType>
133 class TensorTraceOp;
134 
135 template <typename CustomUnaryFunc, typename XprType>
136 class TensorCustomUnaryOp;
137 template <typename CustomBinaryFunc, typename LhsXprType, typename RhsXprType>
139 
140 template <typename XprType, template <class> class MakePointer_ = MakePointer>
141 class TensorEvalToOp;
142 template <typename XprType>
143 class TensorForcedEvalOp;
144 
145 template <typename ExpressionType, typename DeviceType>
146 class TensorDevice;
147 template <typename ExpressionType, typename DeviceType, typename DoneCallback>
148 class TensorAsyncDevice;
149 template <typename Derived, typename Device>
150 struct TensorEvaluator;
151 
152 struct NoOpOutputKernel;
153 
154 struct DefaultDevice;
155 struct ThreadPoolDevice;
156 struct GpuDevice;
157 struct SyclDevice;
158 
159 #ifdef EIGEN_USE_SYCL
160 namespace TensorSycl {
161 namespace internal {
162 template <typename Evaluator, typename Op>
163 class GenericNondeterministicReducer;
164 }
165 } // namespace TensorSycl
166 #endif
167 
168 enum FFTResultType { RealPart = 0, ImagPart = 1, BothParts = 2 };
169 
171 
172 namespace internal {
173 
174 template <typename Device, typename Expression>
177 };
178 
179 template <typename Expression>
180 struct IsVectorizable<GpuDevice, Expression> {
181  static const bool value =
183 };
184 
185 // Tiled evaluation strategy.
187  Off = 0, // tiled evaluation is not supported
188  On = 1, // still work in progress (see TensorBlock.h)
189 };
190 
191 template <typename Device, typename Expression>
192 struct IsTileable {
193  // Check that block evaluation is supported and it's a preferred option (at
194  // least one sub-expression has much faster block evaluation, e.g.
195  // broadcasting).
196  static constexpr bool BlockAccess =
198 
200 };
201 
204 class TensorExecutor;
205 
206 template <typename Expression, typename Device, typename DoneCallback,
207  bool Vectorizable = IsVectorizable<Device, Expression>::value,
209 class TensorAsyncExecutor;
210 
211 } // end namespace internal
212 
213 } // end namespace Eigen
214 
215 #endif // EIGEN_CXX11_TENSOR_TENSOR_FORWARD_DECLARATIONS_H
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:892
#define EIGEN_STRONG_INLINE
Definition: Macros.h:834
int data[]
Definition: Map_placement_new.cpp:1
The matrix class, also used for vectors and row-vectors.
Definition: Eigen/Eigen/src/Core/Matrix.h:186
Definition: TensorAssign.h:57
Pseudo expression providing an operator = that will evaluate its argument asynchronously on the speci...
Definition: TensorDevice.h:88
The tensor base class.
Definition: TensorBase.h:1026
Definition: TensorBroadcasting.h:66
Definition: TensorChipping.h:70
Tensor concatenation class.
Definition: TensorConcatenation.h:60
Definition: TensorContraction.h:307
Tensor conversion class. This class makes it possible to vectorize type casting operations when the n...
Definition: TensorConversion.h:166
Definition: TensorConvolution.h:236
Tensor custom class.
Definition: TensorCustomOp.h:195
Tensor custom class.
Definition: TensorCustomOp.h:51
Definition: TensorExpr.h:162
Definition: TensorExpr.h:49
Definition: TensorExpr.h:233
Definition: TensorExpr.h:97
Pseudo expression providing an operator = that will evaluate its argument on the specified computing ...
Definition: TensorDevice.h:31
Definition: TensorEvalTo.h:61
Definition: TensorFFT.h:109
The fixed sized version of the tensor class.
Definition: TensorFixedSize.h:30
Definition: TensorForcedEval.h:57
Tensor generator class.
Definition: TensorGenerator.h:52
Definition: TensorImagePatch.h:117
Definition: TensorArgMax.h:52
Definition: TensorInflation.h:52
Definition: TensorLayoutSwap.h:67
A tensor expression mapping an existing array of data.
Definition: TensorMap.h:33
Definition: TensorPadding.h:53
Definition: TensorArgMax.h:154
Definition: TensorPatch.h:52
Definition: TensorReduction.h:510
A reference to a tensor expression The expression will be evaluated lazily (as much as possible).
Definition: TensorRef.h:114
Definition: TensorMorphing.h:53
Definition: TensorReverse.h:52
Definition: TensorRoll.h:50
Definition: TensorScan.h:49
Definition: TensorExpr.h:302
Definition: TensorShuffling.h:52
Definition: TensorMorphing.h:289
Definition: TensorStriding.h:52
Definition: TensorMorphing.h:752
Definition: TensorTrace.h:53
Definition: TensorVolumePatch.h:56
The tensor class.
Definition: Tensor.h:68
Definition: TensorExecutor.h:110
Definition: TensorExecutor.h:78
TiledEvaluation
Definition: TensorForwardDeclarations.h:186
@ Off
Definition: TensorForwardDeclarations.h:187
@ On
Definition: TensorForwardDeclarations.h:188
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
FFTDirection
Definition: TensorForwardDeclarations.h:170
@ FFT_FORWARD
Definition: TensorForwardDeclarations.h:170
@ FFT_REVERSE
Definition: TensorForwardDeclarations.h:170
squared absolute value
Definition: GlobalFunctions.h:87
FFTResultType
Definition: TensorForwardDeclarations.h:168
@ ImagPart
Definition: TensorForwardDeclarations.h:168
@ BothParts
Definition: TensorForwardDeclarations.h:168
@ RealPart
Definition: TensorForwardDeclarations.h:168
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T * constCast(const T *data)
Definition: TensorForwardDeclarations.h:31
Definition: Eigen_Colamd.h:49
Definition: TensorDeviceDefault.h:19
Definition: TensorForwardDeclarations.h:25
const T * ConstType
Definition: TensorForwardDeclarations.h:27
T * Type
Definition: TensorForwardDeclarations.h:26
Definition: TensorContraction.h:275
Definition: TensorForwardDeclarations.h:42
A cost model used to limit the number of threads used for evaluating tensor expression.
Definition: TensorEvaluator.h:31
Definition: TensorForwardDeclarations.h:192
static const TiledEvaluation value
Definition: TensorForwardDeclarations.h:199
static constexpr bool BlockAccess
Definition: TensorForwardDeclarations.h:196
Definition: TensorForwardDeclarations.h:175
static const bool value
Definition: TensorForwardDeclarations.h:176
Definition: TensorForwardDeclarations.h:46
static const bool val
Definition: TensorForwardDeclarations.h:47
Definition: TensorForwardDeclarations.h:54
A * type
Definition: TensorForwardDeclarations.h:55