Controlling the AI Engine Graph with the XRT C++ API - 2021.2 English

Versal ACAP AI Engine Programming Environment User Guide (UG1076)

Document ID
English (United States)
Release Date
2021.2 English

As stated in the previous section, XRT provides C and C++ APIs through the header file experimental/xrt_graph.h to control the AI Engine graphs.

XRT provides class graph in the name space xrt and its member functions to control the graph. Example code to control the AI Engine graph using the XRT C++ API is as follows:

using namespace adf;
// Open xclbin
auto device = xrt::device(0); //device index=0
auto uuid = device.load_xclbin(xclbinFilename);
auto dhdl = xrtDeviceOpenFromXcl(device);
int coeffs_readback[12];
int narrow_filter[12] = {180, 89, -80, -391, -720, -834, -478, 505, 2063, 3896, 5535, 6504};
int wide_filter[12] = {-21, -249, 319, -78, -511, 977, -610, -844, 2574, -2754, -1066, 18539};
auto ghdl=xrt::graph(device,uuid,"gr");
ghdl.wait();"gr.fir24.inout[0]",coeffs_readback);//Read after graph::wait. RTP update effective
ghdl.update("[1]",wide_filter);;"gr.fir24.inout[0]", coeffs_readback);//Async read
Note: The file Work/ps/c_rts/aie_control_xrt.cpp contains information about the graph, RTP, GMIO, and initialize configurations. For example in the code above, you can find the RTP port name in the RTP Configurations section in aie_control_xrt.cpp called[1].