75 template <
int kAlignment_>
98 template <
typename Element_,
int kElements_,
size_t kAlignment_ = 16>
101 static_assert(kAlignment_ == 16 || kAlignment_ >=
sizeof(Element_),
"Alignment is too small");
116 uint64_t* ptr =
reinterpret_cast<uint64_t*
>(storage);
118 ptr[i] = uint64_t(0);
121 uint32_t* ptr =
reinterpret_cast<uint32_t*
>(storage);
123 ptr[i] = uint32_t(0);
126 uint16_t* ptr =
reinterpret_cast<uint16_t*
>(storage);
128 ptr[i] = uint16_t(0);
139 assert(i < kElements_);
140 return reinterpret_cast<Element*
>(storage)[i];
145 assert(i < kElements_);
146 return reinterpret_cast<Element const*
>(storage)[i];
154 static int const kStorageCount =
169 template <
typename Fragment_,
typename Iterations_,
typename AccessType_>
190 template <
typename OtherFragment_>
197 CUTLASS_DEVICE
AccessType const&
at(
int d,
int h,
int w,
int c = 0)
const {
219 CUTLASS_DEVICE
bool valid(
int d,
int h,
int w,
int c)
const {
return true; }
227 template <
typename Fragment_,
typename Iterations_,
typename AccessType_>
248 template <
typename OtherFragment_>
259 CUTLASS_DEVICE
AccessType const&
at(
int d,
int h,
int w,
int c = 0)
const {
270 CUTLASS_DEVICE
bool valid(
int d,
int h,
int w,
int c)
const {
return true; }
CUTLASS_DEVICE void clear()
Clear a fragment.
Definition: fragment.h:113
CUTLASS_DEVICE Element & operator[](int i)
The accessor.
Definition: fragment.h:138
CUTLASS_DEVICE AccessType & at(int d, int h, int w, int c=0)
The accessor.
Definition: fragment.h:203
Definition: fragment.h:228
CUTLASS_DEVICE AccessType const & operator[](int i) const
The accessor.
Definition: fragment.h:265
Shape< Shape_::kH *Shape_::kW *Shape_::kC, Shape_::kW *Shape_::kC, Shape_::kC, 1 > Shape
Definition: shape.h:155
A template defining Fragment Concept.
Definition: fragment.h:99
Fragment::Element Element
The element.
Definition: fragment.h:181
static int const kElementsPerAccess
The number of elements per access.
Definition: fragment.h:241
Fragment_ Fragment
The fragment.
Definition: fragment.h:174
Fragment_ Fragment
The fragment.
Definition: fragment.h:232
CUTLASS_DEVICE AccessType & operator[](int i)
The accessor.
Definition: fragment.h:214
Fragment::Element Element
The element.
Definition: fragment.h:239
ShapeStrides< FragmentShape >::Shape IterationsStrides
The linear strides for iterations.
Definition: fragment.h:245
CUTLASS_DEVICE bool valid(int d, int h, int w, int c) const
Is the iterator valid?
Definition: fragment.h:270
CUTLASS_DEVICE FragmentIterator(OtherFragment_ &fragment, int offset=0)
Ctor.
Definition: fragment.h:191
Fragment< Element_, kElements_ > This_
Make sure the alignment makes sense wrt the size of elements.
Definition: fragment.h:101
FragmentIterator< Fragment_, Iterations_, AccessType_ > This_
This class.
Definition: fragment.h:172
ShapeMul< Iterations, Shape< 1, 1, 1, kElementsPerAccess > >::Shape FragmentShape
The shape of the the fragment.
Definition: fragment.h:243
Definition: fragment.h:76
uint32_t Type
Definition: fragment.h:81
uint8_t Type
Definition: fragment.h:89
static CUTLASS_DEVICE int get(int d, int h, int w, int c)
Definition: shape.h:211
Element * pointer
The pointer.
Definition: fragment.h:222
AccessType_ AccessType
The access type.
Definition: fragment.h:236
ShapeMul< Iterations, Shape< 1, 1, 1, kElementsPerAccess > >::Shape FragmentShape
The shape of the the fragment.
Definition: fragment.h:185
A template defining Fragment Iterator Concept.
Definition: fragment.h:170
static int const kElements
The number of elements.
Definition: fragment.h:110
CUTLASS_DEVICE Element const & operator[](int i) const
The accessor.
Definition: fragment.h:144
Iterations_ Iterations
The number of iterations.
Definition: fragment.h:234
Iterations_ Iterations
The number of iterations.
Definition: fragment.h:176
A Shape implementing Layout Concept describing the dimensions of a cube.
Definition: shape.h:64
CUTLASS_DEVICE AccessType const & at(int d, int h, int w, int c=0) const
The accessor.
Definition: fragment.h:259
Element_ Element
The element.
Definition: fragment.h:108
FragmentIterator< Fragment_, Iterations_, AccessType_ > This_
This class.
Definition: fragment.h:230
CUTLASS_DEVICE AccessType const & operator[](int i) const
The accessor.
Definition: fragment.h:209
uint16_t Type
Definition: fragment.h:85
Defines a 1D vector of elements held in the registers of each thread.
CUTLASS_DEVICE FragmentConstIterator(FragmentIterator< Fragment_, Iterations_, AccessType_ > const &rhs_)
Create from non-constant FragmentIterator.
Definition: fragment.h:254
static int const kElementsPerAccess
The number of elements per access.
Definition: fragment.h:183
ShapeStrides< FragmentShape >::Shape Strides
The linear strides for iterations.
Definition: fragment.h:187
Defines Shape implementing the Layout concept for representing a 4D hypercube of objects.
AccessType_ AccessType
The access type.
Definition: fragment.h:178
CUTLASS_DEVICE bool valid(int d, int h, int w, int c) const
Is the iterator valid?
Definition: fragment.h:219
uint64_t Type
Definition: fragment.h:77
Definition: cutlass_math.h:45
CUTLASS_DEVICE FragmentConstIterator(OtherFragment_ &fragment, int offset=0)
Ctor.
Definition: fragment.h:249
CUTLASS_DEVICE AccessType const & at(int d, int h, int w, int c=0) const
The accessor.
Definition: fragment.h:197
Element const * pointer
The pointer.
Definition: fragment.h:273