AI Engine API User Guide (AIE) 2022.2
Vector and Accumulator Initialization

On construction, the contents of a vector are undefined.

Definition: aie_declaration.hpp:68

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 >
Definition: aie.hpp:2816

A vector can also be read from memory using the aie::load_v operation or iterators. See Memory for more details.

aie::vector<int16, 16> v = aie::load_v<16>(ptr);

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; // i-th element is updated

Or by writing subvectors.

v.insert(0, v1); // This updates elements 0-7
v.insert(1, v2); // This updates elements 8-15

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))>
Definition: aie.hpp:1075

Accumulators support all the aforementioned vector operations but the individual element update.

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.

aie::vector<int16, 8> v = readincr_v<8>(input_stream);
aie::accum<acc48, 8> acc = readincr_v<8>(input_cascade);
Definition: aie_declaration.hpp:71