Reading and Advancing an Input Stream - 2023.2 English

AI Engine Kernel and Graph Programming Guide (UG1079)

Document ID
UG1079
Release Date
2023-12-04
Version
2023.2 English

AI Engine Operations

The following operations read data from the given input stream and advance the stream on the AI Engine. Because there are two input stream ports on the AI Engine, the physical port assignment is made by the AI Engine compiler automatically and conveyed as part of the stream data structure. Data values from the stream can be read one at a time or as a vector. In the latter case, unless all values are present, the stream operation stalls. The data groupings are based on the underlying single cycle, 32-bit stream operation or 4 cycle, 128-bit wide stream operation. The cascade connection reads all accumulator values in parallel.

int32 readincr(input_stream<int32> *w);
uint32 readincr(input_stream<uint32> *w);
cint16 readincr(input_stream<cint16> *w);
float readincr(input_stream<float> *w);
cfloat readincr(input_stream<cfloat> *w);

aie::vector<int8,16> readincr_v<16>(input_stream<int8> *w);
aie::vector<uint8,16> readincr_v<16>(input_stream<uint8> *w);
aie::vector<int16,8> readincr_v<8>(input_stream<int16> *w);
aie::vector<cint16,4> readincr_v<4>(input_stream<cint16> *w);
aie::vector<int32,4> readincr_v<4>(input_stream<int32> *w);
aie::vector<cint32,2> readincr_v<2>(input_stream<cint32> *w);
aie::vector<float,4> readincr_v<4>(input_stream<float> *w);

aie::accum<acc48,8> readincr_v<8>(input_stream<acc48> *w);
aie::accum<cacc48,4> readincr_v<4>(input_stream<cacc48> *w);
aie::accum<acc80,4> readincr_v<4>(input_stream<acc80> * str);
aie::accum<cacc80,2> readincr_v<2>(input_stream<cacc80> * str);
aie::accum<accfloat,8> readincr_v<8>(input_stream<accfloat> * str);
aie::accum<caccfloat,8> readincr_v<4>(input_stream<caccfloat> * str);
Note: To indicate the end of the stream, the readincr API can be used with a TLAST argument as shown below.
int32 readincr(input_stream<int32> *w, bool &tlast);