Reading and Advancing an Input Stream - 2024.1 English

AI Engine-ML Kernel and Graph Programming Guide (UG1603)

Document ID
UG1603
Release Date
2024-06-06
Version
2024.1 English

AI Engine-ML Operations

The following operations read data from the given input stream and advance the stream on the AI Engine-ML. 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. The cascade connection reads all accumulator values in parallel.

//Scalar operations
//#include<aie_adf.hpp> or #include<adf.h> 
int32 readincr(input_stream<int32> *w);
uint32 readincr(input_stream<uint32> *w);
cint16 readincr(input_stream<cint16> *w);
float readincr(input_stream<float> *w);

//AIE API Operations to read vector data which supports more vector lanes
//#include<aie_adf.hpp>
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::vector<bfloat16,8> readincr_v<4>(input_stream<bfloat16> *w);

template<typename T,int N>
aie::accum<T,N> readincr_v<N>(input_cascade<T> *w);
template<typename T,int N>
aie::vector<T,N> readincr_v<N>(input_cascade<T> *w);


//ADF API Operations to read vector data which supports limited vector lanes
//#include<adf.h>
v16acc32 readincr_v16(input_cascade<acc32>* str);
v32acc32 readincr_v32(input_cascade<acc32>* str);
v8acc64 readincr_v8(input_cascade<acc64>* str);
v16acc64 readincr_v16(input_cascade<acc64>* str);
v4cacc64 readincr_v4(input_cascade<cacc64>* str);
v8cacc64 readincr_v8(input_cascade<cacc64>* str);
v16accfloat readincr_v16(input_cascade<accfloat>* str);
v8caccfloat readincr_v8(input_cascade<caccfloat>* str);
v64int8 readincr_v64(input_cascade<int8>* str);
v128int8 readincr_v128(input_cascade<int8>* str);
v64uint8 readincr_v64(input_cascade<uint8>* str);
v128uint8 readincr_v128(input_cascade<uint8>* str);
v32int16 readincr_v32(input_cascade<int16>* str);
v64int16 readincr_v64(input_cascade<int16>* str);
v32uint16 readincr_v32(input_cascade<uint16>* str);
v64uint16 readincr_v64(input_cascade<uint16>* str);
v16cint16 readincr_v16(input_cascade<cint16>* str);
v32cint16 readincr_v32(input_cascade<cint16>* str);
v16int32 readincr_v16(input_cascade<int32>* str);
v32int32 readincr_v32(input_cascade<int32>* str);
v8cint32 readincr_v8(input_cascade<cint32>* str);
v16cint32 readincr_v16(input_cascade<cint32>* str);
v32bfloat16 readincr_v32(input_cascade<bfloat16>* str);

For the supported data types and lanes in AIE API readincr_v<N>, see Stream and Cascade Data Types.

Note: To indicate the end of stream, the readincr API can be used with TLAST argument as shown below.
int32 readincr(input_stream<int32> *w, bool &tlast);