ldmatrix
ldmatrix, a warp's load of 8x8 matrices from shared memory
- Area
- The GPU model
- Kind
- construct
- Level
- L1 (modelled in Lean). Next: L2 needs a recorded GPU run (a conformance test, not a proof).
- Evidence present above the level
- None above the level.
- Reference
PTX ISA 9.5 #9.7.16.5.15- Quote
- No quote yet.
- Lean declarations
MojoProof.Sem.ldmMojoProof.Sem.ldm_invMojoProof.Sem.ldmatrixMojoProof.Sem.ldmatrix_gatherMojoProof.Sem.ldmatrix_fragAMojoProof.Sem.ldmatrix_fragB_colsMojoProof.Sem.ldmatrix_fragBMojoProof.Sem.ldmatrix_fragBtMojoProof.Sem.ldmWarpMojoProof.Sem.ldmWarp_spec
- Corpus files
- None yet.
0 kernel files (
.ll) in the corpus. - Tests
MojoProofTest.TensorCore.isa_invMojoProofTest.TensorCore.mixed_not_invMojoProofTest.TensorCore.rows16MojoProofTest.TensorCore.loads16MojoProofTest.TensorCore.loadsB2MojoProofTest.TensorCoreGpu.ldmModelMojoProofTest.TensorCoreWarp.ldm4WarpMojoProofTest.TensorCoreWarp.ldm2Warp
- Upstream issue
- None filed.
- Depends on
- gpu-model/shared-memory
The rule. ldmatrix.sync.aligned.m8n8.x<q>[.trans].b16 loads q (1, 2 or 4) 8×8 matrices
of 16-bit elements from shared memory into the lanes' registers, lane 8 m + i giving the
address of row i of matrix m, transposed with .trans.
In Lean. The destination layout MojoProof.Sem.ldm q t is a bijection for every q and
both values of .trans (MojoProof.Sem.ldm_inv); read in that layout, the loaded registers
are the stacked tile at the rows' addresses (MojoProof.Sem.ldmatrix_gather), and read in the
layouts mma reads, ldmatrix.x<2c> and ldmatrix.x<c>.trans load the A and B operands of a
16-bit mma (MojoProof.Sem.ldmatrix_fragA, MojoProof.Sem.ldmatrix_fragB), and
ldmatrix.x<c> loads B from its transpose (MojoProof.Sem.ldmatrix_fragBt), for every count;
ldmatrix.x<ch>.trans loads h B operands side by side
(MojoProof.Sem.ldmatrix_fragB_cols). On run-time values, MojoProof.Sem.ldmWarp takes the
lanes' row pointers to their registers, and for every count and flag its results, read in
ldm q t, are the rows' elements (MojoProof.Sem.ldmWarp_spec). The grid does not dispatch
ldmatrix to it (a run reaching it is unsupported): its rows are reads of shared memory, and
the grid's statements about collective calls say that a completed one reads and changes no
memory (docs/proofs/tensor-core.md, "Not proved"). The importer recognises only .x4.
On a GPU. tests/gpu/ldmatrix/record.txt, a conformance test and not a proof: on an A100,
8 launches of one warp's ldmatrix.x4 and ldmatrix.x4.trans from random shared words at
random row addresses; every one of the 4,096 loaded 16-bit elements is the one
MojoProof.Sem.ldmatrix 4 gives (MojoProofTest.TensorCoreGpu.ldmModel).
Out of scope. .m16n16 and .b8 shapes, and the stmatrix store.
Open. The grid's dispatch under MojoProof.Sem.Grid.warpReady, which needs those
statements to allow a collective call's reads, and the importer's .x1
and .x2. L2: the recorded GPU run agrees, but it ran a driver of the instruction, not a
corpus kernel, and the level counts only records of corpus kernels. L3: no proved kernel uses
it. Ref: quote to be added.