To program the AI Engine ML, we resort to kernels and graphs. The kernel is the actual program running inside the compute tile. It can be coded in C++ with two programming styles, each using a different set of APIs.
Fig. 6: Kernel coding styles
The intrisics APIs are a set of low level, architecture dependend functions, much similar to low level C or Assembly.
The AI Engine APIs are instead a set of higher level optimized functions built with intrinsics, that are device independent, thus portable among the various AI Engine models.
The kernels are then connected and encapsulated in a graph, also coded in C++, that works as a Kahn Process Network, meaning that each kernel waits for all its needed data before running. It is worth mentioning that a graph can also encapsulate other graphs.
Fig. 7: Example of a graph