Warp Matrix Instructions#
This guide shows how to multiply two float16 matrices with a warp of 32
threads. ldmatrix loads matrix fragments from shared memory into registers,
and mma.sync multiplies those fragments with float32 accumulation. The
example computes Out = A @ B.T for A of shape (16, 16) and B of shape
(8, 16) on an SM80-or-later GPU.
Other Fragment Shapes and Transfers#
A longer K dimension needs multiple MMA issues. The tile interface represents these with an explicit K-repeat axis in A and B. The first issue reads C, and later issues accumulate into the preceding D. The warp MMA reference gives the repeat shapes, lane mappings, and supported float16/bfloat16 forms.
ldmatrix also supports .x1 and .trans variants. The transpose
acts on each matrix of 16-bit elements. stmatrix transfers a register
fragment to shared memory on targets that support it, with the shared
destination as its first argument. The matrix-transfer reference lists the required layouts and
alignment. These tile calls do not insert barriers: synchronize before
reading another thread’s shared stores, or before other threads consume
or reuse a matrix written to shared memory.
For the hardware layout diagrams behind these mappings, see The Evolution of Tensor Core Data Layouts in Modern GPU Programming for MLSys.