Go to the documentation of this file.
10 #ifndef EIGEN_CXX11_TENSOR_TENSOR_EVALUATOR_H
11 #define EIGEN_CXX11_TENSOR_TENSOR_EVALUATOR_H
27 template<
typename Derived,
typename Device>
79 return internal::ploadt<PacketReturnType, LoadMode>(
m_data + index);
85 return internal::pstoret<Scalar, PacketReturnType, StoreMode>(
m_data + index,
x);
125 T loadConstant(
const T* address) {
129 #if defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 350
131 float loadConstant(
const float* address) {
132 return __ldg(address);
135 double loadConstant(
const double* address) {
136 return __ldg(address);
147 template<
typename Derived,
typename Device>
189 return loadConstant(
m_data+index);
195 return internal::ploadt_ro<PacketReturnType, LoadMode>(
m_data + index);
201 :
m_dims.IndexOfRowMajor(coords);
202 return loadConstant(
m_data+index);
227 template<
typename NullaryOp,
typename ArgType,
typename Device>
242 : m_functor(op.functor()), m_argImpl(op.nestedExpression(),
device), m_wrapper()
259 return m_wrapper(m_functor, index);
262 template<
int LoadMode>
265 return m_wrapper.template packetOp<PacketReturnType, Index>(m_functor, index);
279 NullaryOp
functor()
const {
return m_functor; }
292 template<
typename UnaryOp,
typename ArgType,
typename Device>
306 : m_functor(op.functor()),
307 m_argImpl(op.nestedExpression(),
device)
320 m_argImpl.evalSubExprsIfNeeded(NULL);
329 return m_functor(m_argImpl.coeff(index));
332 template<
int LoadMode>
335 return m_functor.packetOp(m_argImpl.template packet<LoadMode>(index));
340 return m_argImpl.costPerCoeff(vectorized) +
341 TensorOpCost(0, 0, functor_cost, vectorized, PacketSize);
360 template<
typename BinaryOp,
typename LeftArgType,
typename RightArgType,
typename Device>
375 : m_functor(op.functor()),
376 m_leftImpl(op.lhsExpression(),
device),
377 m_rightImpl(op.rhsExpression(),
device)
393 return m_leftImpl.dimensions();
397 m_leftImpl.evalSubExprsIfNeeded(NULL);
398 m_rightImpl.evalSubExprsIfNeeded(NULL);
402 m_leftImpl.cleanup();
403 m_rightImpl.cleanup();
408 return m_functor(m_leftImpl.coeff(index), m_rightImpl.coeff(index));
410 template<
int LoadMode>
413 return m_functor.packetOp(m_leftImpl.template packet<LoadMode>(index), m_rightImpl.template packet<LoadMode>(index));
419 return m_leftImpl.costPerCoeff(vectorized) +
420 m_rightImpl.costPerCoeff(vectorized) +
421 TensorOpCost(0, 0, functor_cost, vectorized, PacketSize);
430 BinaryOp
functor()
const {
return m_functor; }
440 template<
typename TernaryOp,
typename Arg1Type,
typename Arg2Type,
typename Arg3Type,
typename Device>
455 : m_functor(op.functor()),
456 m_arg1Impl(op.arg1Expression(),
device),
457 m_arg2Impl(op.arg2Expression(),
device),
458 m_arg3Impl(op.arg3Expression(),
device)
464 STORAGE_KIND_MUST_MATCH)
467 STORAGE_KIND_MUST_MATCH)
470 STORAGE_INDEX_MUST_MATCH)
473 STORAGE_INDEX_MUST_MATCH)
488 return m_arg1Impl.dimensions();
492 m_arg1Impl.evalSubExprsIfNeeded(NULL);
493 m_arg2Impl.evalSubExprsIfNeeded(NULL);
494 m_arg3Impl.evalSubExprsIfNeeded(NULL);
498 m_arg1Impl.cleanup();
499 m_arg2Impl.cleanup();
500 m_arg3Impl.cleanup();
505 return m_functor(m_arg1Impl.coeff(index), m_arg2Impl.coeff(index), m_arg3Impl.coeff(index));
507 template<
int LoadMode>
510 return m_functor.packetOp(m_arg1Impl.template packet<LoadMode>(index),
511 m_arg2Impl.template packet<LoadMode>(index),
512 m_arg3Impl.template packet<LoadMode>(index));
518 return m_arg1Impl.costPerCoeff(vectorized) +
519 m_arg2Impl.costPerCoeff(vectorized) +
520 m_arg3Impl.costPerCoeff(vectorized) +
521 TensorOpCost(0, 0, functor_cost, vectorized, PacketSize);
543 template<
typename IfArgType,
typename ThenArgType,
typename ElseArgType,
typename Device>
559 : m_condImpl(op.ifExpression(),
device),
560 m_thenImpl(op.thenExpression(),
device),
561 m_elseImpl(op.elseExpression(),
device)
578 return m_condImpl.dimensions();
582 m_condImpl.evalSubExprsIfNeeded(NULL);
583 m_thenImpl.evalSubExprsIfNeeded(NULL);
584 m_elseImpl.evalSubExprsIfNeeded(NULL);
588 m_condImpl.cleanup();
589 m_thenImpl.cleanup();
590 m_elseImpl.cleanup();
595 return m_condImpl.coeff(index) ? m_thenImpl.coeff(index) : m_elseImpl.coeff(index);
597 template<
int LoadMode>
601 for (
Index i = 0; i < PacketSize; ++i) {
602 select.
select[i] = m_condImpl.coeff(index+i);
605 m_thenImpl.template packet<LoadMode>(index),
606 m_elseImpl.template packet<LoadMode>(index));
611 return m_condImpl.costPerCoeff(vectorized) +
612 m_thenImpl.costPerCoeff(vectorized)
613 .
cwiseMax(m_elseImpl.costPerCoeff(vectorized));
633 #endif // EIGEN_CXX11_TENSOR_TENSOR_EVALUATOR_H
EIGEN_DEVICE_FUNC const EIGEN_STRONG_INLINE Dimensions & dimensions() const
EIGEN_DEVICE_FUNC TensorEvaluator(const XprType &op, const Device &device)
BinaryOp functor() const
required by sycl in order to extract the accessor
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void cleanup()
static const int NumCoords
const TensorEvaluator< Arg3Type, Device > & arg3Impl() const
required by sycl in order to extract the accessor
const Device & device() const
required by sycl in order to construct sycl buffer from raw pointer
const Device & device() const
added for sycl in order to construct the buffer from the sycl device
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC __half_raw raw_uint16_to_half(unsigned short x)
Eigen::internal::traits< TensorCwiseTernaryOp >::Index Index
const TensorEvaluator< ArgType, Device > & impl() const
required by sycl in order to extract the accessor
EIGEN_DEVICE_FUNC internal::traits< Derived >::template MakePointer< const Scalar >::Type data() const
const internal::nullary_wrapper< CoeffReturnType, NullaryOp > m_wrapper
PacketType< CoeffReturnType, Device >::type PacketReturnType
Eigen::internal::traits< TensorCwiseBinaryOp >::Index Index
const EIGEN_DEVICE_FUNC Dimensions & dimensions() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const
internal::traits< Derived >::template MakePointer< Scalar >::Type m_data
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(const array< DenseIndex, NumCoords > &coords) const
const EIGEN_DEVICE_FUNC Dimensions & dimensions() const
PacketType< CoeffReturnType, Device >::type PacketReturnType
const EIGEN_DEVICE_FUNC Dimensions & dimensions() const
TensorEvaluator< Arg3Type, Device > m_arg3Impl
const TensorEvaluator< Arg2Type, Device > & arg2Impl() const
required by sycl in order to extract the accessor
Eigen::internal::traits< TensorCwiseNullaryOp >::Index Index
const TensorEvaluator< IfArgType, Device > & cond_impl() const
required by sycl in order to extract the accessor
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void cleanup()
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(CoeffReturnType *)
TensorEvaluator< RightArgType, Device > m_rightImpl
const NullaryOp m_functor
internal::packet_traits< Scalar >::type type
const EIGEN_DEVICE_FUNC Dimensions & dimensions() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(const array< DenseIndex, NumCoords > &coords)
internal::traits< XprType >::Scalar CoeffReturnType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
TensorEvaluator< ArgType, Device >::Dimensions Dimensions
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const
EIGEN_DEVICE_FUNC internal::traits< Derived >::template MakePointer< Scalar >::Type data() const
TensorEvaluator< IfArgType, Device > m_condImpl
EIGEN_DEVICE_FUNC TensorEvaluator(const XprType &op, const Device &device)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorEvaluator(const Derived &m, const Device &device)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const
TensorEvaluator< ArgType, Device > m_argImpl
TensorEvaluator< IfArgType, Device >::Dimensions Dimensions
const EIGEN_DEVICE_FUNC Dimensions & dimensions() const
const TensorEvaluator< ElseArgType, Device > & else_impl() const
required by sycl in order to extract the accessor
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType * data() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index index)
EIGEN_DEVICE_FUNC CoeffReturnType * data() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(CoeffReturnType *data)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void cleanup()
const TensorEvaluator< ThenArgType, Device > & then_impl() const
required by sycl in order to extract the accessor
TensorEvaluator< ElseArgType, Device > m_elseImpl
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void cleanup()
EIGEN_DEVICE_FUNC TensorEvaluator(const XprType &op, const Device &device)
internal::traits< XprType >::Scalar CoeffReturnType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(CoeffReturnType *)
TensorCwiseTernaryOp< TernaryOp, Arg1Type, Arg2Type, Arg3Type > XprType
Eigen::internal::traits< TensorSelectOp >::Scalar Scalar
Eigen::internal::traits< TensorCwiseUnaryOp >::Index Index
Derived::Dimensions Dimensions
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorEvaluator(const Derived &m, const Device &device)
EIGEN_DEVICE_FUNC CoeffReturnType * data() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
Eigen::internal::traits< TensorCwiseNullaryOp >::Scalar Scalar
#define EIGEN_STRONG_INLINE
internal::traits< Derived >::template MakePointer< const Scalar >::Type m_data
EIGEN_STRONG_INLINE Packet4i pblend(const Selector< 4 > &ifPacket, const Packet4i &thenPacket, const Packet4i &elsePacket)
const TensorEvaluator< Arg1Type, Device > & arg1Impl() const
required by sycl in order to extract the accessor
TensorEvaluator< ArgType, Device >::Dimensions Dimensions
#define EIGEN_ALWAYS_INLINE
Eigen::internal::traits< TensorCwiseTernaryOp >::Scalar Scalar
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void cleanup()
TensorCwiseBinaryOp< BinaryOp, LeftArgType, RightArgType > XprType
TensorEvaluator< ArgType, Device > m_argImpl
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const
PacketType< CoeffReturnType, Device >::type PacketReturnType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void cleanup()
EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index index) const
internal::traits< XprType >::Scalar CoeffReturnType
EIGEN_DEVICE_FUNC TensorEvaluator(const XprType &op, const Device &device)
const TensorEvaluator< LeftArgType, Device > & left_impl() const
required by sycl in order to extract the accessor
const Derived & derived() const
TensorEvaluator< ThenArgType, Device > m_thenImpl
PacketType< CoeffReturnType, Device >::type PacketReturnType
EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index index) const
const TensorEvaluator< RightArgType, Device > & right_impl() const
required by sycl in order to extract the accessor
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void cleanup()
TensorCwiseNullaryOp< NullaryOp, ArgType > XprType
EIGEN_DEVICE_FUNC bool dimensions_match(Dims1 &dims1, Dims2 &dims2)
EIGEN_DEVICE_FUNC CoeffReturnType * data() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index index) const
EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index index) const
Eigen::internal::traits< TensorSelectOp >::Index Index
EIGEN_DEVICE_FUNC TensorEvaluator(const XprType &op, const Device &device)
NullaryOp functor() const
required by sycl in order to extract the accessor
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(const array< DenseIndex, NumCoords > &coords) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(CoeffReturnType *)
internal::traits< XprType >::Scalar CoeffReturnType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(Scalar *)
PacketType< CoeffReturnType, Device >::type PacketReturnType
Eigen::internal::traits< TensorCwiseUnaryOp >::Scalar Scalar
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
TensorEvaluator< LeftArgType, Device > m_leftImpl
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(CoeffReturnType *)
Derived::Scalar CoeffReturnType
TensorCwiseUnaryOp< UnaryOp, ArgType > XprType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const
A cost model used to limit the number of threads used for evaluating tensor expression.
TensorEvaluator< Arg1Type, Device >::Dimensions Dimensions
TensorEvaluator< Arg1Type, Device > m_arg1Impl
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacket(Index index, const PacketReturnType &x)
UnaryOp functor() const
added for sycl in order to construct the buffer from sycl device
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const
Derived::Scalar CoeffReturnType
PacketType< CoeffReturnType, Device >::type PacketReturnType
internal::traits< XprType >::Scalar CoeffReturnType
Eigen::internal::traits< TensorCwiseBinaryOp >::Scalar Scalar
EIGEN_DEVICE_FUNC PacketReturnType packet(Index index) const
TensorEvaluator< LeftArgType, Device >::Dimensions Dimensions
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost cwiseMax(const TensorOpCost &rhs) const
EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index index) const
EIGEN_DEVICE_FUNC CoeffReturnType * data() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
PacketType< CoeffReturnType, Device >::type PacketReturnType
TensorEvaluator< Arg2Type, Device > m_arg2Impl
const TensorEvaluator< ArgType, Device > & impl() const
required by sycl in order to extract the accessor
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
EIGEN_DEVICE_FUNC const EIGEN_STRONG_INLINE Dimensions & dimensions() const
const Derived & derived() const
const TernaryOp m_functor
TensorSelectOp< IfArgType, ThenArgType, ElseArgType > XprType
Derived::Dimensions Dimensions
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(CoeffReturnType *dest)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
control_box_rst
Author(s): Christoph Rösmann
autogenerated on Wed Mar 2 2022 00:06:42