A bypass encapsulator construct is used to execute a kernel conditionally. The control of the bypass is done through a run-time parameter.
The bypass runtime control input bp
:
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 negate
modifier can be used to denote that
the input control is negated. By default, the control is synchronous RTP. To use
asynchronous RTP, use the async
modifier.
The following example shows the required coding.
input_port control;
input_port in;
output_port out;
bypass b;
kernel k;
k = kernel::create(filter);
dimensions(k.in[0])={32};
dimensions(k.out[0])={32};
...
b = bypass::create(k);
connect<parameter> (control, async(negate(b.bp)));
connect(in, b.in[0]);
connect(b.out[0], out);
Note: For the bypass to work
correctly, a one-to-one correspondence between the input and output buffer ports is
required, both in type and size.