Vector Initialization
On construction, the contents of a vector are undefined.
Type for vector registers.
Definition vector.hpp:107
The simplest way of initializing a vector is from another vector of the same type and size.
Or as the result of an operation.
auto add(const Vec1 &v1, const Vec2 &v2) -> aie_dm_resource_remove_t< Vec1 >
Returns a vector with the element-wise addition of the two input vectors.
Definition aie.hpp:3070
A vector can also be read from memory using the aie::load_v operation or iterators. See Memory for more details.
Sections of a vector can be modified independently. It can be done in a per-element basis.
for (
unsigned i = 0; i < v.
size(); ++i)
v[i] = i;
static constexpr unsigned size()
Returns the number of elements in the vector.
Definition vector.hpp:136
Or by writing subvectors.
vector & insert(unsigned idx, const vector< T, ElemsIn > &v)
Updates the contents of a region of the vector.
Definition vector.hpp:392
Vectors can also be concatenated into a larger vector.
auto concat(const Acc &acc, const Accums &...accums) -> accum< typename Acc::value_type, Acc::size() *(1+sizeof...(Accums))>
Concatenate the contents of all input accumulators into a larger accumulator.
Definition aie.hpp:1079
Accumulator Initialization
Accumulators support all the aforementioned vector operations but the individual element update.
Initialization by Stream Read
Both vectors and accumulators can also be read from ADF abstractions such as windows and streams. See Interoperability with Adaptive Data Flow (ADF) Graph Abstractions for more details.
Type for vector accumulators.
Definition accum.hpp:84
Mask Initialization
Masks are usually initialized as a result of a comparison using vectors:
Type for vector element masks.
Definition mask.hpp:61
mask< Vec1::size()> lt(const Vec1 &v1, const Vec2 &v2)
Compares the elements of the two input vectors and returns a mask that says what elements from the fi...
Definition aie.hpp:1237
In addition, it is possible to initialize a mask using a constant value. For example:
static constexpr mask< Elems > from_uint64(uint64_t w, T &&... words)
Construct from unsigned (64b) words.
Definition mask.hpp:214
static constexpr mask< Elems > from_uint32(unsigned w, T &&... words)
Construct from unsigned (32b) words.
Definition mask.hpp:194
- Tip:
- You can use the standard C/C++ macros for fixed-sized integers instead of the integer suffix. In the definition of
m1
it would look like UINT64_C(0xaaaabbbbccccdddd)
.