Writing and Advancing an Output Stream - 2023.1 English

AI Engine Kernel and Graph Programming Guide (UG1079)

Document ID
Release Date
2023.1 English

AI Engine Operations

The following operations write data to the given output stream and advance the stream on the AI Engine. Because there are two output 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 can be written to the output stream one at a time or as a vector. In the latter case, until all values are written, 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. Cascade connection writes all values in parallel.

void writeincr(output_stream<int32> *w, int32 v);
void writeincr(output_stream<int64> *w, int64 v);
void writeincr(output_stream<uint32> *w, uint32 v);
void writeincr(output_stream<cint16> *w, cint16 v);
void writeincr(output_stream<cint32> *w, cint32 v);
void writeincr(output_stream<float> *w, float v);
void writeincr(output_stream<cfloat> *w, cfloat v);

void writeincr_v<16>(output_stream<int8> *w, aie::vector<int8,16> &v);
void writeincr_v<16>(output_stream<uint8> *w, aie::vector<uint8,16> &v);
void writeincr_v<8>(output_stream<int16> *w, aie::vector<int16,8> &v);
void writeincr_v<4>(output_stream<cint16> *w, aie::vector<cint16,4> &v);
void writeincr_v<4>(output_stream<int32> *w, aie::vector<int32,4> &v);
void writeincr_v<2>(output_stream<cint32> *w, aie::vector<cint32,2> &v);
void writeincr_v<4>(output_stream<float> *w, aie::vector<float,4> &v);

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