With a stream-based access model, the kernels receive an input stream or an output stream of typed data as an argument. Each 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 are not allowed to share stream
ports unless the streams are packet switched (see 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 is connected 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 stream data structures are automatically inferred by the AI Engine compiler from data flow graph connections, and are automatically declared in the wrapper code implementing the graph control. The kernel functions merely operate on pointers to stream data structures that are passed to them as arguments. There is no need to declare these stream data structures in data flow graph or kernel program.