The AI Engine API
provides a aie::mmul class template for a
vector-based matrix multiplication. Multiple intermediate matrix multiplication
results are accumulated to give the final result. For more details on the supported
matrix multiplication shapes (M*K*N) and data
types, refer to Matrix Multiplication in the
AI
Engine API User Guide (UG1529).
The aie::mmul operations mul and mac accept row
based data for the vector-based matrix multiplication. Then for the mac operation, arrange the data by M*K or K*N for better
performance. The PL or AI Engine can
perform data shuffling.
This section gives an example of (64 * 64) x (64 *
64) dimensions matrix multiplication. The data type is int8 x int8. The example uses matrix multiplication
shape 4*16*8.
The input data is assumed to be row based. Prior to the matrix multiplication
kernel, the input data is shuffled in AI Engine-ML memory tile to form 4*16 matrix and 16*8
matrix.
The following figure shows the graph.