Prepare the Kernels - 2022.1 English

Versal ACAP AI Engine Programming Environment User Guide (UG1076)

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

Kernels are computation functions that form the fundamental building blocks of the data flow graph specifications. Kernels are declared as ordinary C/C++ functions that return void and can use special data types as arguments (discussed in Window and Streaming Data API). Each kernel must be defined in its own source file. This organization is recommended for reusability and faster compilation. Furthermore, the kernel source files should include all relevant header files to allow for independent compilation.

Note: For the AI Engine kernel to use AI Engine API, include the following files in the kernel source code:
  • #include "aie_api/aie.hpp"
  • #include "aie_api/aie_adf.hpp"

It is recommended that a header file (kernels.h in this documentation) should declare the function prototypes for all kernels used in a graph. An example is as follows.

#ifndef FUNCTION_KERNELS_H
#define FUNCTION_KERNELS_H

void simple(input_window<cint16> * in, output_window<cint16> * out);

#endif

In the example, the #ifndef and #endif are present to ensure that the include file is only included once, which is good C/C++ practice.