41 template <
typename Storage_,
int Rank_>
48 static int const Rank = Rank_;
85 for (
int i = 0; i <
Rank - 1; ++i) {
88 converted_stride[
Rank - 1] = stride_[
Rank - 1];
95 bool good()
const {
return ptr_ !=
nullptr; }
107 int const&
stride(
int dim)
const {
return stride_.
at(dim); }
116 return stride_.template dot<long long>(coord);
CUTLASS_HOST_DEVICE int const & stride(int dim) const
Returns the stride of the tensor in the given dimension.
Definition: tensor_ref.h:107
Storage & operator[](int idx) const
Element-wise accessor.
Definition: tensor_ref.h:131
CUTLASS_HOST_DEVICE Storage & at(Coord< Rank > const &coord) const
Returns a reference to the element at a given Coord.
Definition: tensor_ref.h:121
CUTLASS_HOST_DEVICE TensorRef & advance(Coord< Rank > const &b)
Adds an offset to the pointer.
Definition: tensor_ref.h:135
static int const Rank
Rank of tensor.
Definition: tensor_ref.h:48
CUTLASS_HOST_DEVICE TensorRef operator+(Coord< Rank > const &b) const
Returns a TensorRef offset by a given amount.
Definition: tensor_ref.h:142
A Coord is a coordinate of arbitrary rank into a tensor or matrix.
Storage_ Storage
Data type of individual access.
Definition: tensor_ref.h:45
CUTLASS_HOST_DEVICE TensorRef operator-(Coord< Rank > const &b) const
Returns a TensorRef offset by a given amount.
Definition: tensor_ref.h:146
CUTLASS_HOST_DEVICE int leading_dim() const
Returns the maximum stride element as the 'leading dimension'.
Definition: tensor_ref.h:111
CUTLASS_HOST_DEVICE Storage * data() const
Returns the pointer to referenced data.
Definition: tensor_ref.h:99
CUTLASS_HOST_DEVICE TensorRef(Storage *ptr, Coord< Rank > stride)
Constructs from a pointer, size, and stride.
Definition: tensor_ref.h:72
Storage & operator[](Coord< Rank > const &coord) const
Element-wise accessor.
Definition: tensor_ref.h:124
CUTLASS_HOST_DEVICE long long offset(Coord< Rank > const &coord) const
Computes the offset of an index from the origin of the tensor.
Definition: tensor_ref.h:115
Structure modeling a pointer and stride into a tensor.
Definition: tensor_ref.h:42
TensorRef< T, Rank > convert()
Conversion function.
Definition: tensor_ref.h:83
#define CUTLASS_HOST_DEVICE
Definition: cutlass.h:46
CUTLASS_HOST_DEVICE bool good() const
Returns true if the TensorRef may be safely accessed.
Definition: tensor_ref.h:95
Defines a 1D vector of elements held in the registers of each thread.
CUTLASS_HOST_DEVICE void reset(Storage *ptr=nullptr, Coord< Rank > stride=Coord< Rank >(0))
Updates the pointer, stride, and location within a TensorRef.
Definition: tensor_ref.h:76
CUTLASS_HOST_DEVICE int & at()
Gets the index of a given Coord element.
Definition: coord.h:185
CUTLASS_HOST_DEVICE Coord< Rank > const & stride() const
Returns the stride of the tensor.
Definition: tensor_ref.h:103
Basic include for CUTLASS macros.
CUTLASS_HOST_DEVICE Storage & at(int idx) const
Returns a reference to the element at a given Coord.
Definition: tensor_ref.h:128
CUTLASS_HOST_DEVICE TensorRef()
Default ctor.
Definition: tensor_ref.h:68
Returns the extent of a scalar or vector.
Definition: vector.h:161