AI Engine API User Guide (AIE) 2021.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.

aie::vectorv = aie::add(v1, v2);
auto add(const Vec1 &v1, const Vec2 &v2) -> aie_dm_resource_remove_t< Vec1 >
Definition:aie.hpp:2455

A vector can also be read from memory using theaie::load_voperation or iterators. SeeMemoryfor more details.

aie::vectorv = aie::load_v<16>(ptr);

Sections of a vector can be modified independently. It can be done in a per-element basis.

for( unsignedi = 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.

aie::vectorv = aie::concat(v1, v2);
auto concat(const Acc &acc, const Accums &...accums) -> accum< typename Acc::value_type, Acc::size() *(1+sizeof...(Accums))>
Definition:aie.hpp:803

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. SeeInteroperability with Adaptive Data Flow (ADF) Graph Abstractionsfor more details.

aie::vectorv = readincr_v<8>(input_stream);
aie::accumacc = readincr_v<8>(input_cascade);
Definition:aie_declaration.hpp:71