An AI Engine program consists of a data flow graph specification written in C++. The dataflow graph consists of top level ports, kernel instances and connectivity. a graph.h file is created which includes the header adf.h.
For more details on data flow graph creation, please refer AI Engine Programming .
#include "kernels.h"
#include <adf.h>
using namespace adf;
class myGraph : public adf::graph {
public:
kernel k1;
port<input> inptr;
port<output> outptr;
port<input> kernelCoefficients;
myGraph() {
k1 = kernel::create(filter2D);
adf::connect<window<TILE_WINDOW_SIZE> >(inptr, k1.in[0]);
adf::connect<parameter>(kernelCoefficients, async(k1.in[1]));
adf::connect<window<TILE_WINDOW_SIZE> >(k1.out[0], outptr);
source(k1) = "xf_filter2d.cc";
// Initial mapping
runtime<ratio>(k1) = 0.5;
};
};