Vectorization — HLS
The HLS side is how a DataArray lowers to synthesizable Vitis C++: the packing factor pf and
lanes, the canonical lane loop (read_array_lane / read_array_slice), and the storage modes.
These pages cover the three modes — raw (a flat C array, explicit per-cycle control),
struct (a generated wrapper type), and complex (complex elements) —
each over a local array.
Moving a whole array to and from words — over a memory buffer, a FIFO, or an AXI4-Stream — is
enumerated in Array serialization (the array analog of single-value
Serialization): the routine for each channel, where it is generated,
and the framed_word gap. The pipelined loop patterns over a real port are in
Interfaces.
Table of contents
- Design patterns for loop optimization - The loop shapes an HLS kernel body is built from, including deciding once per chunk and pipelining inside it. Several samples packed into one bus word (int16 four to a 64-bit word): the LANE LOOP unpacks a word into elements -- either a whole word per iteration with the compute unrolled across the packing factor (PF samples per cycle), or one element per iteration reading a word every PF iterations (one sample per cycle, the compute not replicated). Then the body's shape: a straight-line loop per message, like the Python, versus a single-firing state machine, and what the pipeline drain between messages costs. And a timing rule: do not decide, compute and commit in one iteration. Independent of the interface -- stream, m_axi buffer or BRAM.
- Vitis: raw arrays - Vectorized arrays in raw storage — a flat C array; the packing factor and lanes, read_array_slice over a local buffer, and the canonical lane loop (with the pf=0 wide-element case).
- Vitis: struct arrays - Vectorized arrays in struct storage — a generated per-array wrapper type carrying its own packing methods, the same lane layout behind an object interface.
- Vitis: complex arrays - Vectorized complex arrays in Vitis — the std::complex / wf_cint element storage and the lane loop over complex values, building on the raw-array pattern.
-
Vitis: array serialization - Move a whole ARRAY of a schema element to and from words — the generated
_array_utils helpers (elem_read / read_array_slice / read_stream_lane / read_axi4_stream_lane) and the DataArray struct methods (read_array / pack_to_uint). The array analog of single-value Serialization: enumerates every channel you can (de)serialize an array to, the routine for each, and where it is generated.