10 #ifndef EIGEN_CXX11_TENSOR_TENSOR_FORCED_EVAL_H
11 #define EIGEN_CXX11_TENSOR_TENSOR_FORCED_EVAL_H
28 template <
typename XprType>
35 typedef typename XprType::Nested
Nested;
36 typedef std::remove_reference_t<Nested>
Nested_;
37 static constexpr
int NumDimensions = XprTraits::NumDimensions;
38 static constexpr
int Layout = XprTraits::Layout;
44 template <
typename XprType>
49 template <
typename XprType>
56 template <
typename XprType>
75 template <
typename Device,
typename CoeffReturnType>
77 template <
typename StorageType>
81 for (
Index i = 0;
i < numValues; ++
i)
new (m_buffer +
i) CoeffReturnType();
89 template <
typename CoeffReturnType>
91 template <
typename StorageType>
96 template <
typename Device>
116 template <
typename ArgType_,
typename Device>
134 PreferBlockAccess =
false,
149 : m_impl(
op.expression(), device),
150 m_op(
op.expression()),
152 m_buffer_holder(nullptr),
161 m_buffer_holder = std::make_shared<DeviceTempPointerHolder<Device>>(
m_device, numValues *
sizeof(
CoeffReturnType));
167 EvalTo evalToTmp(
m_device.get(m_buffer), m_op);
176 #ifdef EIGEN_USE_THREADS
177 template <
typename EvalSubExprsCallback>
180 m_buffer_holder = std::make_shared<DeviceTempPointerHolder<Device>>(
m_device, numValues *
sizeof(
CoeffReturnType));
184 EvalTo evalToTmp(
m_device.get(m_buffer), m_op);
186 auto on_done = std::bind([](EvalSubExprsCallback done_) { done_(
true); }, std::move(done));
187 internal::TensorAsyncExecutor<
188 const EvalTo, std::remove_const_t<Device>, decltype(on_done),
196 m_buffer_holder =
nullptr;
202 template <
int LoadMode>
204 return internal::ploadt<PacketReturnType, LoadMode>(m_buffer + index);
212 bool =
false)
const {
int i
Definition: BiCGSTAB_step_by_step.cpp:9
#define EIGEN_ALWAYS_INLINE
Definition: Macros.h:845
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:892
#define eigen_assert(x)
Definition: Macros.h:910
#define EIGEN_STRONG_INLINE
Definition: Macros.h:834
#define EIGEN_DEVICE_REF
Definition: TensorMacros.h:34
Scalar Scalar int size
Definition: benchVecAdd.cpp:17
SCALAR Scalar
Definition: bench_gemm.cpp:45
Generic expression where a coefficient-wise binary operator is applied to two expressions.
Definition: CwiseBinaryOp.h:79
Definition: TensorForcedEval.h:97
~DeviceTempPointerHolder()
Definition: TensorForcedEval.h:102
void * ptr_
Definition: TensorForcedEval.h:113
DeviceTempPointerHolder(const Device &device, size_t size)
Definition: TensorForcedEval.h:99
Device device_
Definition: TensorForcedEval.h:111
void * ptr()
Definition: TensorForcedEval.h:108
size_t size_
Definition: TensorForcedEval.h:112
The tensor base class.
Definition: TensorBase.h:1026
Definition: TensorEvalTo.h:61
Definition: TensorForcedEval.h:57
Eigen::internal::traits< TensorForcedEvalOp >::Scalar Scalar
Definition: TensorForcedEval.h:59
EIGEN_DEVICE_FUNC const internal::remove_all_t< typename XprType::Nested > & expression() const
Definition: TensorForcedEval.h:68
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorForcedEvalOp(const XprType &expr)
Definition: TensorForcedEval.h:66
Eigen::internal::traits< TensorForcedEvalOp >::Index Index
Definition: TensorForcedEval.h:64
std::remove_const_t< typename XprType::CoeffReturnType > CoeffReturnType
Definition: TensorForcedEval.h:61
XprType::Nested m_xpr
Definition: TensorForcedEval.h:71
Eigen::internal::traits< TensorForcedEvalOp >::StorageKind StorageKind
Definition: TensorForcedEval.h:63
Eigen::internal::nested< TensorForcedEvalOp >::type Nested
Definition: TensorForcedEval.h:62
Eigen::NumTraits< Scalar >::Real RealScalar
Definition: TensorForcedEval.h:60
Definition: TensorCostModel.h:28
Definition: TensorBlock.h:475
Definition: TensorExecutor.h:78
Definition: TensorBlock.h:604
static EIGEN_STRONG_INLINE TensorMaterializedBlock materialize(const Scalar *data, const DataDimensions &data_dims, TensorBlockDesc &desc, TensorBlockScratch &scratch)
Definition: TensorBlock.h:699
char char * op
Definition: level2_impl.h:374
constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE auto array_prod(const array< T, N > &arr) -> decltype(array_reduce< product_op, T, N >(arr, static_cast< T >(1)))
Definition: MoreMeta.h:497
typename remove_all< T >::type remove_all_t
Definition: Meta.h:142
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
auto run(Kernel kernel, Args &&... args) -> decltype(kernel(args...))
Definition: gpu_test_helper.h:414
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
Extend namespace for flags.
Definition: fsi_chan_precond_driver.cc:56
Definition: Eigen_Colamd.h:49
Definition: Constants.h:519
T Real
Definition: NumTraits.h:183
Definition: TensorMeta.h:47
Definition: TensorForwardDeclarations.h:42
internal::TensorBlockScratchAllocator< Device > TensorBlockScratch
Definition: TensorForcedEval.h:143
EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(EvaluatorPointerType)
Definition: TensorForcedEval.h:159
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const
Definition: TensorForcedEval.h:203
TensorEvaluator< ArgType, Device >::Dimensions Dimensions
Definition: TensorForcedEval.h:121
XprType::Index Index
Definition: TensorForcedEval.h:122
TensorEvaluator(const XprType &op, const Device &device)
Definition: TensorForcedEval.h:148
std::shared_ptr< DeviceTempPointerHolder< Device > > m_buffer_holder
Definition: TensorForcedEval.h:227
ArgType::Scalar Scalar
Definition: TensorForcedEval.h:120
EIGEN_STRONG_INLINE void cleanup()
Definition: TensorForcedEval.h:195
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorBlock block(TensorBlockDesc &desc, TensorBlockScratch &scratch, bool=false) const
Definition: TensorForcedEval.h:211
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
Definition: TensorForcedEval.h:200
Eigen::internal::traits< XprType >::PointerType TensorPointerType
Definition: TensorForcedEval.h:126
Storage::Type EvaluatorPointerType
Definition: TensorForcedEval.h:128
EvaluatorPointerType m_buffer
Definition: TensorForcedEval.h:228
TensorEvaluator< ArgType, Device > m_impl
Definition: TensorForcedEval.h:224
TensorForcedEvalOp< ArgType > XprType
Definition: TensorForcedEval.h:119
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
Definition: TensorForcedEval.h:217
EIGEN_DEVICE_FUNC const Dimensions & dimensions() const
Definition: TensorForcedEval.h:157
internal::TensorMaterializedBlock< CoeffReturnType, NumDims, Layout, Index > TensorBlock
Definition: TensorForcedEval.h:145
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE EvaluatorPointerType data() const
Definition: TensorForcedEval.h:221
internal::TensorBlockDescriptor< NumDims, Index > TensorBlockDesc
Definition: TensorForcedEval.h:142
~TensorEvaluator()
Definition: TensorForcedEval.h:155
const ArgType m_op
Definition: TensorForcedEval.h:225
const internal::remove_all_t< ArgType_ > ArgType
Definition: TensorForcedEval.h:118
const Device EIGEN_DEVICE_REF m_device
Definition: TensorForcedEval.h:226
StorageMemory< CoeffReturnType, Device > Storage
Definition: TensorForcedEval.h:127
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE internal::TensorBlockResourceRequirements getResourceRequirements() const
Definition: TensorForcedEval.h:207
PacketType< CoeffReturnType, Device >::type PacketReturnType
Definition: TensorForcedEval.h:124
XprType::CoeffReturnType CoeffReturnType
Definition: TensorForcedEval.h:123
A cost model used to limit the number of threads used for evaluating tensor expression.
Definition: TensorEvaluator.h:31
static constexpr int Layout
Definition: TensorEvaluator.h:46
const Device EIGEN_DEVICE_REF m_device
Definition: TensorEvaluator.h:170
Storage::Type EvaluatorPointerType
Definition: TensorEvaluator.h:41
@ PacketAccess
Definition: TensorEvaluator.h:50
@ IsAligned
Definition: TensorEvaluator.h:49
static constexpr int PacketSize
Definition: TensorEvaluator.h:38
Derived::Scalar CoeffReturnType
Definition: TensorEvaluator.h:34
EIGEN_STRONG_INLINE void cleanup()
Definition: TensorEvaluator.h:87
Definition: TensorForwardDeclarations.h:192
static const TiledEvaluation value
Definition: TensorForwardDeclarations.h:199
Definition: TensorForwardDeclarations.h:175
static const bool value
Definition: TensorForwardDeclarations.h:176
Definition: TensorBlock.h:75
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorBlockResourceRequirements any()
Definition: TensorBlock.h:143
const TensorForcedEvalOp< XprType > & type
Definition: TensorForcedEval.h:46
Definition: XprHelper.h:427
TensorForcedEvalOp< XprType > type
Definition: TensorForcedEval.h:51
Definition: TensorTraits.h:152
ref_selector< T >::type type
Definition: TensorTraits.h:153
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void operator()(Index, StorageType)
Definition: TensorForcedEval.h:92
Definition: TensorForcedEval.h:76
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void operator()(Index numValues, StorageType m_buffer)
Definition: TensorForcedEval.h:78
XprType::Nested Nested
Definition: TensorForcedEval.h:35
traits< XprType > XprTraits
Definition: TensorForcedEval.h:32
traits< XprType >::Index Index
Definition: TensorForcedEval.h:34
XprType::Scalar Scalar
Definition: TensorForcedEval.h:31
std::remove_reference_t< Nested > Nested_
Definition: TensorForcedEval.h:36
XprTraits::PointerType PointerType
Definition: TensorForcedEval.h:39
traits< XprType >::StorageKind StorageKind
Definition: TensorForcedEval.h:33
Definition: ForwardDeclarations.h:21