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 namespace Eigen {
14 
15 // MakePointer class is used as a container of the address space of the pointer
16 // on the host and on the device. From the host side it generates the T* pointer
17 // and when EIGEN_USE_SYCL is used it construct a buffer with a map_allocator to
18 // T* m_data on the host. It is always called on the device.
19 // Specialisation of MakePointer class for creating the sycl buffer with
20 // map_allocator.
21 template<typename T> struct MakePointer {
22  typedef T* Type;
23  typedef const T* ConstType;
24 };
25 
26 template <typename T>
28  return const_cast<T*>(data);
29 }
30 
31 // The StorageMemory class is a container of the device specific pointer
32 // used for refering to a Pointer on TensorEvaluator class. While the TensorExpression
33 // is a device-agnostic type and need MakePointer class for type conversion,
34 // the TensorEvaluator class can be specialized for a device, hence it is possible
35 // to construct different types of temproray storage memory in TensorEvaluator
36 // for different devices by specializing the following StorageMemory class.
37 template<typename T, typename device> struct StorageMemory: MakePointer <T> {};
38 
39 namespace internal{
40 template<typename A, typename B> struct Pointer_type_promotion {
41  static const bool val=false;
42 };
43 template<typename A> struct Pointer_type_promotion<A, A> {
44  static const bool val = true;
45 };
46 template<typename A, typename B> struct TypeConversion {
47  typedef A* type;
48 };
49 }
50 
51 
52 template<typename PlainObjectType, int Options_ = Unaligned, template <class> class MakePointer_ = MakePointer> class TensorMap;
53 template<typename Scalar_, int NumIndices_, int Options_ = 0, typename IndexType = DenseIndex> class Tensor;
54 template<typename Scalar_, typename Dimensions, int Options_ = 0, typename IndexType = DenseIndex> class TensorFixedSize;
55 template<typename PlainObjectType> class TensorRef;
56 template<typename Derived, int AccessLevel> class TensorBase;
57 
58 template<typename NullaryOp, typename PlainObjectType> class TensorCwiseNullaryOp;
59 template<typename UnaryOp, typename XprType> class TensorCwiseUnaryOp;
60 template<typename BinaryOp, typename LeftXprType, typename RightXprType> class TensorCwiseBinaryOp;
61 template<typename TernaryOp, typename Arg1XprType, typename Arg2XprType, typename Arg3XprType> class TensorCwiseTernaryOp;
62 template<typename IfXprType, typename ThenXprType, typename ElseXprType> class TensorSelectOp;
63 template<typename Op, typename Dims, typename XprType, template <class> class MakePointer_ = MakePointer > class TensorReductionOp;
64 template<typename XprType> class TensorIndexTupleOp;
65 template<typename ReduceOp, typename Dims, typename XprType> class TensorTupleReducerOp;
66 template<typename Axis, typename LeftXprType, typename RightXprType> class TensorConcatenationOp;
67 template<typename Dimensions, typename LeftXprType, typename RightXprType, typename OutputKernelType> class TensorContractionOp;
68 template<typename TargetType, typename XprType> class TensorConversionOp;
69 template<typename Dimensions, typename InputXprType, typename KernelXprType> class TensorConvolutionOp;
70 template<typename FFT, typename XprType, int FFTDataType, int FFTDirection> class TensorFFTOp;
71 template<typename PatchDim, typename XprType> class TensorPatchOp;
72 template<DenseIndex Rows, DenseIndex Cols, typename XprType> class TensorImagePatchOp;
73 template<DenseIndex Planes, DenseIndex Rows, DenseIndex Cols, typename XprType> class TensorVolumePatchOp;
74 template<typename Broadcast, typename XprType> class TensorBroadcastingOp;
75 template<DenseIndex DimId, typename XprType> class TensorChippingOp;
76 template<typename NewDimensions, typename XprType> class TensorReshapingOp;
77 template<typename XprType> class TensorLayoutSwapOp;
78 template<typename StartIndices, typename Sizes, typename XprType> class TensorSlicingOp;
79 template<typename ReverseDimensions, typename XprType> class TensorReverseOp;
80 template<typename PaddingDimensions, typename XprType> class TensorPaddingOp;
81 template<typename Shuffle, typename XprType> class TensorShufflingOp;
82 template<typename Strides, typename XprType> class TensorStridingOp;
83 template<typename StartIndices, typename StopIndices, typename Strides, typename XprType> class TensorStridingSlicingOp;
84 template<typename Strides, typename XprType> class TensorInflationOp;
85 template<typename Generator, typename XprType> class TensorGeneratorOp;
86 template<typename LeftXprType, typename RightXprType> class TensorAssignOp;
87 template<typename Op, typename XprType> class TensorScanOp;
88 template<typename Dims, typename XprType> class TensorTraceOp;
89 
90 template<typename CustomUnaryFunc, typename XprType> class TensorCustomUnaryOp;
91 template<typename CustomBinaryFunc, typename LhsXprType, typename RhsXprType> class TensorCustomBinaryOp;
92 
93 template<typename XprType, template <class> class MakePointer_ = MakePointer> class TensorEvalToOp;
94 template<typename XprType> class TensorForcedEvalOp;
95 
96 template<typename ExpressionType, typename DeviceType> class TensorDevice;
97 template<typename ExpressionType, typename DeviceType, typename DoneCallback> class TensorAsyncDevice;
98 template<typename Derived, typename Device> struct TensorEvaluator;
99 
100 struct NoOpOutputKernel;
101 
102 struct DefaultDevice;
103 struct ThreadPoolDevice;
104 struct GpuDevice;
105 struct SyclDevice;
106 
107 #ifdef EIGEN_USE_SYCL
108 
109 template <typename T> struct MakeSYCLPointer {
110  typedef Eigen::TensorSycl::internal::RangeAccess<cl::sycl::access::mode::read_write, T> Type;
111 };
112 
113 template <typename T>
114 EIGEN_STRONG_INLINE const Eigen::TensorSycl::internal::RangeAccess<cl::sycl::access::mode::read_write, T>&
115 constCast(const Eigen::TensorSycl::internal::RangeAccess<cl::sycl::access::mode::read_write, T>& data) {
116  return data;
117 }
118 
119 template <typename T>
120 struct StorageMemory<T, SyclDevice> : MakeSYCLPointer<T> {};
121 template <typename T>
122 struct StorageMemory<T, const SyclDevice> : StorageMemory<T, SyclDevice> {};
123 
124 namespace TensorSycl {
125 namespace internal{
126 template <typename Evaluator, typename Op> class GenericNondeterministicReducer;
127 }
128 }
129 #endif
130 
131 
133  RealPart = 0,
134  ImagPart = 1,
136 };
137 
141 };
142 
143 
144 namespace internal {
145 
146 template <typename Device, typename Expression>
149 };
150 
151 template <typename Expression>
152 struct IsVectorizable<GpuDevice, Expression> {
155 };
156 
157 // Tiled evaluation strategy.
159  Off = 0, // tiled evaluation is not supported
160  On = 1, // still work in progress (see TensorBlock.h)
161 };
162 
163 template <typename Device, typename Expression>
164 struct IsTileable {
165  // Check that block evaluation is supported and it's a preferred option (at
166  // least one sub-expression has much faster block evaluation, e.g.
167  // broadcasting).
168  static const bool BlockAccess =
171 
172  static const TiledEvaluation value =
174 };
175 
176 template <typename Expression, typename Device,
177  bool Vectorizable = IsVectorizable<Device, Expression>::value,
179 class TensorExecutor;
180 
181 template <typename Expression, typename Device, typename DoneCallback,
182  bool Vectorizable = IsVectorizable<Device, Expression>::value,
184 class TensorAsyncExecutor;
185 
186 
187 } // end namespace internal
188 
189 } // end namespace Eigen
190 
191 #endif // EIGEN_CXX11_TENSOR_TENSOR_FORWARD_DECLARATIONS_H
Eigen::Tensor
The tensor class.
Definition: Tensor.h:63
Eigen::internal::Pointer_type_promotion
Definition: TensorForwardDeclarations.h:40
EIGEN_DEVICE_FUNC
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:976
Eigen
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
Eigen::internal::TiledEvaluation
TiledEvaluation
Definition: TensorForwardDeclarations.h:158
Eigen::TensorRef
A reference to a tensor expression The expression will be evaluated lazily (as much as possible).
Definition: TensorForwardDeclarations.h:55
Eigen::internal::Pointer_type_promotion::val
static const bool val
Definition: TensorForwardDeclarations.h:41
Eigen::TensorDevice
Pseudo expression providing an operator = that will evaluate its argument on the specified computing ...
Definition: TensorDevice.h:27
Eigen::TensorCustomUnaryOp
Tensor custom class.
Definition: TensorCustomOp.h:53
Eigen::FFT_REVERSE
@ FFT_REVERSE
Definition: TensorForwardDeclarations.h:140
Eigen::TensorPaddingOp
Definition: TensorForwardDeclarations.h:80
Eigen::internal::IsVectorizable
Definition: TensorForwardDeclarations.h:147
Eigen::internal::TypeConversion
Definition: TensorForwardDeclarations.h:46
Eigen::TensorCwiseUnaryOp
Definition: TensorExpr.h:115
Eigen::internal::TensorAsyncExecutor
Definition: TensorExecutor.h:116
Eigen::TensorReductionOp
Definition: TensorForwardDeclarations.h:63
Eigen::TensorTraceOp
Definition: TensorForwardDeclarations.h:88
Eigen::internal::IsTileable::value
static const TiledEvaluation value
Definition: TensorForwardDeclarations.h:172
Eigen::TensorScanOp
Definition: TensorForwardDeclarations.h:87
Eigen::internal::IsVectorizable::value
static const bool value
Definition: TensorForwardDeclarations.h:148
Eigen::TensorImagePatchOp
Definition: TensorForwardDeclarations.h:72
Eigen::TensorAsyncDevice
Pseudo expression providing an operator = that will evaluate its argument asynchronously on the speci...
Definition: TensorDevice.h:83
Eigen::TensorForcedEvalOp
Definition: TensorForcedEval.h:59
Eigen::TensorStridingSlicingOp
Definition: TensorForwardDeclarations.h:83
Eigen::DefaultDevice
Definition: TensorDeviceDefault.h:17
Eigen::TensorConcatenationOp
Tensor concatenation class.
Definition: TensorConcatenation.h:60
Eigen::TensorReverseOp
Definition: TensorForwardDeclarations.h:79
Eigen::internal::TypeConversion::type
A * type
Definition: TensorForwardDeclarations.h:47
Eigen::NoOpOutputKernel
Definition: TensorContraction.h:294
Eigen::TensorCustomBinaryOp
Tensor custom class.
Definition: TensorCustomOp.h:219
A
Definition: test_numpy_dtypes.cpp:298
data
int data[]
Definition: Map_placement_new.cpp:1
Eigen::RealPart
@ RealPart
Definition: TensorForwardDeclarations.h:133
Eigen::TensorReshapingOp
Definition: TensorForwardDeclarations.h:76
Eigen::internal::On
@ On
Definition: TensorForwardDeclarations.h:160
Eigen::TensorGeneratorOp
Tensor generator class.
Definition: TensorForwardDeclarations.h:85
Eigen::TensorConvolutionOp
Definition: TensorConvolution.h:259
Eigen::MakePointer
Definition: TensorForwardDeclarations.h:21
Eigen::Architecture::Type
Type
Definition: Constants.h:471
EIGEN_STRONG_INLINE
#define EIGEN_STRONG_INLINE
Definition: Macros.h:917
Eigen::TensorStridingOp
Definition: TensorForwardDeclarations.h:82
Eigen::TensorCwiseBinaryOp
Definition: TensorExpr.h:196
Eigen::TensorMap
A tensor expression mapping an existing array of data.
Definition: TensorForwardDeclarations.h:52
Eigen::TensorSelectOp
Definition: TensorExpr.h:352
Eigen::Triplet< double >
Eigen::TensorCwiseNullaryOp
Definition: TensorExpr.h:52
Eigen::StorageMemory
Definition: TensorForwardDeclarations.h:37
Eigen::ImagPart
@ ImagPart
Definition: TensorForwardDeclarations.h:134
Eigen::TensorConversionOp
Tensor conversion class. This class makes it possible to vectorize type casting operations when the n...
Definition: TensorConversion.h:176
Eigen::TensorBase
The tensor base class.
Definition: TensorBase.h:973
Eigen::TensorTupleReducerOp
Definition: TensorArgMax.h:176
Eigen::TensorChippingOp
Definition: TensorChipping.h:80
Eigen::internal::TensorExecutor
Definition: TensorExecutor.h:81
Eigen::internal::Off
@ Off
Definition: TensorForwardDeclarations.h:159
Eigen::MakePointer::ConstType
const typedef T * ConstType
Definition: TensorForwardDeclarations.h:23
Eigen::FFTDirection
FFTDirection
Definition: TensorForwardDeclarations.h:138
Eigen::TensorLayoutSwapOp
Definition: TensorForwardDeclarations.h:77
Eigen::internal::IsTileable::BlockAccess
static const bool BlockAccess
Definition: TensorForwardDeclarations.h:168
Eigen::TensorSlicingOp
Definition: TensorForwardDeclarations.h:78
Eigen::TensorContractionOp
Definition: TensorContraction.h:325
Eigen::TensorFFTOp
Definition: TensorFFT.h:86
Eigen::TensorEvaluator
A cost model used to limit the number of threads used for evaluating tensor expression.
Definition: TensorEvaluator.h:28
Eigen::TensorFixedSize
The fixed sized version of the tensor class.
Definition: TensorFixedSize.h:27
Eigen::TensorCwiseTernaryOp
Definition: TensorExpr.h:278
Eigen::FFT_FORWARD
@ FFT_FORWARD
Definition: TensorForwardDeclarations.h:139
Eigen::TensorInflationOp
Definition: TensorForwardDeclarations.h:84
Eigen::TensorBroadcastingOp
Definition: TensorBroadcasting.h:69
Eigen::TensorShufflingOp
Definition: TensorForwardDeclarations.h:81
internal
Definition: BandTriangularSolver.h:13
Eigen::TensorPatchOp
Definition: TensorForwardDeclarations.h:71
Eigen::FFTResultType
FFTResultType
Definition: TensorForwardDeclarations.h:132
Eigen::BothParts
@ BothParts
Definition: TensorForwardDeclarations.h:135
Eigen::TensorAssignOp
Definition: TensorAssign.h:61
Eigen::TensorVolumePatchOp
Definition: TensorForwardDeclarations.h:73
Eigen::constCast
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T * constCast(const T *data)
Definition: TensorForwardDeclarations.h:27
Eigen::internal::IsTileable
Definition: TensorForwardDeclarations.h:164
Eigen::TensorIndexTupleOp
Definition: TensorArgMax.h:53
Eigen::TensorEvalToOp
Definition: TensorEvalTo.h:68
Eigen::MakePointer::Type
T * Type
Definition: TensorForwardDeclarations.h:22


gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:37:52