49 template <
typename T,
int N,
bool RegisterSized>
52 sizeof(
typename Array<T, N, RegisterSized>::Storage) * 8 * Array<T, N, RegisterSized>::kStorageElements;
60 return !(x & (x - 1));
78 class Array<T, N, true> {
89 static size_t const kStorageElements = N;
92 static size_t const kElements = N;
157 return ptr_ == other.ptr_;
162 return ptr_ != other.ptr_;
167 class const_iterator {
194 const_iterator ret(*
this);
201 const_iterator ret(*
this);
213 return ptr_ == other.ptr_;
218 return ptr_ != other.ptr_;
223 class reverse_iterator {
269 return ptr_ == other.ptr_;
274 return ptr_ != other.ptr_;
279 class const_reverse_iterator {
306 const_reverse_iterator ret(*
this);
313 const_reverse_iterator ret(*
this);
325 return ptr_ == other.ptr_;
330 return ptr_ != other.ptr_;
347 for (
int i = 0; i < kElements; ++i) {
348 storage[i] = x.storage[i];
359 reference
at(size_type pos) {
360 return reinterpret_cast<reference
>(storage[pos]);
364 const_reference
at(size_type pos)
const {
365 return reinterpret_cast<const_reference
>(storage[pos]);
370 return reinterpret_cast<reference
>(storage[pos]);
375 return reinterpret_cast<const_reference
>(storage[pos]);
380 return reinterpret_cast<reference
>(storage[0]);
385 return reinterpret_cast<const_reference
>(storage[0]);
390 return reinterpret_cast<reference
>(storage[kStorageElements - 1]);
395 return reinterpret_cast<const_reference
>(storage[kStorageElements - 1]);
400 return reinterpret_cast<pointer
>(storage);
405 return reinterpret_cast<const_pointer
>(storage);
410 return reinterpret_cast<pointer
>(storage);
415 return reinterpret_cast<const_pointer
>(storage);
437 for (
int i = 0; i < kElements; ++i) {
444 return iterator(storage);
449 return const_iterator(storage);
454 return iterator(reinterpret_cast<pointer>(storage + kStorageElements));
459 return const_iterator(reinterpret_cast<const_pointer>(storage + kStorageElements));
464 return reverse_iterator(reinterpret_cast<pointer>(storage + kStorageElements));
469 return const_reverse_iterator(reinterpret_cast<const_pointer>(storage + kStorageElements));
474 return reverse_iterator(reinterpret_cast<pointer>(storage));
478 const_reverse_iterator
crend()
const {
479 return const_reverse_iterator(reinterpret_cast<const_pointer>(storage));
value_type * pointer
Definition: array.h:103
CUTLASS_HOST_DEVICE bool operator!=(iterator const &other) const
Definition: array.h:161
CUTLASS_HOST_DEVICE const_reverse_iterator()
Definition: array.h:287
CUTLASS_HOST_DEVICE const_iterator(T const *_ptr)
Definition: array.h:178
CUTLASS_HOST_DEVICE const_iterator()
Definition: array.h:175
CUTLASS_HOST_DEVICE constexpr bool empty() const
Definition: array.h:420
CUTLASS_HOST_DEVICE const_reverse_iterator crbegin() const
Definition: array.h:468
ptrdiff_t difference_type
Definition: array.h:100
CUTLASS_HOST_DEVICE reverse_iterator & operator--()
Definition: array.h:243
Definition: aligned_buffer.h:35
static int const value
Definition: numeric_types.h:43
CUTLASS_HOST_DEVICE const_iterator operator++(int)
Definition: array.h:193
CUTLASS_HOST_DEVICE void fill(T const &value)
Definition: array.h:435
Statically sized array of elements that accommodates all CUTLASS-supported numeric types and is safe ...
CUTLASS_HOST_DEVICE iterator end()
Definition: array.h:453
CUTLASS_HOST_DEVICE pointer data()
Definition: array.h:399
CUTLASS_HOST_DEVICE iterator begin()
Definition: array.h:443
CUTLASS_HOST_DEVICE reverse_iterator rbegin()
Definition: array.h:463
Aligned array type.
Definition: array.h:511
CUTLASS_HOST_DEVICE const_reference operator[](size_type pos) const
Definition: array.h:374
CUTLASS_HOST_DEVICE pointer raw_data()
Definition: array.h:409
CUTLASS_HOST_DEVICE reverse_iterator rend()
Definition: array.h:473
CUTLASS_HOST_DEVICE const_iterator cend() const
Definition: array.h:458
CUTLASS_HOST_DEVICE const_reverse_iterator(T const *_ptr)
Definition: array.h:290
CUTLASS_HOST_DEVICE reverse_iterator operator--(int)
Definition: array.h:256
size_t size_type
Definition: array.h:99
CUTLASS_HOST_DEVICE const_reverse_iterator & operator++()
Definition: array.h:293
CUTLASS_HOST_DEVICE constexpr size_type size() const
Definition: array.h:425
CUTLASS_HOST_DEVICE reference back()
Definition: array.h:389
CUTLASS_HOST_DEVICE bool operator!=(reverse_iterator const &other) const
Definition: array.h:273
CUTLASS_HOST_DEVICE reverse_iterator operator++(int)
Definition: array.h:249
CUTLASS_HOST_DEVICE bool operator!=(const_iterator const &other) const
Definition: array.h:217
CUTLASS_HOST_DEVICE bool operator!=(const_iterator const &other) const
Definition: array.h:329
#define CUTLASS_PRAGMA_UNROLL
Definition: cutlass.h:110
value_type const & const_reference
Definition: array.h:102
CUTLASS_HOST_DEVICE reverse_iterator & operator++()
Definition: array.h:237
CUTLASS_HOST_DEVICE T const & operator*() const
Definition: array.h:207
value_type & reference
Definition: array.h:101
CUTLASS_HOST_DEVICE bool operator==(iterator const &other) const
Definition: array.h:156
CUTLASS_HOST_DEVICE const_reverse_iterator crend() const
Definition: array.h:478
CUTLASS_HOST_DEVICE reverse_iterator()
Definition: array.h:231
CUTLASS_HOST_DEVICE T & operator*() const
Definition: array.h:151
Defines the size of an element in bits.
Definition: numeric_types.h:42
CUTLASS_HOST_DEVICE iterator operator++(int)
Definition: array.h:137
CUTLASS_HOST_DEVICE bool operator==(reverse_iterator const &other) const
Definition: array.h:268
CUTLASS_HOST_DEVICE iterator & operator++()
Definition: array.h:125
T Storage
Storage type.
Definition: array.h:82
CUTLASS_HOST_DEVICE reverse_iterator(T *_ptr)
Definition: array.h:234
CUTLASS_HOST_DEVICE iterator(T *_ptr)
Definition: array.h:122
CUTLASS_HOST_DEVICE const_iterator & operator++()
Definition: array.h:181
CUTLASS_HOST_DEVICE const_reference back() const
Definition: array.h:394
CUTLASS_HOST_DEVICE iterator & operator--()
Definition: array.h:131
CUTLASS_HOST_DEVICE const_reference at(size_type pos) const
Definition: array.h:364
#define CUTLASS_HOST_DEVICE
Definition: cutlass.h:89
Top-level include for all CUTLASS numeric types.
CUTLASS_HOST_DEVICE T & operator*() const
Definition: array.h:263
CUTLASS_HOST_DEVICE bool operator==(const_iterator const &other) const
Definition: array.h:212
CUTLASS_HOST_DEVICE reference front()
Definition: array.h:379
T Element
Element type.
Definition: array.h:85
CUTLASS_HOST_DEVICE const_pointer raw_data() const
Definition: array.h:414
CUTLASS_HOST_DEVICE constexpr size_type max_size() const
Definition: array.h:430
CUTLASS_HOST_DEVICE const_pointer data() const
Definition: array.h:404
CUTLASS_HOST_DEVICE bool operator==(const_iterator const &other) const
Definition: array.h:324
CUTLASS_HOST_DEVICE iterator()
Definition: array.h:119
CUTLASS_HOST_DEVICE constexpr bool ispow2(unsigned x)
Returns true if the argument is a power of 2.
Definition: array.h:59
CUTLASS_HOST_DEVICE Array(Array const &x)
Definition: array.h:345
CUTLASS_HOST_DEVICE iterator operator--(int)
Definition: array.h:144
CUTLASS_HOST_DEVICE constexpr unsigned floor_pow_2(unsigned x)
Returns the largest power of two not greater than the argument.
Definition: array.h:67
CUTLASS_HOST_DEVICE const_reverse_iterator operator--(int)
Definition: array.h:312
value_type const * const_pointer
Definition: array.h:104
CUTLASS_HOST_DEVICE const_reverse_iterator & operator--()
Definition: array.h:299
T value_type
Definition: array.h:98
CUTLASS_HOST_DEVICE reference operator[](size_type pos)
Definition: array.h:369
CUTLASS_HOST_DEVICE const_iterator cbegin() const
Definition: array.h:448
CUTLASS_HOST_DEVICE Array()
Definition: array.h:342
CUTLASS_HOST_DEVICE const_iterator operator--(int)
Definition: array.h:200
CUTLASS_HOST_DEVICE const_reverse_iterator operator++(int)
Definition: array.h:305
Basic include for CUTLASS.
CUTLASS_HOST_DEVICE T const & operator*() const
Definition: array.h:319
CUTLASS_HOST_DEVICE const_reference front() const
Definition: array.h:384
CUTLASS_HOST_DEVICE reference at(size_type pos)
Definition: array.h:359
CUTLASS_HOST_DEVICE const_iterator & operator--()
Definition: array.h:187
CUTLASS_HOST_DEVICE void clear()
Efficient clear method.
Definition: array.h:354