Eigen::internal::TensorBlockDescriptor< NumDims, IndexType >::DestinationBuffer Class Reference

#include <TensorBlock.h>

Public Types

enum  DestinationBufferKind : int { kEmpty , kContiguous , kStrided }
 

Public Member Functions

template<typename Scalar >
Scalardata () const
 
const Dimensionsstrides () const
 
const DestinationBufferKindkind () const
 

Private Member Functions

 DestinationBuffer ()
 
template<typename Scalar >
 DestinationBuffer (Scalar *data, const Dimensions &strides, DestinationBufferKind kind)
 

Static Private Member Functions

template<int Layout, typename Scalar >
static DestinationBuffer make (const TensorBlockDescriptor &desc, Scalar *data, const Dimensions &strides)
 
template<int Layout>
static DestinationBufferKind kind (const TensorBlockDescriptor &desc, const Dimensions &strides)
 

Private Attributes

void * m_data
 
size_t m_data_type_size
 
Dimensions m_strides
 
DestinationBufferKind m_kind
 

Friends

class TensorBlockDescriptor< NumDims, IndexType >
 

Member Enumeration Documentation

◆ DestinationBufferKind

template<int NumDims, typename IndexType = Eigen::Index>
enum Eigen::internal::TensorBlockDescriptor::DestinationBuffer::DestinationBufferKind : int
Enumerator
kEmpty 
kContiguous 
kStrided 
187  : int {
188  // The above explicit specification of "int" as the enum basetype is
189  // needed to get around a HIPCC link error ("the field type is not
190  // amp-compatible")
191  // which is issued for class members with the enum type.
192  // TODO(rocm):
193  // remove the "int" basetype once HIPCC has been fixed to not error out
194  // in the above scenario.
195 
196  // Destination buffer is not defined (`m_data` == nullptr).
197  kEmpty,
198 
199  // Tensor block defined by an owning tensor block descriptor can fit
200  // contiguously into the destination buffer. In this case it's safe to
201  // materialize tensor block in the destination buffer, wrap it in a
202  // TensorMap, and use to build Eigen expression on top of it.
203  kContiguous,
204 
205  // Destination buffer strides do not match strides of the contiguously
206  // stored block, and it's impossible to define a TensorMap over this
207  // buffer. However if we are evaluating a root of an expression tree, we
208  // still can materialize an output into this destination, because we can
209  // guarantee that no one will ever access it through block API.
210  //
211  // In theory it is possible to build valid TensorStriding<TensorMap>
212  // expression on top of this destination buffer, however it has
213  // inefficient coeff/packet access, and defeats the purpose of fast block
214  // evaluation API.
215  kStrided
216  };

Constructor & Destructor Documentation

◆ DestinationBuffer() [1/2]

template<int NumDims, typename IndexType = Eigen::Index>
Eigen::internal::TensorBlockDescriptor< NumDims, IndexType >::DestinationBuffer::DestinationBuffer ( )
inlineprivate

◆ DestinationBuffer() [2/2]

template<int NumDims, typename IndexType = Eigen::Index>
template<typename Scalar >
Eigen::internal::TensorBlockDescriptor< NumDims, IndexType >::DestinationBuffer::DestinationBuffer ( Scalar data,
const Dimensions strides,
DestinationBufferKind  kind 
)
inlineprivate
234  : m_data(static_cast<void*>(data)), m_data_type_size(sizeof(Scalar)), m_strides(strides), m_kind(kind) {}
SCALAR Scalar
Definition: bench_gemm.cpp:45
Dimensions m_strides
Definition: TensorBlock.h:259
const DestinationBufferKind & kind() const
Definition: TensorBlock.h:225
const Dimensions & strides() const
Definition: TensorBlock.h:224
Scalar * data() const
Definition: TensorBlock.h:219

Member Function Documentation

◆ data()

◆ kind() [1/2]

◆ kind() [2/2]

template<int NumDims, typename IndexType = Eigen::Index>
template<int Layout>
static DestinationBufferKind Eigen::internal::TensorBlockDescriptor< NumDims, IndexType >::DestinationBuffer::kind ( const TensorBlockDescriptor desc,
const Dimensions strides 
)
inlinestaticprivate
242  {
243  const Dimensions& desc_dims = desc.dimensions();
244  const Dimensions& desc_strides = internal::strides<Layout>(desc_dims);
245  for (int i = 0; i < NumDims; ++i) {
246  if (desc_dims[i] == 1) continue;
247  if (desc_strides[i] != strides[i]) return kStrided;
248  }
249  return kContiguous;
250  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
DSizes< IndexType, NumDims > Dimensions
Definition: TensorBlock.h:173

References Eigen::internal::TensorBlockDescriptor< NumDims, IndexType >::dimensions(), i, Eigen::internal::TensorBlockDescriptor< NumDims, IndexType >::DestinationBuffer::kContiguous, Eigen::internal::TensorBlockDescriptor< NumDims, IndexType >::DestinationBuffer::kStrided, and Eigen::internal::TensorBlockDescriptor< NumDims, IndexType >::DestinationBuffer::strides().

◆ make()

◆ strides()

Friends And Related Function Documentation

◆ TensorBlockDescriptor< NumDims, IndexType >

template<int NumDims, typename IndexType = Eigen::Index>
friend class TensorBlockDescriptor< NumDims, IndexType >
friend

Member Data Documentation

◆ m_data

template<int NumDims, typename IndexType = Eigen::Index>
void* Eigen::internal::TensorBlockDescriptor< NumDims, IndexType >::DestinationBuffer::m_data
private

◆ m_data_type_size

template<int NumDims, typename IndexType = Eigen::Index>
size_t Eigen::internal::TensorBlockDescriptor< NumDims, IndexType >::DestinationBuffer::m_data_type_size
private

◆ m_kind

◆ m_strides

template<int NumDims, typename IndexType = Eigen::Index>
Dimensions Eigen::internal::TensorBlockDescriptor< NumDims, IndexType >::DestinationBuffer::m_strides
private

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