10 #ifndef EIGEN_CXX11_TENSOR_TENSOR_EVAL_TO_H
11 #define EIGEN_CXX11_TENSOR_TENSOR_EVAL_TO_H
25 template<
typename XprType,
template <
class>
class MakePointer_>
26 struct traits<TensorEvalToOp<XprType, MakePointer_> >
29 typedef typename XprType::Scalar Scalar;
31 typedef typename XprTraits::StorageKind StorageKind;
32 typedef typename XprTraits::Index
Index;
33 typedef typename XprType::Nested Nested;
34 typedef std::remove_reference_t<Nested> Nested_;
35 static constexpr
int NumDimensions = XprTraits::NumDimensions;
36 static constexpr
int Layout = XprTraits::Layout;
37 typedef typename MakePointer_<Scalar>::Type PointerType;
45 typedef MakePointer_<T> MakePointerT;
46 typedef typename MakePointerT::Type
Type;
52 template<
typename XprType,
template <
class>
class MakePointer_>
53 struct eval<TensorEvalToOp<XprType, MakePointer_>,
Eigen::Dense>
55 typedef const TensorEvalToOp<XprType, MakePointer_>& type;
58 template<
typename XprType,
template <
class>
class MakePointer_>
59 struct nested<TensorEvalToOp<XprType, MakePointer_>, 1, typename eval<TensorEvalToOp<XprType, MakePointer_> >::type>
61 typedef TensorEvalToOp<XprType, MakePointer_> type;
69 template<
typename XprType,
template <
class>
class MakePointer_>
73 typedef typename Eigen::internal::traits<TensorEvalToOp>::Scalar
Scalar;
76 typedef typename MakePointer_<CoeffReturnType>::Type
PointerType;
77 typedef typename Eigen::internal::nested<TensorEvalToOp>::type
Nested;
78 typedef typename Eigen::internal::traits<TensorEvalToOp>::StorageKind
StorageKind;
79 typedef typename Eigen::internal::traits<TensorEvalToOp>::Index
Index;
81 static constexpr
int NumDims = Eigen::internal::traits<TensorEvalToOp>::NumDimensions;
99 template<
typename ArgType,
typename Device,
template <
class>
class MakePointer_>
116 PreferBlockAccess =
false,
122 static constexpr
int NumDims = internal::traits<ArgType>::NumDimensions;
131 typedef internal::TensorBlockAssignment<
137 : m_impl(op.expression(), device), m_buffer(device.get(op.buffer())), m_expression(op.expression()){}
149 return m_impl.evalSubExprsIfNeeded(m_buffer);
152 #ifdef EIGEN_USE_THREADS
153 template <
typename EvalSubExprsCallback>
154 EIGEN_STRONG_INLINE
void evalSubExprsIfNeededAsync(
158 m_impl.evalSubExprsIfNeededAsync(m_buffer, std::move(done));
163 m_buffer[
i] = m_impl.coeff(
i);
171 return m_impl.getResourceRequirements();
177 desc.template AddDestinationBuffer<Layout>(
178 m_buffer + desc.offset(),
179 internal::strides<Layout>(m_impl.dimensions()));
182 m_impl.block(desc, scratch,
true);
187 TensorBlockAssignment::Run(
188 TensorBlockAssignment::target(
189 desc.dimensions(), internal::strides<Layout>(m_impl.dimensions()),
190 m_buffer, desc.offset()),
202 return m_buffer[index];
205 template<
int LoadMode>
208 return internal::ploadt<PacketReturnType, LoadMode>(m_buffer + index);
214 return m_impl.costPerCoeff(vectorized) +
#define EIGEN_UNUSED_VARIABLE(var)
#define EIGEN_DEVICE_FUNC
Eigen::internal::traits< TensorEvalToOp >::StorageKind StorageKind
MakePointer_< CoeffReturnType >::Type PointerType
TensorEvalToOp(PointerType buffer, const XprType &expr)
Eigen::NumTraits< Scalar >::Real RealScalar
Eigen::internal::traits< TensorEvalToOp >::Index Index
const internal::remove_all_t< typename XprType::Nested > & expression() const
PointerType buffer() const
static constexpr int NumDims
Eigen::internal::nested< TensorEvalToOp >::type Nested
Eigen::internal::traits< TensorEvalToOp >::Scalar Scalar
std::remove_const_t< typename XprType::CoeffReturnType > CoeffReturnType
A tensor expression mapping an existing array of data.
typename remove_all< T >::type remove_all_t
: TensorContractionSycl.h, provides various tensor contraction kernel for SYCL backend
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
internal::packet_traits< Scalar >::type type
void evalBlock(TensorBlockDesc &desc, TensorBlockScratch &scratch)
TensorEvaluator< ArgType, Device >::Dimensions Dimensions
TensorEvaluator< ArgType, Device > m_impl
PacketType< CoeffReturnType, Device >::type PacketReturnType
TensorEvaluator< const ArgType, Device >::TensorBlock ArgTensorBlock
TensorEvaluator(const XprType &op, const Device &device)
Storage::Type EvaluatorPointerType
void evalScalar(Index i) const
CoeffReturnType coeff(Index index) const
const Dimensions & dimensions() const
ArgType expression() const
internal::TensorBlockResourceRequirements getResourceRequirements() const
const ArgType m_expression
StorageMemory< CoeffReturnType, Device > Storage
bool evalSubExprsIfNeeded(EvaluatorPointerType scalar)
PacketReturnType packet(Index index) const
TensorOpCost costPerCoeff(bool vectorized) const
EvaluatorPointerType m_buffer
internal::TensorBlockScratchAllocator< Device > TensorBlockScratch
std::remove_const_t< typename XprType::CoeffReturnType > CoeffReturnType
void evalPacket(Index i) const
internal::TensorBlockDescriptor< NumDims, Index > TensorBlockDesc
Eigen::internal::traits< XprType >::PointerType TensorPointerType
EvaluatorPointerType data() const
internal::TensorBlockAssignment< CoeffReturnType, NumDims, typename ArgTensorBlock::XprType, Index > TensorBlockAssignment
TensorEvalToOp< ArgType, MakePointer_ > XprType
A cost model used to limit the number of threads used for evaluating tensor expression.
PacketReturnType packet(Index index) const
static constexpr int Layout
TensorBlock block(TensorBlockDesc &desc, TensorBlockScratch &scratch, bool=false) const
Storage::Type EvaluatorPointerType
static constexpr int PacketSize
Derived::Scalar CoeffReturnType
internal::TensorMaterializedBlock< ScalarNoConst, NumCoords, Layout, Index > TensorBlock