Vitis Model Composer supports importing AI Engine kernels with run-time parameters in kernel functions alongside window and stream types. The following table lists the scalar data types that can be passed as run-time parameters.
<Type> | Complexity | Signedness |
---|---|---|
int8 | Real | Signed |
int16 | Real | Signed |
int32 | Real | Signed |
int64 | Real | Signed |
uint8 | Real | Unsigned |
uint16 | Real | Unsigned |
uint32 | Real | Unsigned |
uint64 | Real | Unsigned |
cint16 | Complex | Signed |
cint32 | Complex | Signed |
float | Real | N/A |
cfloat | Complex | N/A |
Implicit ports are inferred for each parameter (scalar and vector data types) in the function argument. The following table describes the type of port inferred for each function argument.
Formal Parameter | Port Class |
---|---|
T | Input |
Const T | Input |
T & | Inout |
Const T & | Input |
Const T (&) [ .. ] | Input |
T (&)[ .. ] | Inout |
In the following example, the simple_rtp
function has two real-time
parameters. Notice the function argument select
which is passed by
value, and argument weight
which is passed by reference.
#ifndef __RTP_KERNEL_H__
#define __RTP_KERNEL_H__
void simple_rtp(input_window_cint16 * in,output_window_cint16 * outw, int32 &weight, int32 select);
#endif //__RTP_KERNEL_H__
When imported for the above function, the AIE Kernel block looks as shown in
the following figure. In Model Composer, the inout
port appears as the output
port on the AIE Kernel
block.
inout
RTP ports during code generation and only considers them for Simulink simulation. (i.e.,
they will not be read from the PS). Because RTPs are used alongside the window and stream ports, the procedure for importing the kernel function remains the same. When the above kernel function with RTPs are imported, the AIE Kernel block looks as shown in the following figure.
Notice that the AIE kernel block name (simple_rtp
) is same as AI Engine
kernel function name.
After a successful import, the Function tab displays automatically. You can quickly review the function definition and run-time parameter ports as shown.
Port synchronicity is the only parameter that is specific to RTPs. The following table provides details about the valid synchronicity of the Destination RTP input port with respect to the Source RTP inout port. The default port synchronicity is set to 'auto'.
Source RTP Inout Port | Destination RTP input Port |
---|---|
auto | async |
sync | auto |
sync | sync |
async | async |
If the source RTP inout port is set to 'auto' then the destination RTP input port should be 'async'. Similarly for other combinations. Model Composer throws an appropriate error when you try to use any combination which is not specified in the previous table.