Controlling the AI Engine Graph with the XRT API - 2020.2 English

Versal ACAP AI Engine Programming Environment User Guide (UG1076)

Document ID
UG1076
Release Date
2020-11-24
Version
2020.2 English

A Xilinx provided OpenSource XRT API can also be used for controlling execution of PL kernels inside the graph and AI Engine graph when programming the host code for Linux. Controlling PL kernels inside the graph is similar with controlling PL kernels outside the graph. To control the AI Engine graph, XRT provides APIs through the header file experimental/xrt_graph.h.

Tip: The header file experimental/xrt_graph.h is included in the header file experimental/xrt_kernel.h. So, including experimental/xrt_kernel.h is sufficient to use the XRT API to control the AI Engine graph.

Example code to control the AI Engine graph using the XRT API is as follows:

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};
    xrtGraphOpen(dhdl,top->m_header.uuid,"gr");
    if(!ghdl){
    int size=1024;
    xrtGraphUpdateRTP(ghdl,"gr.fir24.in[1]",(char*)narrow_filter,12*sizeof(int));
    xrtGraphRun(ghdl,16);
    xrtGraphWait(ghdl,0);
    xrtGraphUpdateRTP(ghdl,"gr.fir24.in[1]",(char*)wide_filter,12*sizeof(int));
    xrtGraphRun(ghdl,16);
    ......
    xrtGraphEnd(ghdl,0);
    xrtGraphClose(ghdl);
Tip: The file Work/ps/c_rts/aie_control_xrt.cpp contains information about graph, RTP, GMIO, and initialize configurations. You can find the information for these XRT APIs as required.