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.
-
#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.