101 int kPredicatesPerByte_ = 4,
103 int kPredicateStart_ = 0>
118 "The offsetted predicates must fit within an actual byte.");
149 int byte_offset = (byte %
sizeof(
Storage));
157 return storageData[word];
163 return storageData[word];
296 bool get() {
return vec_[bit_]; }
304 void set(
bool value =
true) { vec_.
set(bit_, value); }
358 computeStorageOffset(word, bit, idx);
360 return ((storage(word) >> bit) & 1);
366 computeStorageOffset(word, bit, idx);
371 storage(word) = ((storage(word) & disable_mask) | enable_mask);
378 storage(i) = (storage(i) & predicates.storage(i));
387 storage(i) = (storage(i) | predicates.storage(i));
395 for (
int byte = 0; byte <
sizeof(
Storage); ++byte) {
397 mask |= (byte_mask << (byte * 8));
400 for (
int word = 0; word <
kWordCount; ++word) {
401 result |= storage(word);
408 Iterator
begin() {
return Iterator(*
this); }
416 ConstIterator
const_begin()
const {
return ConstIterator(*
this); }
437 template <
typename PredicateVector_,
typename Iterations_>
453 CUTLASS_DEVICE
bool at(
int d,
int h,
int w,
int c)
const {
455 return predicates.at(bit);
459 CUTLASS_DEVICE
void set(
int d,
int h,
int w,
int c,
bool value) {
461 predicates.set(bit, value);
468 template <
typename PredicateVector_,
typename Iterations_>
482 : predicates(predicates_) {}
485 CUTLASS_DEVICE
bool at(
int d,
int h,
int w,
int c)
const {
487 return predicates.at(bit);
CUTLASS_HOST_DEVICE Iterator(PredicateVector &_vec, int _start=0)
Constructs an iterator from a PredicateVector.
Definition: predicate_vector.h:254
CUTLASS_HOST_DEVICE bool operator!=(ConstIterator const &it) const
Returns false if iterators point to the same bit.
Definition: predicate_vector.h:228
CUTLASS_HOST_DEVICE PredicateVector & operator|=(PredicateVector const &predicates)
Computes the union of two identical predicate vectors.
Definition: predicate_vector.h:384
CUTLASS_HOST_DEVICE TrivialIterator & operator++()
Pre-increment.
Definition: predicate_vector.h:323
CUTLASS_HOST_DEVICE bool is_zero() const
Returns true if entire predicate array is zero.
Definition: predicate_vector.h:393
uint32_t Storage
Storage type of individual elements.
Definition: predicate_vector.h:115
CUTLASS_HOST_DEVICE TrivialIterator(PredicateVector const &_vec)
Constructs an iterator from a PredicateVector.
Definition: predicate_vector.h:319
CUTLASS_HOST_DEVICE ConstIterator & operator--()
Pre-decrement.
Definition: predicate_vector.h:201
static int const kBytes
Number of bytes needed.
Definition: predicate_vector.h:124
CUTLASS_DEVICE ConstIterator const_begin() const
Returns a ConstIterator.
Definition: predicate_vector.h:416
CUTLASS_HOST_DEVICE ConstIterator(PredicateVector const &_vec, int _start=0)
Definition: predicate_vector.h:190
CUTLASS_HOST_DEVICE bool at(int idx) const
Accesses a bit within the predicate vector.
Definition: predicate_vector.h:356
CUTLASS_HOST_DEVICE ConstIterator & operator++()
Pre-increment.
Definition: predicate_vector.h:194
PredicateVector_ PredicateVector
The vector of predicates.
Definition: predicate_vector.h:440
static CUTLASS_DEVICE int get(int d, int h, int w, int c)
Definition: shape.h:166
CUTLASS_HOST_DEVICE ConstIterator operator++(int)
Post-increment.
Definition: predicate_vector.h:208
CUTLASS_HOST_DEVICE Iterator operator++(int)
Post-increment.
Definition: predicate_vector.h:272
Adapter to enable random access to predicates via logical coordinate within a tile.
Definition: predicate_vector.h:438
CUTLASS_HOST_DEVICE TrivialIterator(Iterator const &it)
Copy constructor.
Definition: predicate_vector.h:315
Iterator that always returns true.
Definition: predicate_vector.h:308
CUTLASS_HOST_DEVICE TrivialIterator operator++(int)
Post-increment.
Definition: predicate_vector.h:327
CUTLASS_HOST_DEVICE bool operator==(Iterator const &it) const
Returns true if iterators point to the same bit.
Definition: predicate_vector.h:288
CUTLASS_DEVICE PredicateTileAdapter(PredicateVector &predicates_)
Ctor.
Definition: predicate_vector.h:450
CUTLASS_DEVICE bool at(int d, int h, int w, int c) const
Get the value at location (d, h, w, c).
Definition: predicate_vector.h:453
#define CUTLASS_PRAGMA_UNROLL
Definition: cutlass.h:60
CUTLASS_DEVICE bool at(int d, int h, int w, int c) const
Get the value at location (d, h, w, c).
Definition: predicate_vector.h:485
CUTLASS_HOST_DEVICE Iterator & operator--()
Pre-decrement.
Definition: predicate_vector.h:265
PredicateVector_ PredicateVector
The vector of predicates.
Definition: predicate_vector.h:471
CUTLASS_HOST_DEVICE PredicateVector & operator &=(PredicateVector const &predicates)
Computes the intersection of two identical predicate vectors.
Definition: predicate_vector.h:375
CUTLASS_HOST_DEVICE Iterator(Iterator const &it)
Copy constructor.
Definition: predicate_vector.h:250
CUTLASS_HOST_DEVICE bool operator[](int idx) const
Accesses a bit within the predicate vector.
Definition: predicate_vector.h:353
CUTLASS_HOST_DEVICE bool operator*() const
Dereferences iterator.
Definition: predicate_vector.h:300
CUTLASS_HOST_DEVICE bool operator*() const
Dereferences iterator.
Definition: predicate_vector.h:331
CUTLASS_HOST_DEVICE void fill(bool value=true)
Fills all predicates with a given value.
Definition: predicate_vector.h:343
static int const kPredicates
Number of bits stored by the PredicateVector.
Definition: predicate_vector.h:106
CUTLASS_DEVICE Iterator end()
Returns an iterator.
Definition: predicate_vector.h:412
#define CUTLASS_ASSERT(x)
Definition: cutlass.h:64
CUTLASS_HOST_DEVICE bool at(int, int, int, int) const
The value at location (d, h, w, c).
Definition: predicate_vector.h:431
#define CUTLASS_HOST_DEVICE
Definition: cutlass.h:46
static int const kPredicatesPerByte
Number of bits stored within each byte of the predicate bit vector.
Definition: predicate_vector.h:109
Statically sized array of bits implementing.
Definition: predicate_vector.h:104
static int const kWordCount
Number of storage elements needed.
Definition: predicate_vector.h:127
CUTLASS_DEVICE ConstIterator const_end() const
Returns a ConstIterator.
Definition: predicate_vector.h:420
Always returns true predicate.
Definition: predicate_vector.h:426
CUTLASS_HOST_DEVICE Iterator & operator++()
Pre-increment.
Definition: predicate_vector.h:258
A const iterator implementing Predicate Iterator Concept enabling sequential read-only access to pred...
Definition: predicate_vector.h:176
CUTLASS_HOST_DEVICE void set(int idx, bool value=true)
Set a bit within the predicate vector.
Definition: predicate_vector.h:364
CUTLASS_HOST_DEVICE bool operator==(ConstIterator const &it) const
Returns true if iterators point to the same bit.
Definition: predicate_vector.h:224
Iterations_ Iterations
The iterations.
Definition: predicate_vector.h:473
Iterations_ Iterations
The iterations.
Definition: predicate_vector.h:442
CUTLASS_HOST_DEVICE bool operator*() const
Dereferences iterator.
Definition: predicate_vector.h:232
CUTLASS_HOST_DEVICE bool operator!=(Iterator const &it) const
Returns false if iterators point to the same bit.
Definition: predicate_vector.h:292
static int const kPredicateStart
First bit withing each byte containing predicates.
Definition: predicate_vector.h:112
CUTLASS_HOST_DEVICE ConstIterator(ConstIterator const &it)
Copy constructor.
Definition: predicate_vector.h:186
CUTLASS_HOST_DEVICE TrivialPredicateTileAdapter()
Ctor.
Definition: predicate_vector.h:428
CUTLASS_HOST_DEVICE ConstIterator operator--(int)
Post-decrement.
Definition: predicate_vector.h:216
Adapter to enable random access to predicates via logical coordinate within a tile.
Definition: predicate_vector.h:469
CUTLASS_DEVICE ConstPredicateTileAdapter(PredicateVector const &predicates_)
Ctor.
Definition: predicate_vector.h:481
Defines Shape implementing the Layout concept for representing a 4D hypercube of objects.
CUTLASS_HOST_DEVICE PredicateVector(bool value=true)
Initialize the predicate vector.
Definition: predicate_vector.h:340
CUTLASS_DEVICE Iterator begin()
Returns an iterator to the start of the bit vector.
Definition: predicate_vector.h:408
Basic include for CUTLASS macros.
An iterator implementing Predicate Iterator Concept enabling sequential read and write access to pred...
Definition: predicate_vector.h:240
CUTLASS_HOST_DEVICE Iterator operator--(int)
Post-decrement.
Definition: predicate_vector.h:280
CUTLASS_HOST_DEVICE TrivialIterator()
Constructor.
Definition: predicate_vector.h:311