Compare input layouts in GEMM

This final General Matrix Multiplication (GEMM) visualization begins with matrix A in transposed-and-interleaved layout. It loads input values into Z registers, accumulates outer products in ZA, and writes the output matrix. In contrast to the Gather Load version, all loads from A Input Data are from contiguous addresses.

Trace the interleaved loads

To keep this Learning Path open while exploring, open the interleaved GEMM visualization in a separate browser tab. Move the tab to a separate window to view the visualization and Learning Path side by side.

Follow the same stages as the Gather Load GEMM and compare how matrix A data reaches Z2 and Z3:

StageNumber of stepsOperation
Load the first inputs4Load the first row of B Input Data into Z0–Z1 and the first two rows of A Input Data into Z2–Z3.
Calculate the first outer products4Calculate matrix outer product and accumulate the first partial results in ZA0–ZA3.
Process the second inputs8Load the second row of B and the third and fourth rows of A, then accumulate outer products in ZA0–ZA3.
Process the third inputs8Repeat for the third row of B and the fifth and sixth rows of A.
Process the fourth inputs8Repeat for the fourth row of B and the final two rows of A.
Store the first results8Write ZA0 and ZA1 to Output Matrix Data.
Store the remaining results8Write ZA2 and ZA3 to Output Matrix Data.

A Input Data is loaded from contiguous memory addresses.

 

You can compare the Output Matrix Data with the final output matrix from the Gather Load version to confirm that they’re identical.

What you’ve learned

You’ve followed ZA layout, transposition, operand preparation, and three GEMM input strategies. These visualizations illustrate data movement. The visualizations don’t benchmark the strategies or verify executable Scalable Matrix Extension 2 (SME2) instructions.

To write and validate a kernel, continue with Accelerate matrix multiplication performance with SME2 .