Importing an AI Engine Kernel with Run-Time Parameters - 2020.2 English

Model Composer and System Generator User Guide (UG1483)

Document ID
UG1483
Release Date
2020-11-18
Version
2020.2 English

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 AI Engine kernel block looks as shown in the following figure. In Model Composer, the inout port appears as the output port on the AI Engine kernel block.

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 AI Engine kernel block looks as shown in the following figure.

Figure 1. AI Engine Kernel (RTPs)

Notice that the AI Engine kernel block name (simple_rtp) is same as AI Engine kernel function name.

After a successful import, the Function tab GUI displays automatically. You can quickly review the function definition and run-time parameter ports as shown.

Figure 2. Function Tab

The following table provides details and description on the parameters specific to RTPs.

Table 1. Parameters
Parameter Name Criticality Description
Synchronicity Mandatory
  • Available options for Synchronicity are auto, sync, and async.
  • Port synchronicity is set to auto by default. You can optionally change it to sync or async.
Important: To connect an AI Engine kernel inout RTP port to an AI Engine kernel input RTP port, the synchronicities of both ports must be compatible with each other, otherwise, an error is reported by Model Composer.