31 #if !defined(__CUDACC_RTC__) 103 int kPredicatesPerByte_ = 4,
105 int kPredicateStart_ = 0>
117 static_assert(kPredicatesPerByte <= 8,
"kPredicatesPerByte must fit within an actual byte");
120 "The offsetted predicates must fit within an actual byte.");
126 static int const kBytes = (kPredicates + kPredicatesPerByte - 1) / kPredicatesPerByte;
151 int byte_offset = (byte %
sizeof(
Storage));
159 return storageData[word];
165 return storageData[word];
264 bool get() {
return vec_.
at(bit_); }
268 bool at()
const {
return vec_.
at(bit_); }
276 void set(
bool value =
true) { vec_.
set(bit_, value); }
370 bool get() {
return vec_.
at(bit_); }
374 bool at()
const {
return vec_.
at(bit_); }
418 Storage item = (value ? ~Storage(0) :
Storage(0));
438 storage(i) = ~Storage(0);
448 computeStorageOffset(word, bit, idx);
450 return ((storage(word) >> bit) & 1);
456 computeStorageOffset(word, bit, idx);
458 Storage disable_mask = (~(
Storage(1) << bit));
459 Storage enable_mask = (
Storage(value) << bit);
461 storage(word) = ((storage(word) & disable_mask) | enable_mask);
468 storage(i) = (storage(i) & predicates.storage(i));
477 storage(i) = (storage(i) | predicates.storage(i));
485 for (
int byte = 0; byte <
sizeof(
Storage); ++byte) {
487 mask |= (byte_mask << (byte * 8));
490 for (
int word = 0; word <
kWordCount; ++word) {
491 result |= storage(word);
CUTLASS_HOST_DEVICE PredicateVector & operator|=(PredicateVector const &predicates)
Computes the union of two identical predicate vectors.
Definition: predicate_vector.h:474
CUTLASS_HOST_DEVICE TrivialIterator & operator++()
Pre-increment.
Definition: predicate_vector.h:397
CUTLASS_HOST_DEVICE ConstIterator(PredicateVector const &vec, int _start=0)
Constructs an iterator from a PredicateVector.
Definition: predicate_vector.h:298
Definition: aligned_buffer.h:35
uint32_t Storage
Storage type of individual elements.
Definition: predicate_vector.h:117
CUTLASS_HOST_DEVICE TrivialIterator(PredicateVector const &_vec)
Constructs an iterator from a PredicateVector.
Definition: predicate_vector.h:393
CUTLASS_HOST_DEVICE bool is_zero() const
Returns true if entire predicate array is zero.
Definition: predicate_vector.h:483
CUTLASS_HOST_DEVICE ConstIterator & operator--()
Pre-decrement.
Definition: predicate_vector.h:316
static int const kBytes
Number of bytes needed.
Definition: predicate_vector.h:126
CUTLASS_DEVICE ConstIterator const_end() const
Returns a ConstIterator.
Definition: predicate_vector.h:510
CUTLASS_HOST_DEVICE bool at() const
Gets the bit at the pointed to location.
Definition: predicate_vector.h:374
CUTLASS_HOST_DEVICE ConstIterator & operator++()
Pre-increment.
Definition: predicate_vector.h:302
CUTLASS_HOST_DEVICE void enable()
Sets all predicates to true.
Definition: predicate_vector.h:435
CUTLASS_HOST_DEVICE bool operator==(ConstIterator const &it) const
Returns true if iterators point to the same bit.
Definition: predicate_vector.h:362
CUTLASS_HOST_DEVICE bool operator[](int idx) const
Accesses a bit within the predicate vector.
Definition: predicate_vector.h:443
CUTLASS_HOST_DEVICE bool operator==(Iterator const &it) const
Returns true if iterators point to the same bit.
Definition: predicate_vector.h:256
CUTLASS_HOST_DEVICE bool operator!=(Iterator const &it) const
Returns false if iterators point to the same bit.
Definition: predicate_vector.h:260
CUTLASS_HOST_DEVICE bool at(int idx) const
Accesses a bit within the predicate vector.
Definition: predicate_vector.h:446
CUTLASS_HOST_DEVICE Iterator(PredicateVector &vec, int _start=0)
Constructs an iterator from a PredicateVector.
Definition: predicate_vector.h:192
CUTLASS_HOST_DEVICE ConstIterator operator++(int)
Post-increment.
Definition: predicate_vector.h:330
CUTLASS_HOST_DEVICE Iterator operator++(int)
Post-increment.
Definition: predicate_vector.h:224
CUTLASS_HOST_DEVICE TrivialIterator(Iterator const &it)
Copy constructor.
Definition: predicate_vector.h:389
CUTLASS_HOST_DEVICE bool operator*() const
Dereferences iterator.
Definition: predicate_vector.h:272
Iterator that always returns true.
Definition: predicate_vector.h:382
CUTLASS_HOST_DEVICE TrivialIterator operator++(int)
Post-increment.
Definition: predicate_vector.h:401
CUTLASS_HOST_DEVICE ConstIterator operator+(int offset)
Iterator advances by some amount.
Definition: predicate_vector.h:346
CUTLASS_HOST_DEVICE ConstIterator & operator+=(int offset)
Increment.
Definition: predicate_vector.h:309
#define CUTLASS_PRAGMA_UNROLL
Definition: cutlass.h:110
CUTLASS_DEVICE ConstIterator const_begin() const
Returns a ConstIterator.
Definition: predicate_vector.h:506
CUTLASS_HOST_DEVICE Iterator & operator--()
Pre-decrement.
Definition: predicate_vector.h:210
CUTLASS_HOST_DEVICE Iterator & operator-=(int offset)
Decrement.
Definition: predicate_vector.h:217
CUTLASS_HOST_DEVICE Iterator(Iterator const &it)
Copy constructor.
Definition: predicate_vector.h:188
CUTLASS_HOST_DEVICE ConstIterator operator-(int offset)
Iterator recedes by some amount.
Definition: predicate_vector.h:354
CUTLASS_HOST_DEVICE Iterator operator+(int offset)
Iterator advances by some amount.
Definition: predicate_vector.h:240
CUTLASS_HOST_DEVICE void fill(bool value=true)
Fills all predicates with a given value.
Definition: predicate_vector.h:417
static int const kPredicates
Number of bits stored by the PredicateVector.
Definition: predicate_vector.h:108
CUTLASS_DEVICE Iterator end()
Returns an iterator.
Definition: predicate_vector.h:502
#define CUTLASS_ASSERT(x)
Definition: cutlass.h:92
CUTLASS_HOST_DEVICE Iterator & operator+=(int offset)
Increment.
Definition: predicate_vector.h:203
#define CUTLASS_HOST_DEVICE
Definition: cutlass.h:89
static int const kPredicatesPerByte
Number of bits stored within each byte of the predicate bit vector.
Definition: predicate_vector.h:111
CUTLASS_HOST_DEVICE PredicateVector & operator&=(PredicateVector const &predicates)
Computes the intersection of two identical predicate vectors.
Definition: predicate_vector.h:465
Statically sized array of bits implementing.
Definition: predicate_vector.h:106
static int const kWordCount
Number of storage elements needed.
Definition: predicate_vector.h:129
CUTLASS_HOST_DEVICE bool operator!=(ConstIterator const &it) const
Returns false if iterators point to the same bit.
Definition: predicate_vector.h:366
CUTLASS_HOST_DEVICE bool at() const
Gets the bit at the pointed to location.
Definition: predicate_vector.h:268
CUTLASS_HOST_DEVICE Iterator & operator++()
Pre-increment.
Definition: predicate_vector.h:196
An iterator implementing Predicate Iterator Concept enabling sequential read and write access to pred...
Definition: predicate_vector.h:284
CUTLASS_HOST_DEVICE void set(int idx, bool value=true)
Set a bit within the predicate vector.
Definition: predicate_vector.h:454
CUTLASS_HOST_DEVICE Iterator operator-(int offset)
Iterator recedes by some amount.
Definition: predicate_vector.h:248
static int const kPredicateStart
First bit withing each byte containing predicates.
Definition: predicate_vector.h:114
CUTLASS_HOST_DEVICE ConstIterator(ConstIterator const &it)
Copy constructor.
Definition: predicate_vector.h:294
CUTLASS_HOST_DEVICE bool operator*() const
Dereferences iterator.
Definition: predicate_vector.h:378
CUTLASS_HOST_DEVICE ConstIterator operator--(int)
Post-decrement.
Definition: predicate_vector.h:338
CUTLASS_HOST_DEVICE void clear()
Clears all predicates.
Definition: predicate_vector.h:427
CUTLASS_HOST_DEVICE PredicateVector(bool value=true)
Initialize the predicate vector.
Definition: predicate_vector.h:414
CUTLASS_DEVICE Iterator begin()
Returns an iterator to the start of the bit vector.
Definition: predicate_vector.h:498
Basic include for CUTLASS.
CUTLASS_HOST_DEVICE bool operator*() const
Dereferences iterator.
Definition: predicate_vector.h:405
An iterator implementing Predicate Iterator Concept enabling sequential read and write access to pred...
Definition: predicate_vector.h:178
CUTLASS_HOST_DEVICE Iterator operator--(int)
Post-decrement.
Definition: predicate_vector.h:232
CUTLASS_HOST_DEVICE ConstIterator & operator-=(int offset)
Decrement.
Definition: predicate_vector.h:323
CUTLASS_HOST_DEVICE TrivialIterator()
Constructor.
Definition: predicate_vector.h:385