In some designs the size of the output window of a kernel can be
different than the size of the input window of the next kernel. In that case, the
connection declaration will contain the size of the output window and the one of the
input window. For
example:
connect< window<128> , window<192,32> > net0 ( kernel0.out[0] , kernel1.in[0] );
In
this example, kernel0
writes 128 bytes and kernel1
expects that 192 bytes will be written to the
memory, which causes an erroneous result. To prevent this, the AI Engine compiler performs
an automatic multi-rate analysis. In this case, the AI Engine compiler will specify that
kernel1
should run twice while kernel0
will run three times. This automatic analysis can be disabled at compile time using the
flag
--disable-multirate
in the aiecompiler
command. In that case, you must specify the
repetition count for these kernels in the
graph:repetition_count(kernel0) = 3;
repetition_count(kernel1) = 2;
Just as you can broadcast an output window to multiple input windows
in the graph (automatic DMA insertion mechanism), you can also perform multi-rate
processing in this specific use
case:
connect< window<128> , window<64> > net0 ( kernel0.out[0] , kernel1.in[0] );
connect< window<128> , window<192> > net0 ( kernel0.out[0] , kernel2.in[0] );
In this example, the AI Engine compiler automatically detects that kernel2
should run twice, kernel0
should run 3 times, and kernel1
should run 6 times for one graph iteration, graph.run(1)
. These repetition counts can also be
specified manually in the graph.