102 int kPredicatesPerByte_ = 4,
104 int kPredicateStart_ = 0>
119 "The offsetted predicates must fit within an actual byte.");
150 int byte_offset = (byte %
sizeof(
Storage));
158 return storageData[word];
164 return storageData[word];
297 bool get() {
return vec_[bit_]; }
305 void set(
bool value =
true) { vec_.
set(bit_, value); }
359 computeStorageOffset(word, bit, idx);
361 return ((storage(word) >> bit) & 1);
367 computeStorageOffset(word, bit, idx);
372 storage(word) = ((storage(word) & disable_mask) | enable_mask);
379 storage(i) = (storage(i) & predicates.storage(i));
388 storage(i) = (storage(i) | predicates.storage(i));
396 for (
int byte = 0; byte <
sizeof(
Storage); ++byte) {
398 mask |= (byte_mask << (byte * 8));
401 for (
int word = 0; word <
kWordCount; ++word) {
402 result |= storage(word);
409 Iterator
begin() {
return Iterator(*
this); }
417 ConstIterator
const_begin()
const {
return ConstIterator(*
this); }
438 template <
typename PredicateVector_,
typename Iterations_>
454 CUTLASS_DEVICE
bool at(
int d,
int h,
int w,
int c)
const {
456 return predicates.at(bit);
460 CUTLASS_DEVICE
void set(
int d,
int h,
int w,
int c,
bool value) {
462 predicates.set(bit, value);
469 template <
typename PredicateVector_,
typename Iterations_>
483 : predicates(predicates_) {}
486 CUTLASS_DEVICE
bool at(
int d,
int h,
int w,
int c)
const {
488 return predicates.at(bit);
CUTLASS_HOST_DEVICE Iterator(PredicateVector &_vec, int _start=0)
Constructs an iterator from a PredicateVector.
Definition: predicate_vector.h:255
CUTLASS_HOST_DEVICE bool operator!=(ConstIterator const &it) const
Returns false if iterators point to the same bit.
Definition: predicate_vector.h:229
CUTLASS_HOST_DEVICE PredicateVector & operator|=(PredicateVector const &predicates)
Computes the union of two identical predicate vectors.
Definition: predicate_vector.h:385
CUTLASS_HOST_DEVICE TrivialIterator & operator++()
Pre-increment.
Definition: predicate_vector.h:324
CUTLASS_HOST_DEVICE bool is_zero() const
Returns true if entire predicate array is zero.
Definition: predicate_vector.h:394
uint32_t Storage
Storage type of individual elements.
Definition: predicate_vector.h:116
CUTLASS_HOST_DEVICE TrivialIterator(PredicateVector const &_vec)
Constructs an iterator from a PredicateVector.
Definition: predicate_vector.h:320
CUTLASS_HOST_DEVICE ConstIterator & operator--()
Pre-decrement.
Definition: predicate_vector.h:202
static int const kBytes
Number of bytes needed.
Definition: predicate_vector.h:125
CUTLASS_DEVICE ConstIterator const_begin() const
Returns a ConstIterator.
Definition: predicate_vector.h:417
CUTLASS_HOST_DEVICE ConstIterator(PredicateVector const &_vec, int _start=0)
Definition: predicate_vector.h:191
CUTLASS_HOST_DEVICE bool at(int idx) const
Accesses a bit within the predicate vector.
Definition: predicate_vector.h:357
CUTLASS_HOST_DEVICE ConstIterator & operator++()
Pre-increment.
Definition: predicate_vector.h:195
PredicateVector_ PredicateVector
The vector of predicates.
Definition: predicate_vector.h:441
CUTLASS_HOST_DEVICE ConstIterator operator++(int)
Post-increment.
Definition: predicate_vector.h:209
CUTLASS_HOST_DEVICE Iterator operator++(int)
Post-increment.
Definition: predicate_vector.h:273
Adapter to enable random access to predicates via logical coordinate within a tile.
Definition: predicate_vector.h:439
CUTLASS_HOST_DEVICE TrivialIterator(Iterator const &it)
Copy constructor.
Definition: predicate_vector.h:316
static CUTLASS_HOST_DEVICE int get(int d, int h, int w, int c)
Definition: shape.h:181
Iterator that always returns true.
Definition: predicate_vector.h:309
CUTLASS_HOST_DEVICE TrivialIterator operator++(int)
Post-increment.
Definition: predicate_vector.h:328
CUTLASS_HOST_DEVICE bool operator==(Iterator const &it) const
Returns true if iterators point to the same bit.
Definition: predicate_vector.h:289
CUTLASS_DEVICE PredicateTileAdapter(PredicateVector &predicates_)
Ctor.
Definition: predicate_vector.h:451
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:454
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:486
CUTLASS_HOST_DEVICE Iterator & operator--()
Pre-decrement.
Definition: predicate_vector.h:266
PredicateVector_ PredicateVector
The vector of predicates.
Definition: predicate_vector.h:472
CUTLASS_HOST_DEVICE PredicateVector & operator &=(PredicateVector const &predicates)
Computes the intersection of two identical predicate vectors.
Definition: predicate_vector.h:376
CUTLASS_HOST_DEVICE Iterator(Iterator const &it)
Copy constructor.
Definition: predicate_vector.h:251
CUTLASS_HOST_DEVICE bool operator[](int idx) const
Accesses a bit within the predicate vector.
Definition: predicate_vector.h:354
CUTLASS_HOST_DEVICE bool operator*() const
Dereferences iterator.
Definition: predicate_vector.h:301
CUTLASS_HOST_DEVICE bool operator*() const
Dereferences iterator.
Definition: predicate_vector.h:332
CUTLASS_HOST_DEVICE void fill(bool value=true)
Fills all predicates with a given value.
Definition: predicate_vector.h:344
static int const kPredicates
Number of bits stored by the PredicateVector.
Definition: predicate_vector.h:107
CUTLASS_DEVICE Iterator end()
Returns an iterator.
Definition: predicate_vector.h:413
#define CUTLASS_ASSERT(x)
Definition: cutlass.h:50
CUTLASS_HOST_DEVICE bool at(int, int, int, int) const
The value at location (d, h, w, c).
Definition: predicate_vector.h:432
#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:110
Statically sized array of bits implementing.
Definition: predicate_vector.h:105
static int const kWordCount
Number of storage elements needed.
Definition: predicate_vector.h:128
CUTLASS_DEVICE ConstIterator const_end() const
Returns a ConstIterator.
Definition: predicate_vector.h:421
Always returns true predicate.
Definition: predicate_vector.h:427
CUTLASS_HOST_DEVICE Iterator & operator++()
Pre-increment.
Definition: predicate_vector.h:259
A const iterator implementing Predicate Iterator Concept enabling sequential read-only access to pred...
Definition: predicate_vector.h:177
CUTLASS_HOST_DEVICE void set(int idx, bool value=true)
Set a bit within the predicate vector.
Definition: predicate_vector.h:365
CUTLASS_HOST_DEVICE bool operator==(ConstIterator const &it) const
Returns true if iterators point to the same bit.
Definition: predicate_vector.h:225
Iterations_ Iterations
The iterations.
Definition: predicate_vector.h:474
Iterations_ Iterations
The iterations.
Definition: predicate_vector.h:443
CUTLASS_HOST_DEVICE bool operator*() const
Dereferences iterator.
Definition: predicate_vector.h:233
CUTLASS_HOST_DEVICE bool operator!=(Iterator const &it) const
Returns false if iterators point to the same bit.
Definition: predicate_vector.h:293
static int const kPredicateStart
First bit withing each byte containing predicates.
Definition: predicate_vector.h:113
CUTLASS_HOST_DEVICE ConstIterator(ConstIterator const &it)
Copy constructor.
Definition: predicate_vector.h:187
CUTLASS_HOST_DEVICE TrivialPredicateTileAdapter()
Ctor.
Definition: predicate_vector.h:429
CUTLASS_HOST_DEVICE ConstIterator operator--(int)
Post-decrement.
Definition: predicate_vector.h:217
Adapter to enable random access to predicates via logical coordinate within a tile.
Definition: predicate_vector.h:470
CUTLASS_DEVICE ConstPredicateTileAdapter(PredicateVector const &predicates_)
Ctor.
Definition: predicate_vector.h:482
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:341
CUTLASS_DEVICE Iterator begin()
Returns an iterator to the start of the bit vector.
Definition: predicate_vector.h:409
Basic include for CUTLASS macros.
An iterator implementing Predicate Iterator Concept enabling sequential read and write access to pred...
Definition: predicate_vector.h:241
CUTLASS_HOST_DEVICE Iterator operator--(int)
Post-decrement.
Definition: predicate_vector.h:281
CUTLASS_HOST_DEVICE TrivialIterator()
Constructor.
Definition: predicate_vector.h:312