kernel - 2022.1 English

Versal ACAP AI Engine Programming Environment User Guide (UG1076)

Document ID
UG1076
Release Date
2022-05-25
Version
2022.1 English

This class represents a single node of the graph. User-defined graph types contain kernel objects as member variables that wrap over some C function computation mapped to the AI Engine array.

Scope

kernel objects can be declared in class scope as member variables in a user-defined graph type (i.e., inside a class that inherits from graph).

kernel objects must be initialized by assignment in the graph constructor.

Member Functions

static kernel & create( function );

The static create method creates a kernel object from a C kernel function. It automatically determines how many input ports and output ports each kernel has and their appropriate element type. Any other arguments in a kernel function are treated as run-time parameters or lookup tables, passed to the kernel on each invocation. Run-time parameters are passed by value, while lookup tables are passed by reference each time the kernel is invoked by the compiler generated static-schedule.

kernel & operator()(…)

Takes one or more parameter objects as arguments. The number of parameter arguments must match the number of non-window formal arguments in the kernel function used to construct the kernel. When used in the body of a graph constructor to assign to a kernel member variable, the operator ensures that updated parameter arguments are passed to the kernel function on every invocation.

Member Variables

std::vector<port<input>> in;

This variable provides access to the logical inputs of a kernel, allowing user graphs to specify connections between kernels in a graph. The i'th index selects the i’th input port (window, stream, or rtp) declared in the kernel function arguments.

std::vector<port<output>> out;

This variable provides access to the logical outputs, allowing user graphs to specify connections between kernels in a graph. The i'th index selects the i’th output port (window or stream) declared in the kernel function arguments.

std::vector<port<inout>> inout;

This variable provides access to the logical inout ports, allowing user graphs to specify connections between kernels in a graph. The i'th index selects the i’th inout port (rtp) declared in the kernel function arguments.