10 #ifndef EIGEN_CXX11_TENSOR_TENSOR_EVAL_TO_H 11 #define EIGEN_CXX11_TENSOR_TENSOR_EVAL_TO_H 23 template<
typename XprType,
template <
class>
class MakePointer_>
27 typedef typename XprType::Scalar Scalar;
29 typedef typename XprTraits::StorageKind StorageKind;
30 typedef typename XprTraits::Index
Index;
31 typedef typename XprType::Nested Nested;
33 static const int NumDimensions = XprTraits::NumDimensions;
34 static const int Layout = XprTraits::Layout;
42 typedef MakePointer_<T> MakePointerT;
43 typedef typename MakePointerT::Type Type;
47 template<
typename XprType,
template <
class>
class MakePointer_>
53 template<
typename XprType,
template <
class>
class MakePointer_>
64 template<
typename XprType,
template <
class>
class MakePointer_>
71 typedef typename MakePointer_<CoeffReturnType>::Type PointerType;
76 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
TensorEvalToOp(PointerType buffer,
const XprType& expr)
77 : m_xpr(expr), m_buffer(buffer) {}
81 expression()
const {
return m_xpr; }
83 EIGEN_DEVICE_FUNC PointerType buffer()
const {
return m_buffer; }
86 typename XprType::Nested m_xpr;
92 template<
typename ArgType,
typename Device,
template <
class>
class MakePointer_>
96 typedef typename ArgType::Scalar Scalar;
98 typedef typename XprType::Index
Index;
111 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
TensorEvaluator(
const XprType& op,
const Device& device)
112 : m_impl(op.expression(), device), m_device(device),
113 m_buffer(op.buffer()), m_op(op), m_expression(op.expression())
117 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
const XprType& op()
const {
121 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ~TensorEvaluator() {
125 EIGEN_DEVICE_FUNC
const Dimensions& dimensions()
const {
return m_impl.dimensions(); }
127 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
bool evalSubExprsIfNeeded(DevicePointer scalar) {
128 EIGEN_UNUSED_VARIABLE(scalar);
129 eigen_assert(scalar == NULL);
130 return m_impl.evalSubExprsIfNeeded(m_buffer);
133 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void evalScalar(Index i) {
134 m_buffer[i] = m_impl.coeff(i);
136 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void evalPacket(Index i) {
137 internal::pstoret<CoeffReturnType, PacketReturnType, Aligned>(m_buffer + i, m_impl.template packet<TensorEvaluator<ArgType, Device>::IsAligned ?
Aligned :
Unaligned>(i));
140 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void cleanup() {
144 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index)
const 146 return m_buffer[index];
149 template<
int LoadMode>
150 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index)
const 152 return internal::ploadt<PacketReturnType, LoadMode>(m_buffer + index);
155 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
TensorOpCost costPerCoeff(
bool vectorized)
const {
158 return m_impl.costPerCoeff(vectorized) +
159 TensorOpCost(0,
sizeof(CoeffReturnType), 0, vectorized, PacketSize);
162 EIGEN_DEVICE_FUNC DevicePointer data()
const {
return m_buffer; }
163 ArgType expression()
const {
return m_expression; }
168 const Device&
device()
const{
return m_device;}
172 const Device& m_device;
173 DevicePointer m_buffer;
175 const ArgType m_expression;
181 #endif // EIGEN_CXX11_TENSOR_TENSOR_EVAL_TO_H Definition: TensorCostModel.h:25
Definition: XprHelper.h:158
const Device & device() const
added for sycl in order to construct the buffer from the sycl device
Definition: TensorEvalTo.h:168
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
const TensorEvaluator< ArgType, Device > & impl() const
required by sycl in order to extract the accessor
Definition: TensorEvalTo.h:166
Data pointer has no specific alignment.
Definition: Constants.h:228
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:33
Definition: Constants.h:235
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
Definition: ForwardDeclarations.h:17
Definition: XprHelper.h:312