Finite Execution of Graph - 2021.2 English

Versal ACAP AI Engine Programming Environment User Guide (UG1076)

Document ID
English (United States)
Release Date
2021.2 English
For finite graph execution, the graph state is maintained across the The AI Engine is not reinitialized and memory contents are not cleared after In the following code example, after the first run of three invocations, the AI Engine main() wrapper code is left in a state where the kernel will start with the pong buffer in the next run (of ten iterations). The ping-pong buffer selector state is left as-is. graph.end() does not clean up the graph state (specifically, does not re-initialize global variables), nor clean up stream switch configurations. It merely exits the core-main. To re-run the graph, you must reload the PDI/XCLBIN.
Important: A graph.wait() must be followed by either a or graph.resume() prior to a graph.end(). Failing to do so means that a graph could wait forever, and graph.end() never executes. See Graph Objects for more details on the use of these APIs.
#include "project.h" 
simpleGraph mygraph; 

int main(void) { 
  mygraph.init();; // run 3 iterations 
  mygraph.wait(); // wait for 3 iterations to finish; // run 10 iterations 
  mygraph.end(); // wait for 10 iterations to finish 
  return 0;