Buffer Port Connection for Multirate Processing - 2023.1 English

AI Engine Kernel and Graph Programming Guide (UG1079)

Document ID
UG1079
Release Date
2023-06-23
Version
2023.1 English

In some designs the size of the output buffer port of a kernel can be different than the size of the input buffer port of the next kernel. In that case, the connection declaration will contain the size of the output port and the size of the input buffer port. For example:

connect net0 (kernel0.out[0], kernel1.in[0]);
dimensions(kernel0.out[0]) = {128};
dimensions(kernel1.in[0]) = {192};

In the above example, kernel0 writes 128 samples and kernel1 expects 192 samples will be written to memory. In such scenarios, the AI Engine compiler performs an automatic multirate 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, as follows:

repetition_count(kernel0) = 3;
repetition_count(kernel1) = 2;

Just as you can broadcast an output buffer port to multiple input buffer ports in the graph (automatic DMA insertion mechanism), you can also perform multirate processing in this specific use case:

connect net0 ( kernel0.out[0] , kernel1.in[0] );
connect net1 ( kernel0.out[0] , kernel2.in[0] );
dimensions(kernel0.out[0]) = {128};
dimensions(kernel1.in[0])  = {64};
dimensions(kernel2.in[0])  = {192};

In this example, the AI Engine compiler automatically detects that kernel0 should run three times, kernel1 should run six times, and kernel2 should run twice for one graph iteration, graph.run(1). These repetition counts can also be specified manually in the graph.