Vitis Model Composer supports importing AI Engine kernels with runtime parameters in kernel functions alongside window and stream types. The following table lists the scalar data types that you can pass as runtime 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 |
| bfloat16 | Real | N/A |
The function argument infers implicit ports for each parameter (scalar and vector data types). 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_buffer<cint16> & in,output_buffer<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. (that is, they are 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 you import the above kernel function with RTPs, the AIE Kernel block looks as shown in the following figure.
simple_rtp) is the same as the AI Engine kernel function name.After a successful import, the Function tab displays automatically. You can quickly review the function definition and runtime 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 setting for port synchronicity is 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 needs to be 'async'. Similarly for other combinations. Model Composer
throws an appropriate error if you use any combination not specified in the previous
table.