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 adress 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 };
24 
25 template<typename PlainObjectType, int Options_ = Unaligned, template <class> class MakePointer_ = MakePointer> class TensorMap;
26 template<typename Scalar_, int NumIndices_, int Options_ = 0, typename IndexType = DenseIndex> class Tensor;
27 template<typename Scalar_, typename Dimensions, int Options_ = 0, typename IndexType = DenseIndex> class TensorFixedSize;
28 template<typename PlainObjectType> class TensorRef;
29 template<typename Derived, int AccessLevel> class TensorBase;
30 
31 template<typename NullaryOp, typename PlainObjectType> class TensorCwiseNullaryOp;
32 template<typename UnaryOp, typename XprType> class TensorCwiseUnaryOp;
33 template<typename BinaryOp, typename LeftXprType, typename RightXprType> class TensorCwiseBinaryOp;
34 template<typename TernaryOp, typename Arg1XprType, typename Arg2XprType, typename Arg3XprType> class TensorCwiseTernaryOp;
35 template<typename IfXprType, typename ThenXprType, typename ElseXprType> class TensorSelectOp;
36 template<typename Op, typename Dims, typename XprType, template <class> class MakePointer_ = MakePointer > class TensorReductionOp;
37 template<typename XprType> class TensorIndexTupleOp;
38 template<typename ReduceOp, typename Dims, typename XprType> class TensorTupleReducerOp;
39 template<typename Axis, typename LeftXprType, typename RightXprType> class TensorConcatenationOp;
40 template<typename Dimensions, typename LeftXprType, typename RightXprType> class TensorContractionOp;
41 template<typename TargetType, typename XprType> class TensorConversionOp;
42 template<typename Dimensions, typename InputXprType, typename KernelXprType> class TensorConvolutionOp;
43 template<typename FFT, typename XprType, int FFTDataType, int FFTDirection> class TensorFFTOp;
44 template<typename PatchDim, typename XprType> class TensorPatchOp;
45 template<DenseIndex Rows, DenseIndex Cols, typename XprType> class TensorImagePatchOp;
46 template<DenseIndex Planes, DenseIndex Rows, DenseIndex Cols, typename XprType> class TensorVolumePatchOp;
47 template<typename Broadcast, typename XprType> class TensorBroadcastingOp;
48 template<DenseIndex DimId, typename XprType> class TensorChippingOp;
49 template<typename NewDimensions, typename XprType> class TensorReshapingOp;
50 template<typename XprType> class TensorLayoutSwapOp;
51 template<typename StartIndices, typename Sizes, typename XprType> class TensorSlicingOp;
52 template<typename ReverseDimensions, typename XprType> class TensorReverseOp;
53 template<typename PaddingDimensions, typename XprType> class TensorPaddingOp;
54 template<typename Shuffle, typename XprType> class TensorShufflingOp;
55 template<typename Strides, typename XprType> class TensorStridingOp;
56 template<typename StartIndices, typename StopIndices, typename Strides, typename XprType> class TensorStridingSlicingOp;
57 template<typename Strides, typename XprType> class TensorInflationOp;
58 template<typename Generator, typename XprType> class TensorGeneratorOp;
59 template<typename LeftXprType, typename RightXprType> class TensorAssignOp;
60 template<typename Op, typename XprType> class TensorScanOp;
61 
62 template<typename CustomUnaryFunc, typename XprType> class TensorCustomUnaryOp;
63 template<typename CustomBinaryFunc, typename LhsXprType, typename RhsXprType> class TensorCustomBinaryOp;
64 
65 template<typename XprType, template <class> class MakePointer_ = MakePointer> class TensorEvalToOp;
66 template<typename XprType, template <class> class MakePointer_ = MakePointer> class TensorForcedEvalOp;
67 
68 template<typename ExpressionType, typename DeviceType> class TensorDevice;
69 template<typename Derived, typename Device> struct TensorEvaluator;
70 
71 struct DefaultDevice;
72 struct ThreadPoolDevice;
73 struct GpuDevice;
74 struct SyclDevice;
75 
76 enum FFTResultType {
77   RealPart = 0,
78   ImagPart = 1,
79   BothParts = 2
80 };
81 
82 enum FFTDirection {
83     FFT_FORWARD = 0,
84     FFT_REVERSE = 1
85 };
86 
87 
88 namespace internal {
89 
90 template <typename Device, typename Expression>
91 struct IsVectorizable {
92   static const bool value = TensorEvaluator<Expression, Device>::PacketAccess;
93 };
94 
95 template <typename Expression>
96 struct IsVectorizable<GpuDevice, Expression> {
97   static const bool value = TensorEvaluator<Expression, GpuDevice>::PacketAccess &&
98                             TensorEvaluator<Expression, GpuDevice>::IsAligned;
99 };
100 
101 template <typename Expression, typename Device,
102           bool Vectorizable = IsVectorizable<Device, Expression>::value>
103 class TensorExecutor;
104 
105 }  // end namespace internal
106 
107 }  // end namespace Eigen
108 
109 #endif // EIGEN_CXX11_TENSOR_TENSOR_FORWARD_DECLARATIONS_H
110