86     return coord.
dot(stride_);
   105     return stride_[idx] * size[idx];
   162   static int const kRank = Layout::kRank;
   165   using Index = 
typename Layout::Index;
   183     typename platform::remove_const<Element>::type,
   189   static_assert(kRank > 0, 
"Cannot define a zero-rank TensorRef");
   211     ptr_(ptr), layout_(layout) {
   220     ptr_(ref.data()), layout_(ref.layout()) { }
   230     return NonConstTensorRef(
const_cast<typename platform::remove_const<Element>::type *
>(ptr_), layout_);
   249     return ptr_ != 
nullptr;
   260                             (sizeof_bits<Element>::value < 8)>::
get(ptr_, idx);
   278     return layout_.stride();
   284     return layout_.stride();
   290     return layout_.stride().at(dim);
   296     return layout_.stride().at(dim);
   302     return layout_(coord);
   308     return data(offset(coord));
   314     return data(offset(coord));
   327     add_pointer_offset(offset(coord));
   357     add_pointer_offset(-offset(b));
   384   int const kStrideRank = Layout::kStrideRank;
   386   if (reinterpret_cast<uintptr_t>(ref.
data()) % alignment) {
   392     if (ref.
stride(i) % alignment) {
 CUTLASS_HOST_DEVICE Stride stride() const 
Returns the stride of the layout. 
Definition: tensor_ref.h:91
Definition: aligned_buffer.h:35
CUTLASS_HOST_DEVICE LongIndex operator()(Coord< Rank > const &coord) const 
Returns the offset of a coordinate in linear memory. 
Definition: tensor_ref.h:85
CUTLASS_HOST_DEVICE Index stride(int dim) const
Returns the layout object's stride in a given physical dimension. 
Definition: tensor_ref.h:289
typename Layout::Stride Stride
Layout's stride vector. 
Definition: tensor_ref.h:174
CUTLASS_HOST_DEVICE Index & stride(int dim)
Returns the layout object's stride in a given physical dimension. 
Definition: tensor_ref.h:295
CUTLASS_HOST_DEVICE Stride & stride()
Returns the layout object's stride vector. 
Definition: tensor_ref.h:283
Definition: tensor_ref.h:45
CUTLASS_HOST_DEVICE Element * data() const
Returns the pointer to referenced data. 
Definition: tensor_ref.h:254
Coord< kStrideRank, Index > Stride
Stride vector. 
Definition: tensor_ref.h:63
CUTLASS_HOST_DEVICE ConstTensorRef const_ref() const
Returns a reference to constant-valued tensor. 
Definition: tensor_ref.h:224
int32_t Index
Index type used for coordinates. 
Definition: tensor_ref.h:54
A Coord is a coordinate of arbitrary rank into a tensor or matrix. 
Layout Layout
Mapping function from logical coordinate to linear memory. 
Definition: tensor_ref.h:152
CUTLASS_HOST_DEVICE Stride & stride()
Returns the stride of the layout. 
Definition: tensor_ref.h:97
CUTLASS_HOST_DEVICE void reset(Element *ptr, Layout const &layout)
Updates the pointer and layout object. 
Definition: tensor_ref.h:241
CUTLASS_HOST_DEVICE TensorRef & operator-=(TensorCoord const &b)
Returns a TensorRef offset by a given amount. 
Definition: tensor_ref.h:356
CUTLASS_HOST_DEVICE Reference operator[](TensorCoord const &coord) const
Returns a reference to the element at a given Coord. 
Definition: tensor_ref.h:313
CUTLASS_HOST_DEVICE TensorRef(Element *ptr=nullptr, Layout const &layout=Layout())
Constructs a TensorRef with a pointer and layout object. 
Definition: tensor_ref.h:207
CUTLASS_HOST_DEVICE Layout layout() const
Returns the layout object. 
Definition: tensor_ref.h:271
CUTLASS_HOST_DEVICE TensorRef & add_coord_offset(TensorCoord const &coord)
Adds an offset to each pointer. 
Definition: tensor_ref.h:326
Element Element
Data type of individual access. 
Definition: tensor_ref.h:149
#define CUTLASS_PRAGMA_UNROLL
Definition: cutlass.h:110
CUTLASS_HOST_DEVICE Reference data(LongIndex idx) const
Returns a reference to the element at a given linear index. 
Definition: tensor_ref.h:258
CUTLASS_HOST_DEVICE TensorRef operator-(TensorCoord const &b) const
Returns a TensorRef offset by a given amount. 
Definition: tensor_ref.h:348
CUTLASS_HOST_DEVICE TensorRef(NonConstTensorRef const &ref)
Converting constructor from TensorRef to non-constant data. 
Definition: tensor_ref.h:217
CUTLASS_HOST_DEVICE Stride stride() const
Returns the layout object's stride vector. 
Definition: tensor_ref.h:277
typename Layout::TensorCoord TensorCoord
Coordinate in logical tensor space. 
Definition: tensor_ref.h:171
CUTLASS_HOST_DEVICE bool good() const
Returns true if the TensorRef is non-null. 
Definition: tensor_ref.h:248
Defines the size of an element in bits. 
Definition: numeric_types.h:42
CUTLASS_HOST_DEVICE void reset(Element *ptr=nullptr)
Updates only the pointer. 
Definition: tensor_ref.h:235
Definition: subbyte_reference.h:557
Definition: tensor_ref.h:146
typename platform::conditional< sizeof_bits< Element >::value >=8, Element &, SubbyteReference< Element > >::type Reference
Reference type to an element. 
Definition: tensor_ref.h:159
#define CUTLASS_HOST_DEVICE
Definition: cutlass.h:89
CUTLASS_HOST_DEVICE LongIndex offset(TensorCoord const &coord) const
Computes the offset of an index from the origin of the tensor. 
Definition: tensor_ref.h:301
static int const kRank
Logical rank of tensor. 
Definition: tensor_ref.h:48
CUTLASS_HOST_DEVICE NonConstTensorRef non_const_ref() const
Definition: tensor_ref.h:229
Statically-sized array specifying Coords within a tensor. 
Definition: coord.h:43
int64_t LongIndex
Long index type used for offsets. 
Definition: tensor_ref.h:57
CUTLASS_HOST_DEVICE TensorRef< Element, Layout > make_TensorRef(Element *ptr, Layout const &layout)
Constructs a TensorRef, deducing types from arguments. 
Definition: tensor_ref.h:368
typename Layout::Index Index
Index type. 
Definition: tensor_ref.h:165
CUTLASS_HOST_DEVICE IdentityTensorLayout(Stride const &stride=Stride())
Definition: tensor_ref.h:81
CUTLASS_HOST_DEVICE Reference at(TensorCoord const &coord) const
Returns a reference to the element at a given Coord. 
Definition: tensor_ref.h:307
Definition: subbyte_reference.h:294
CUTLASS_HOST_DEVICE Layout & layout()
Returns the layout object. 
Definition: tensor_ref.h:265
bool TensorRef_aligned(TensorRef< Element, Layout > const &ref, int alignment)
Definition: tensor_ref.h:382
CUTLASS_HOST_DEVICE TensorRef operator+(TensorCoord const &b) const
Returns a TensorRef offset by a given amount. 
Definition: tensor_ref.h:333
CUTLASS_HOST_DEVICE TensorRef & operator+=(TensorCoord const &b)
Returns a TensorRef offset by a given amount. 
Definition: tensor_ref.h:341
CUTLASS_HOST_DEVICE TensorRef & add_pointer_offset(LongIndex offset_)
Adds an offset to each pointer. 
Definition: tensor_ref.h:319
Provides a mechanism for packing and unpacking elements smaller than one byte. 
static int const kStrideRank
Rank of stride vector. 
Definition: tensor_ref.h:51
CUTLASS_HOST_DEVICE LongIndex dot(Coord const &b, LongIndex sum=LongIndex(0)) const 
Computes the dot product with anotherCoord object. 
Definition: coord.h:246
CUTLASS_HOST_DEVICE int max_dim_index() const 
Returns the index of the dimension with greatest value. 
Definition: coord.h:130
Basic include for CUTLASS. 
typename Layout::LongIndex LongIndex
Long index used for pointer offsets. 
Definition: tensor_ref.h:168
CUTLASS_HOST_DEVICE LongIndex capacity(TensorCoord const &size) const 
Compute the number of contiguous elements needed to store a tensor with the given size...
Definition: tensor_ref.h:103