Kernel Bypass - 2022.2 English

AI Engine Kernel and Graph Programming Guide (UG1079)

Document ID
Release Date
2022.2 English

A bypass encapsulator construct discussed in Run-Time Graph Reconfiguration Using Control Parameters is used to execute a kernel conditionally. The control of the bypass is done through a run-time parameter: 0 for no bypass and 1 for bypass. In addition to the control parameter, the external connections of a bypassed kernel or a graph are directed to the external ports of the bypass construct itself. Internally, the bypass construct is connected to the bypassed kernel or the graph automatically by the compiler. The following example shows the required coding.

inout_port control;
bypass b;
kernel f, p, c;
f = kernel::create(filter);
b = bypass::create(f);
connect<parameter> (control, b.bp);
connect<window<128>> n1(p.out[0],[0]);
connect<window<128>> n2(b.out[0], c.out[0]);
Note: For the bypass to work correctly, a one-to-one correspondence between the input and output data ports is required, both in type and size.