Finite graph execution maintains the graph state across the graph.run(n). The AI Engine-ML does not reinitialize and memory contents do not clear after
graph.run(n).
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 starts with the pong buffer in the next run (of ten iterations). The ping-pong
buffer selector state remains 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
graph.run() or graph.resume() prior to a graph.end(). Failing to do so means that a graph can wait forever, and
graph.end() never
executes.#include "project.h"
simpleGraph mygraph;
int main(void) {
mygraph.init();
mygraph.run(3); // run 3 iterations
mygraph.wait(); // wait for 3 iterations to finish
mygraph.run(10); // run 10 iterations
mygraph.end(); // wait for 10 iterations to finish
return 0;
}