ADF Graph - 2024.1 English

Vitis Libraries

Release Date
2024-05-30
Version
2024.1 English

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, refer to 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);
     inptr = input_plio::create("DataIn1", adf::plio_128_bits, "data/input_128x16.txt");
     outptr = output_plio::create("DataOut1", adf::plio_128_bits, "data/output.txt");

     adf::connect<>(inptr.out[0], k1.in[0]);
     adf::connect<parameter>(kernelCoefficients, async(k1.in[1]));
     adf::connect<>(k1.out[0], outptr.in[0]);

     adf::dimensions(k1.in[0]) = {ELEM_WITH_METADATA};
     adf::dimensions(k1.out[0]) = {ELEM_WITH_METADATA};

     source(k1) = "xf_filter2d.cc";
     // Initial mapping
     runtime<ratio>(k1) = 0.5;
  };
};