10 #ifndef EIGEN_CXX11_TENSOR_TENSOR_FORCED_EVAL_H 11 #define EIGEN_CXX11_TENSOR_TENSOR_FORCED_EVAL_H 29 template<
typename XprType,
template <
class>
class MakePointer_>
33 typedef typename XprType::Scalar Scalar;
37 typedef typename XprType::Nested Nested;
39 static const int NumDimensions = XprTraits::NumDimensions;
40 static const int Layout = XprTraits::Layout;
47 typedef MakePointer_<T> MakePointerT;
48 typedef typename MakePointerT::Type Type;
52 template<
typename XprType,
template <
class>
class MakePointer_>
58 template<
typename XprType,
template <
class>
class MakePointer_>
68 template<
typename XprType,
template <
class>
class MakePointer_>
84 expression()
const {
return m_xpr; }
87 typename XprType::Nested m_xpr;
91 template<
typename ArgType,
typename Device,
template <
class>
class MakePointer_>
95 typedef typename ArgType::Scalar Scalar;
97 typedef typename XprType::Index
Index;
104 PacketAccess = (PacketSize > 1),
111 : m_impl(op.expression(), device), m_op(op.expression()), m_device(device), m_buffer(NULL)
114 EIGEN_DEVICE_FUNC
const Dimensions& dimensions()
const {
return m_impl.dimensions(); }
116 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
bool evalSubExprsIfNeeded(CoeffReturnType*) {
117 const Index numValues = internal::array_prod(m_impl.dimensions());
118 m_buffer = (CoeffReturnType*)m_device.allocate(numValues *
sizeof(CoeffReturnType));
121 for (Index i = 0; i < numValues; ++i) {
122 new(m_buffer+i) CoeffReturnType();
126 EvalTo evalToTmp(m_buffer, m_op);
131 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void cleanup() {
132 m_device.deallocate(m_buffer);
136 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index)
const 138 return m_buffer[index];
141 template<
int LoadMode>
142 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index)
const 144 return internal::ploadt<PacketReturnType, LoadMode>(m_buffer + index);
147 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
TensorOpCost costPerCoeff(
bool vectorized)
const {
148 return TensorOpCost(
sizeof(CoeffReturnType), 0, 0, vectorized, PacketSize);
151 EIGEN_DEVICE_FUNC
typename MakePointer<Scalar>::Type data()
const {
return m_buffer; }
156 const Device&
device()
const{
return m_device;}
160 const Device& m_device;
161 typename MakePointer<CoeffReturnType>::Type m_buffer;
167 #endif // EIGEN_CXX11_TENSOR_TENSOR_FORCED_EVAL_H const TensorEvaluator< ArgType, Device > & impl()
required by sycl in order to extract the sycl accessor
Definition: TensorForcedEval.h:154
Definition: TensorExecutor.h:27
Definition: TensorCostModel.h:25
Definition: XprHelper.h:158
Definition: TensorForwardDeclarations.h:91
Definition: TensorForcedEval.h:69
Definition: TensorEvalTo.h:65
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:85
A cost model used to limit the number of threads used for evaluating tensor expression.
Definition: TensorEvaluator.h:28
Holds information about the various numeric (i.e.
Definition: NumTraits.h:150
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:33
EIGEN_DEVICE_FUNC TensorEvaluator(const XprType &op, const Device &device)
op_ is used for sycl
Definition: TensorForcedEval.h:109
The tensor base class.
Definition: TensorBase.h:827
Definition: BandTriangularSolver.h:13
Definition: TensorForwardDeclarations.h:21
Definition: TensorTraits.h:170
The type used to identify a dense storage.
Definition: Constants.h:491
Generic expression where a coefficient-wise unary operator is applied to an expression.
Definition: CwiseUnaryOp.h:55
const Device & device() const
used by sycl in order to build the sycl buffer
Definition: TensorForcedEval.h:156
Definition: ForwardDeclarations.h:17
Definition: XprHelper.h:312