10 #ifndef EIGEN_CXX11_TENSOR_TENSOR_EVALUATOR_H 11 #define EIGEN_CXX11_TENSOR_TENSOR_EVALUATOR_H 27 template<
typename Derived,
typename Device>
44 CoordAccess = NumCoords > 0,
77 PacketReturnType
packet(Index index)
const 79 return internal::ploadt<PacketReturnType, LoadMode>(
m_data + index);
85 return internal::pstoret<Scalar, PacketReturnType, StoreMode>(
m_data + index,
x);
107 return TensorOpCost(
sizeof(CoeffReturnType), 0, 0, vectorized,
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>
164 CoordAccess = NumCoords > 0,
189 return loadConstant(
m_data+index);
193 PacketReturnType
packet(Index index)
const 195 return internal::ploadt_ro<PacketReturnType, LoadMode>(
m_data + index);
200 const Index index = (
static_cast<int>(
Layout) == static_cast<int>(
ColMajor)) ?
m_dims.IndexOfColMajor(coords)
201 :
m_dims.IndexOfRowMajor(coords);
202 return loadConstant(
m_data+index);
206 return TensorOpCost(
sizeof(CoeffReturnType), 0, 0, vectorized,
227 template<
typename NullaryOp,
typename ArgType,
typename Device>
242 : m_functor(op.functor()), m_argImpl(op.nestedExpression(), device), m_wrapper()
252 EIGEN_DEVICE_FUNC
const Dimensions&
dimensions()
const {
return m_argImpl.dimensions(); }
257 EIGEN_DEVICE_FUNC CoeffReturnType
coeff(Index index)
const 259 return m_wrapper(m_functor, index);
262 template<
int LoadMode>
265 return m_wrapper.template packetOp<PacketReturnType, Index>(m_functor, index);
270 return TensorOpCost(
sizeof(CoeffReturnType), 0, 0, vectorized,
274 EIGEN_DEVICE_FUNC CoeffReturnType*
data()
const {
return NULL; }
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)
317 EIGEN_DEVICE_FUNC
const Dimensions&
dimensions()
const {
return m_argImpl.dimensions(); }
320 m_argImpl.evalSubExprsIfNeeded(
NULL);
327 EIGEN_DEVICE_FUNC CoeffReturnType
coeff(Index index)
const 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);
344 EIGEN_DEVICE_FUNC CoeffReturnType*
data()
const {
return NULL; }
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();
406 EIGEN_DEVICE_FUNC CoeffReturnType
coeff(Index index)
const 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);
424 EIGEN_DEVICE_FUNC CoeffReturnType*
data()
const {
return NULL; }
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();
503 EIGEN_DEVICE_FUNC CoeffReturnType
coeff(Index index)
const 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);
524 EIGEN_DEVICE_FUNC CoeffReturnType*
data()
const {
return NULL; }
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();
593 EIGEN_DEVICE_FUNC CoeffReturnType
coeff(Index index)
const 595 return m_condImpl.coeff(index) ? m_thenImpl.coeff(index) : m_elseImpl.coeff(index);
597 template<
int LoadMode>
598 EIGEN_DEVICE_FUNC PacketReturnType
packet(Index index)
const 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 TensorEvaluator< LeftArgType, Device > m_leftImpl
#define EIGEN_ALWAYS_INLINE
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(CoeffReturnType *data)
TensorSelectOp< IfArgType, ThenArgType, ElseArgType > XprType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
EIGEN_DEVICE_FUNC TensorEvaluator(const XprType &op, const Device &device)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void cleanup()
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void cleanup()
#define EIGEN_STRONG_INLINE
EIGEN_DEVICE_FUNC internal::traits< Derived >::template MakePointer< Scalar >::Type data() const
EIGEN_DEVICE_FUNC CoeffReturnType * data() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void cleanup()
const TensorEvaluator< ElseArgType, Device > & else_impl() const
required by sycl in order to extract the accessor
Eigen::internal::traits< TensorCwiseNullaryOp >::Index Index
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
PacketType< CoeffReturnType, Device >::type PacketReturnType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions & dimensions() const
EIGEN_DEVICE_FUNC const Dimensions & dimensions() const
EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index index) const
Derived::Scalar CoeffReturnType
PacketType< CoeffReturnType, Device >::type PacketReturnType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(const array< DenseIndex, NumCoords > &coords) const
internal::traits< XprType >::Scalar CoeffReturnType
Derived::Dimensions Dimensions
TensorEvaluator< Arg2Type, Device > m_arg2Impl
TensorEvaluator< RightArgType, Device > m_rightImpl
const Device & device() const
added for sycl in order to construct the buffer from the sycl device
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorEvaluator(const Derived &m, const Device &device)
TensorEvaluator< ElseArgType, Device > m_elseImpl
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
internal::traits< Derived >::template MakePointer< Scalar >::Type m_data
EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index index) const
const TensorEvaluator< ArgType, Device > & impl() const
required by sycl in order to extract the accessor
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void cleanup()
Eigen::internal::traits< TensorCwiseTernaryOp >::Index Index
EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index index) const
const TensorEvaluator< Arg1Type, Device > & arg1Impl() const
required by sycl in order to extract the accessor
Namespace containing all symbols from the Eigen library.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacket(Index index, const PacketReturnType &x)
NullaryOp functor() const
required by sycl in order to extract the accessor
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(CoeffReturnType *)
A cost model used to limit the number of threads used for evaluating tensor expression.
const TernaryOp m_functor
const TensorEvaluator< RightArgType, Device > & right_impl() const
required by sycl in order to extract the accessor
EIGEN_DEVICE_FUNC const Dimensions & dimensions() const
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
Eigen::internal::traits< TensorCwiseBinaryOp >::Index Index
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const
PacketType< CoeffReturnType, Device >::type PacketReturnType
EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index index) const
const TensorEvaluator< Arg3Type, Device > & arg3Impl() const
required by sycl in order to extract the accessor
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const
Eigen::internal::traits< TensorCwiseUnaryOp >::Scalar Scalar
const TensorEvaluator< ArgType, Device > & impl() const
required by sycl in order to extract the accessor
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(CoeffReturnType *)
TensorEvaluator< Arg3Type, Device > m_arg3Impl
TensorCwiseUnaryOp< UnaryOp, ArgType > XprType
TensorEvaluator< ArgType, Device >::Dimensions Dimensions
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void cleanup()
BinaryOp functor() const
required by sycl in order to extract the accessor
EIGEN_DEVICE_FUNC TensorEvaluator(const XprType &op, const Device &device)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void cleanup()
EIGEN_DEVICE_FUNC TensorEvaluator(const XprType &op, const Device &device)
TensorCwiseTernaryOp< TernaryOp, Arg1Type, Arg2Type, Arg3Type > XprType
TensorCwiseNullaryOp< NullaryOp, ArgType > XprType
PacketType< CoeffReturnType, Device >::type PacketReturnType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
TensorEvaluator< LeftArgType, Device >::Dimensions Dimensions
Eigen::internal::traits< TensorCwiseNullaryOp >::Scalar Scalar
PacketType< CoeffReturnType, Device >::type PacketReturnType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const
internal::traits< XprType >::Scalar CoeffReturnType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
internal::traits< XprType >::Scalar CoeffReturnType
EIGEN_DEVICE_FUNC CoeffReturnType * data() const
TensorEvaluator< ArgType, Device > m_argImpl
TensorCwiseBinaryOp< BinaryOp, LeftArgType, RightArgType > XprType
TensorEvaluator< ArgType, Device > m_argImpl
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(const array< DenseIndex, NumCoords > &coords)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions & dimensions() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index index)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Eigen::internal::traits< TensorCwiseTernaryOp >::Scalar Scalar
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(const array< DenseIndex, NumCoords > &coords) const
Eigen::internal::traits< TensorSelectOp >::Scalar Scalar
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType * data() const
EIGEN_DEVICE_FUNC internal::traits< Derived >::template MakePointer< const Scalar >::Type data() const
EIGEN_DEVICE_FUNC PacketReturnType packet(Index index) const
TensorEvaluator< ThenArgType, Device > m_thenImpl
internal::traits< XprType >::Scalar CoeffReturnType
static const int NumCoords
PacketType< CoeffReturnType, Device >::type PacketReturnType
Derived::Scalar CoeffReturnType
EIGEN_DEVICE_FUNC bool dimensions_match(Dims1 &dims1, Dims2 &dims2)
Derived::Dimensions Dimensions
Eigen::internal::traits< TensorSelectOp >::Index Index
EIGEN_DEVICE_FUNC const Dimensions & dimensions() const
const TensorEvaluator< LeftArgType, Device > & left_impl() const
required by sycl in order to extract the accessor
EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index index) const
TensorEvaluator< ArgType, Device >::Dimensions Dimensions
const TensorEvaluator< Arg2Type, Device > & arg2Impl() const
required by sycl in order to extract the accessor
EIGEN_DEVICE_FUNC const Dimensions & dimensions() const
TensorEvaluator< IfArgType, Device >::Dimensions Dimensions
Eigen::internal::traits< TensorCwiseBinaryOp >::Scalar Scalar
TensorEvaluator< IfArgType, Device > m_condImpl
Eigen::internal::traits< TensorCwiseUnaryOp >::Index Index
internal::traits< XprType >::Scalar CoeffReturnType
PacketType< CoeffReturnType, Device >::type PacketReturnType
EIGEN_DEVICE_FUNC CoeffReturnType * data() const
const Device & device() const
required by sycl in order to construct sycl buffer from raw pointer
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(CoeffReturnType *)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(CoeffReturnType *dest)
TensorEvaluator< Arg1Type, Device >::Dimensions Dimensions
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void cleanup()
EIGEN_DEVICE_FUNC TensorEvaluator(const XprType &op, const Device &device)
UnaryOp functor() const
added for sycl in order to construct the buffer from sycl device
const NullaryOp m_functor
TensorEvaluator< Arg1Type, Device > m_arg1Impl
EIGEN_DEVICE_FUNC CoeffReturnType * data() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const
const Derived & derived() const
EIGEN_DEVICE_FUNC const Dimensions & dimensions() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(Scalar *)
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost cwiseMax(const TensorOpCost &rhs) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
internal::traits< Derived >::template MakePointer< const Scalar >::Type m_data
const internal::nullary_wrapper< CoeffReturnType, NullaryOp > m_wrapper
EIGEN_DEVICE_FUNC TensorEvaluator(const XprType &op, const Device &device)
const Derived & derived() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
EIGEN_STRONG_INLINE Packet4i pblend(const Selector< 4 > &ifPacket, const Packet4i &thenPacket, const Packet4i &elsePacket)
const TensorEvaluator< ThenArgType, Device > & then_impl() const
required by sycl in order to extract the accessor
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorEvaluator(const Derived &m, const Device &device)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(CoeffReturnType *)
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC __half_raw raw_uint16_to_half(unsigned short x)
const TensorEvaluator< IfArgType, Device > & cond_impl() const
required by sycl in order to extract the accessor