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
Prepare matrix A for multiplication
Packing changes the order of values in memory so that a matrix multiplication kernel can load those values more efficiently. The following visualization loads Input Matrix A values into rows of ZA, and writes columns of ZA into Output Packed Data. Packing changes the layout of data, but it doesn’t calculate the matrix product.
To keep this Learning Path open while exploring, open the Pack A 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 transpose and pack algorithm
Select the play button or advance manually to follow the algorithm:
| Stage | Number of steps | Operation |
|---|---|---|
| Load matrix A | 10 | Load Input Matrix A into rows of ZA0–ZA2. |
| Store packed data | 8 | Write full columns of ZA data into rows of Output Packed Data. |
| Pad the final rows | 4 | Write zero-padded columns of ZA data into rows of Output Packed Data. The zero-padding happens because the rows of Input Matrix A aren’t an exact multiple of the ZA tile height. |
During matrix A load, predicates determine which rows are active, which in turn determines the elements of Output Packed Data that are zero-padded.
What you’ve learned and what’s next
You’ve traced a change in the memory layout of matrix A. The packed General Matrix Multiplication (GEMM) visualization begins with this kind of prepared A data.
The preprocessing example in the SME2 matrix multiplication Learning Path shows how a C kernel prepares its left-hand matrix. Its precise layout belongs to that implementation.
Next, you’ll view a visualization that prepares the other operand for the GEMM visualization, matrix B.