With a stream-based access model, the kernels receive an input stream or an output stream of typed data as an argument. Access to these streams is synchronized, and it stalls if the data is not available in the stream or is unable to accept new data.
An AI Engine-ML core supports one 32-bit
input stream port and one 32-bit output stream port. Multiple kernels mapped to the same
AI Engine-ML cannot share stream ports unless the
streams are packet switched (refer to Explicit Packet Switching).
public:
input_plio din;
output_plio dout;
adf::kernel k0,k1;
...
connect <stream> (din.out[0], k1.in[0]);
connect <stream> (k1.out[0], dout.in[0]);
There is also a direct stream communication channel between the accumulator
register of one AI Engine-ML and the physically
adjacent core, called a cascade. The cascade stream connects within the AI Engine-ML array either horizontally or vertically,
directed from west to east or north to
south.
connect <cascade> (k1.out[1], k2.in[1]);
The AI Engine compiler automatically infers the stream data structures from data flow graph connections. They are automatically declared in the wrapper code implementing the graph control. The kernel functions operate on pointers to stream data structures that are passed to them as arguments. You do not need to declare these stream data structures in the data flow graph or kernel program.