Explore SME matrix operations with interactive visualizations
Introduction
Explore the ZA tile layout
Transpose a 32-bit matrix in place with ZA
Transpose a matrix with an incomplete edge
Multiply matrices with vector outer products
Transpose and pack matrix A
Pad matrix B to the ZA tile width
Trace packed GEMM through ZA
Compare a GEMM with gather loads
Interleave matrix A
Trace GEMM with interleaved matrix A
Next Steps
Explore SME matrix operations with interactive visualizations
Introduction
Explore the ZA tile layout
Transpose a 32-bit matrix in place with ZA
Transpose a matrix with an incomplete edge
Multiply matrices with vector outer products
Transpose and pack matrix A
Pad matrix B to the ZA tile width
Trace packed GEMM through ZA
Compare a GEMM with gather loads
Interleave matrix A
Trace GEMM with interleaved matrix A
Next Steps
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:
| Stage | Number of steps | Operation |
|---|---|---|
| Load the first inputs | 4 | Load 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 products | 4 | Calculate matrix outer product and accumulate the first partial results in ZA0–ZA3. |
| Process the second inputs | 8 | Load the second row of B and the third and fourth rows of A, then accumulate outer products in ZA0–ZA3. |
| Process the third inputs | 8 | Repeat for the third row of B and the fifth and sixth rows of A. |
| Process the fourth inputs | 8 | Repeat for the fourth row of B and the final two rows of A. |
| Store the first results | 8 | Write ZA0 and ZA1 to Output Matrix Data. |
| Store the remaining results | 8 | Write 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 .