Finite Execution of Graph - 2024.1 English

AI Engine Kernel and Graph Programming Guide (UG1079)

Document ID
Release Date
2024.1 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.
#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;