Eigen::TensorSycl::internal Namespace Reference

Enumerations

enum class  contraction_type {
  local ,
  no_local
}
 
enum class  data_source {
  global_mem ,
  local_mem ,
  private_mem
}
 
enum class  reduction_dim {
  inner_most ,
  outer_most
}
 
enum class  scan_step {
  first ,
  second
}
 

Functions

template<bool is_internal>
bool check_boundary (bool)
 check_boundary: is used to check the edge condition for non-internal blocks. More...
 
template<>
bool check_boundary< false > (bool cond)
 check_boundary: specialization of the check_boundary for non-internal blocks. More...
 
template<bool PacketLoad, bool , bool IsRhs, typename PacketType , typename TensorMapper , typename StorageIndex >
static std::enable_if_t<!PacketLoad, PacketTyperead (const TensorMapper &tensorMapper, const StorageIndex &NCIndex, const StorageIndex &CIndex, const StorageIndex &)
 read, special overload of read function, when the read access is not vectorized More...
 
template<bool PacketLoad, bool is_coalesced_layout, bool , typename PacketType , typename TensorMapper , typename StorageIndex >
static std::enable_if_t< PacketLoad, PacketTyperead (const TensorMapper &tensorMapper, const StorageIndex &NCIndex, const StorageIndex &CIndex, const StorageIndex &ld)
 read, a template function used for loading the data from global memory. This function is used to guarantee coalesced and vectorized load whenever possible More...
 
template<data_source dt, typename PacketType , typename DataScalar >
static std::enable_if_t< Eigen::internal::unpacket_traits< PacketType >::size !=1 &&dt==data_source::global_mem, void > write (PacketType &packet_data, DataScalar *ptr)
 Overloading the write function for storing the data to global memory, when vectorization enabled This function is used to guarantee coalesced and vectorized store whenever possible. More...
 
template<data_source dt, typename PacketType , typename DataScalar >
static std::enable_if_t< Eigen::internal::unpacket_traits< PacketType >::size==1 &&dt==data_source::global_mem, void > write (PacketType &packet_data, DataScalar *ptr)
 Overloading the write function for storing the data to global memory, when vectorization is disabled. More...
 
template<typename StorageIndex , StorageIndex ld, data_source dt, typename PacketType , typename DataScalar >
static std::enable_if_t< dt !=data_source::global_mem, void > write (PacketType &packet_data, DataScalar ptr)
 write, a template function used for storing the data to local memory. This function is used to guarantee coalesced and vectorized store whenever possible. More...
 

Enumeration Type Documentation

◆ contraction_type

◆ data_source

◆ reduction_dim

◆ scan_step

Enumerator
first 
second 

Definition at line 82 of file TensorScanSycl.h.

82 { first, second };
EIGEN_CONSTEXPR Index first(const T &x) EIGEN_NOEXCEPT

Function Documentation

◆ check_boundary()

template<bool is_internal>
bool Eigen::TensorSycl::internal::check_boundary ( bool  )
inline

check_boundary: is used to check the edge condition for non-internal blocks.

Template Parameters
is_internaldetermines if the block is internal

Definition at line 279 of file TensorContractionSycl.h.

279  {
280  return true;
281 }

◆ check_boundary< false >()

template<>
bool Eigen::TensorSycl::internal::check_boundary< false > ( bool  cond)
inline

check_boundary: specialization of the check_boundary for non-internal blocks.

Parameters
condtrue when the data is in range. Otherwise false

Definition at line 289 of file TensorContractionSycl.h.

289  {
290  return cond;
291 }

◆ read() [1/2]

template<bool PacketLoad, bool , bool IsRhs, typename PacketType , typename TensorMapper , typename StorageIndex >
static std::enable_if_t<!PacketLoad, PacketType> Eigen::TensorSycl::internal::read ( const TensorMapper &  tensorMapper,
const StorageIndex &  NCIndex,
const StorageIndex &  CIndex,
const StorageIndex &   
)
inlinestatic

read, special overload of read function, when the read access is not vectorized

Template Parameters
PacketLoaddetermines if the each element of this tensor block should be loaded in a packet mode
Parameters
is_coalesced_layoutdetermines whether or not the Tensor data in a memory can be access coalesced and vectorized when possible. Coalesced memory access is a key factor in Kernel performance. When a tensor is 2d and the contracting dimension is 1, it is always possible to accessed tensor data coalesced and vectorized. This is the case when RHS(right hand side) Tensor is transposed or when LHS(left hand side) Tensor is not transposed.
Template Parameters
PacketTypedetermines the type of packet
TensorMapperdetermines the input tensor mapper type
StorageIndexdetermines the Index type
Parameters
tensorMapperis the input tensor
NCIndexis the non-contracting dim index
CIndexis the contracting dim index

Definition at line 191 of file TensorContractionSycl.h.

192  {
193  const StorageIndex row = (IsRhs) ? CIndex : NCIndex;
194  const StorageIndex col = (IsRhs) ? NCIndex : CIndex;
195  return tensorMapper(row, col);
196 }
RowXpr row(Index i) const
ColXpr col(Index i) const

◆ read() [2/2]

template<bool PacketLoad, bool is_coalesced_layout, bool , typename PacketType , typename TensorMapper , typename StorageIndex >
static std::enable_if_t<PacketLoad, PacketType> Eigen::TensorSycl::internal::read ( const TensorMapper &  tensorMapper,
const StorageIndex &  NCIndex,
const StorageIndex &  CIndex,
const StorageIndex &  ld 
)
inlinestatic

read, a template function used for loading the data from global memory. This function is used to guarantee coalesced and vectorized load whenever possible

Template Parameters
PacketLoaddetermines if the each element of this tensor block should be loaded in a packet mode
Parameters
is_coalesced_layoutdetermines whether or not the Tensor data in a memory can be access coalesced and vectorized when possible. Coalesced memory access is a key factor in Kernel performance. When a tensor is 2d and the contracting dimension is 1, it is always possible to accessed tensor data coalesced and vectorized. This is the case when RHS(right hand side) Tensor is transposed or when LHS(left hand side) Tensor is not transposed.
Template Parameters
PacketTypedetermines the type of packet
TensorMapperdetermines the input tensor mapper type
StorageIndexdetermines the Index type
Parameters
tensorMapperis the input tensor
NCIndexis the non-contracting dim index
CIndexis the contracting dim index
ldis the leading dimension of the flattened tensor

Definition at line 161 of file TensorContractionSycl.h.

162  {
163  const StorageIndex row = (is_coalesced_layout) ? NCIndex : CIndex;
164  const StorageIndex col = (is_coalesced_layout) ? CIndex : NCIndex;
165  return tensorMapper.get_tensor().template packet<Unaligned>(row + (col * ld));
166 }

◆ write() [1/3]

template<data_source dt, typename PacketType , typename DataScalar >
static std::enable_if_t< Eigen::internal::unpacket_traits<PacketType>::size != 1 && dt == data_source::global_mem, void> Eigen::TensorSycl::internal::write ( PacketType packet_data,
DataScalar *  ptr 
)
inlinestatic

Overloading the write function for storing the data to global memory, when vectorization enabled This function is used to guarantee coalesced and vectorized store whenever possible.

Template Parameters
data_sourcean enum value representing if the location of the data in a memory hierarchy.
PacketTypedetermines the type of packet
DataScalardetermines the output data type
Parameters
packet_datathe data to be written in the local memory
ptra pointer to the local memory

Definition at line 249 of file TensorContractionSycl.h.

249  {
250  ::Eigen::internal::pstoreu<DataScalar, PacketType>(ptr, packet_data);
251 }

◆ write() [2/3]

template<data_source dt, typename PacketType , typename DataScalar >
static std::enable_if_t< Eigen::internal::unpacket_traits<PacketType>::size == 1 && dt == data_source::global_mem, void> Eigen::TensorSycl::internal::write ( PacketType packet_data,
DataScalar *  ptr 
)
inlinestatic

Overloading the write function for storing the data to global memory, when vectorization is disabled.

Template Parameters
data_sourcean enum value representing if the location of the data in a memory hierarchy.
PacketTypedetermines the type of packet
DataScalardetermines the output data type
Parameters
packet_datathe data to be written in the local memory
ptra pointer to the local memory

Definition at line 269 of file TensorContractionSycl.h.

269  {
270  *ptr = packet_data;
271 }

◆ write() [3/3]

template<typename StorageIndex , StorageIndex ld, data_source dt, typename PacketType , typename DataScalar >
static std::enable_if_t<dt != data_source::global_mem, void> Eigen::TensorSycl::internal::write ( PacketType packet_data,
DataScalar  ptr 
)
inlinestatic

write, a template function used for storing the data to local memory. This function is used to guarantee coalesced and vectorized store whenever possible.

Template Parameters
StorageIndexdetermines the Index type
Parameters
ldis the leading dimension of the local memory. ld is a compile time value for the local memory
Template Parameters
data_sourcean enum value representing if the location of the data in a memory hierarchy.
PacketTypedetermines the type of packet
DataScalardetermines the output data type
Parameters
packet_datathe data to be written in the local memory
ptra pointer to the local memory
CIndexis the contracting dim index

Definition at line 222 of file TensorContractionSycl.h.

222  {
223  EIGEN_CONSTEXPR int PacketSize = Eigen::internal::unpacket_traits<PacketType>::size;
225  for (int i = 0; i < PacketSize; i++) {
226  *ptr = PacketWrapper<PacketType, PacketSize>::scalarize(i, packet_data);
227  ptr += ld;
228  }
229 }
int i
#define EIGEN_UNROLL_LOOP
#define EIGEN_CONSTEXPR