Load and Store From Buffer Interface - 2024.2 English - UG1603

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

Document ID
UG1603
Release Date
2024-11-28
Version
2024.2 English

AI Engine APIs provide access methods to read and write data from data memory, streaming data ports, and cascade streaming ports which can be used by AI Engine kernels.

In the following example, the const circular iterator is used to read an aie::vector<cint16,8> vector. Stream API readincr_v<8>(cin) is used to read a sample of int16 data from the cin stream. writeincr(cas_out, v) is used to write data to a cascade stream output.

void func(input_buffer<cint16> &din, 
			input_stream<int16> *cin, 
			output_cascade<cacc64> *cas_out){
        auto cirIter=aie::cbegin_vector_circular<8,512>(din);
	aie::vector<cint16,8> data=*cirIter++;
	aie::vector<int16,8> coef=readincr_v<8>(cin);
	aie::accum<cacc64,4> v;
	…
	writeincr(cas_out, v);
}

In cases where iterators are not suitable due to either semantic or performance issues , for example if datatypes not aligned with memory word-length , buffer streams can be used as an alternative. These streams are linked to a standard data buffer but follow a stream interface.