Eigen::TensorOpCost Class Reference

#include <TensorCostModel.h>

Public Member Functions

EIGEN_DEVICE_FUNC TensorOpCost ()
 
EIGEN_DEVICE_FUNC TensorOpCost (double bytes_loaded, double bytes_stored, double compute_cycles)
 
EIGEN_DEVICE_FUNC TensorOpCost (double bytes_loaded, double bytes_stored, double compute_cycles, bool vectorized, double packet_size)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double bytes_loaded () const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double bytes_stored () const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double compute_cycles () const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double total_cost (double load_cost, double store_cost, double compute_cost) const
 
EIGEN_DEVICE_FUNC void dropMemoryCost ()
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost cwiseMin (const TensorOpCost &rhs) const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost cwiseMax (const TensorOpCost &rhs) const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCostoperator+= (const TensorOpCost &rhs)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCostoperator*= (double rhs)
 

Static Public Member Functions

template<typename ArgType >
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE int MulCost ()
 
template<typename ArgType >
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE int AddCost ()
 
template<typename ArgType >
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE int DivCost ()
 
template<typename ArgType >
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE int ModCost ()
 
template<typename SrcType , typename TargetType >
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE int CastCost ()
 

Private Attributes

double bytes_loaded_
 
double bytes_stored_
 
double compute_cycles_
 

Friends

EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE friend TensorOpCost operator+ (TensorOpCost lhs, const TensorOpCost &rhs)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE friend TensorOpCost operator* (TensorOpCost lhs, double rhs)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE friend TensorOpCost operator* (double lhs, TensorOpCost rhs)
 
std::ostream & operator<< (std::ostream &os, const TensorOpCost &tc)
 

Constructor & Destructor Documentation

◆ TensorOpCost() [1/3]

EIGEN_DEVICE_FUNC Eigen::TensorOpCost::TensorOpCost ( )
inline
double bytes_loaded_
Definition: TensorCostModel.h:132
double bytes_stored_
Definition: TensorCostModel.h:133
double compute_cycles_
Definition: TensorCostModel.h:134

Referenced by cwiseMax(), and cwiseMin().

◆ TensorOpCost() [2/3]

EIGEN_DEVICE_FUNC Eigen::TensorOpCost::TensorOpCost ( double  bytes_loaded,
double  bytes_stored,
double  compute_cycles 
)
inline
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double bytes_stored() const
Definition: TensorCostModel.h:69
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double bytes_loaded() const
Definition: TensorCostModel.h:68
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double compute_cycles() const
Definition: TensorCostModel.h:70

◆ TensorOpCost() [3/3]

EIGEN_DEVICE_FUNC Eigen::TensorOpCost::TensorOpCost ( double  bytes_loaded,
double  bytes_stored,
double  compute_cycles,
bool  vectorized,
double  packet_size 
)
inline
62  compute_cycles_(vectorized ? compute_cycles / packet_size : compute_cycles) {
66  }
#define eigen_assert(x)
Definition: Macros.h:910
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool() isfinite(const Eigen::bfloat16 &h)
Definition: BFloat16.h:752

References bytes_loaded(), bytes_stored(), compute_cycles(), eigen_assert, and Eigen::numext::isfinite().

Member Function Documentation

◆ AddCost()

template<typename ArgType >
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE int Eigen::TensorOpCost::AddCost ( )
inlinestatic
38  {
39  return internal::functor_traits<internal::scalar_sum_op<ArgType> >::Cost;
40  }

◆ bytes_loaded()

◆ bytes_stored()

◆ CastCost()

template<typename SrcType , typename TargetType >
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE int Eigen::TensorOpCost::CastCost ( )
inlinestatic
50  {
51  return internal::functor_traits<internal::scalar_cast_op<SrcType, TargetType> >::Cost;
52  }

◆ compute_cycles()

◆ cwiseMax()

EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost Eigen::TensorOpCost::cwiseMax ( const TensorOpCost rhs) const
inline
92  {
93  double bytes_loaded = numext::maxi(bytes_loaded_, rhs.bytes_loaded());
94  double bytes_stored = numext::maxi(bytes_stored_, rhs.bytes_stored());
95  double compute_cycles = numext::maxi(compute_cycles_, rhs.compute_cycles());
97  }
EIGEN_DEVICE_FUNC TensorOpCost()
Definition: TensorCostModel.h:54
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T maxi(const T &x, const T &y)
Definition: MathFunctions.h:926

References bytes_loaded(), bytes_loaded_, bytes_stored(), bytes_stored_, compute_cycles(), compute_cycles_, Eigen::numext::maxi(), and TensorOpCost().

Referenced by Eigen::TensorEvaluator< const TensorSelectOp< IfArgType, ThenArgType, ElseArgType >, Device >::costPerCoeff().

◆ cwiseMin()

EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost Eigen::TensorOpCost::cwiseMin ( const TensorOpCost rhs) const
inline
84  {
85  double bytes_loaded = numext::mini(bytes_loaded_, rhs.bytes_loaded());
86  double bytes_stored = numext::mini(bytes_stored_, rhs.bytes_stored());
87  double compute_cycles = numext::mini(compute_cycles_, rhs.compute_cycles());
89  }
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T mini(const T &x, const T &y)
Definition: MathFunctions.h:920

References bytes_loaded(), bytes_loaded_, bytes_stored(), bytes_stored_, compute_cycles(), compute_cycles_, Eigen::numext::mini(), and TensorOpCost().

◆ DivCost()

template<typename ArgType >
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE int Eigen::TensorOpCost::DivCost ( )
inlinestatic
42  {
43  return internal::functor_traits<internal::scalar_quotient_op<ArgType, ArgType> >::Cost;
44  }

◆ dropMemoryCost()

EIGEN_DEVICE_FUNC void Eigen::TensorOpCost::dropMemoryCost ( )
inline
78  {
79  bytes_loaded_ = 0;
80  bytes_stored_ = 0;
81  }

References bytes_loaded_, and bytes_stored_.

◆ ModCost()

template<typename ArgType >
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE int Eigen::TensorOpCost::ModCost ( )
inlinestatic
46  {
47  return internal::functor_traits<internal::scalar_mod_op<ArgType> >::Cost;
48  }

◆ MulCost()

template<typename ArgType >
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE int Eigen::TensorOpCost::MulCost ( )
inlinestatic
34  {
35  return internal::functor_traits<internal::scalar_product_op<ArgType, ArgType> >::Cost;
36  }

◆ operator*=()

EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost& Eigen::TensorOpCost::operator*= ( double  rhs)
inline
106  {
107  bytes_loaded_ *= rhs;
108  bytes_stored_ *= rhs;
109  compute_cycles_ *= rhs;
110  return *this;
111  }

References bytes_loaded_, bytes_stored_, and compute_cycles_.

◆ operator+=()

EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost& Eigen::TensorOpCost::operator+= ( const TensorOpCost rhs)
inline
99  {
100  bytes_loaded_ += rhs.bytes_loaded();
101  bytes_stored_ += rhs.bytes_stored();
102  compute_cycles_ += rhs.compute_cycles();
103  return *this;
104  }

References bytes_loaded(), bytes_loaded_, bytes_stored(), bytes_stored_, compute_cycles(), and compute_cycles_.

◆ total_cost()

EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double Eigen::TensorOpCost::total_cost ( double  load_cost,
double  store_cost,
double  compute_cost 
) const
inline
72  {
73  return load_cost * bytes_loaded_ + store_cost * bytes_stored_ + compute_cost * compute_cycles_;
74  }

References bytes_loaded_, bytes_stored_, and compute_cycles_.

Referenced by Eigen::TensorCostModel< Device >::totalCost().

Friends And Related Function Documentation

◆ operator* [1/2]

EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE friend TensorOpCost operator* ( double  lhs,
TensorOpCost  rhs 
)
friend
121  {
122  rhs *= lhs;
123  return rhs;
124  }

◆ operator* [2/2]

EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE friend TensorOpCost operator* ( TensorOpCost  lhs,
double  rhs 
)
friend
117  {
118  lhs *= rhs;
119  return lhs;
120  }

◆ operator+

EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE friend TensorOpCost operator+ ( TensorOpCost  lhs,
const TensorOpCost rhs 
)
friend
113  {
114  lhs += rhs;
115  return lhs;
116  }

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const TensorOpCost tc 
)
friend
126  {
127  return os << "[bytes_loaded = " << tc.bytes_loaded() << ", bytes_stored = " << tc.bytes_stored()
128  << ", compute_cycles = " << tc.compute_cycles() << "]";
129  }

Member Data Documentation

◆ bytes_loaded_

double Eigen::TensorOpCost::bytes_loaded_
private

◆ bytes_stored_

double Eigen::TensorOpCost::bytes_stored_
private

◆ compute_cycles_

double Eigen::TensorOpCost::compute_cycles_
private

The documentation for this class was generated from the following file: