Roadmap / LLVM IR constructs

The intrinsic family Intrinsic.mma

Area
LLVM IR constructs
Kind
construct
Level
L0 (card written). Next: L1 needs a Lean model.
Evidence present above the level
None above the level.
Reference
PTX ISA 9.5 #warp-level-matrix-instructions-mma
Quote
Perform matrix multiply-and-accumulate operation
Lean declarations
Not stated yet.
Corpus files

5 kernel files (.ll) in the corpus.

Tests
  • MojoProofTest.Rule
  • MojoProofTest.Corpus
  • MojoProofTest.Modelled
Upstream issue
None filed.
Depends on
No other card.

Rule

PTX ISA's section on the instruction NVPTX lowers it to (the quote is the section's first sentence). The importer accepts a declaration of this family only if Intrinsic.ofDecl recognizes its name and signature (Intrinsic.name, Intrinsic.sig). The family is parsed, not modelled: MojoProofTest/Modelled.lean's kernel of a call (its row Intrinsic.mma) stops with unsupported: mma in a warp cut by its block of threads. The declarations: MojoProof.LLVM.Intrinsic.ofDecl, MojoProof.LLVM.Intrinsic, MojoProof.Sem.intrinsic. The block checker (MojoProof/Sym/Rules.lean): refused: SState.stmt takes calls of special registers and of minmax only.

Corpus

29 of the 116 corpus files use it (1541 uses); corpus lists the first 5 in path order. The members called: llvm.nvvm.mma.m16n8k16.row.col.bf16, llvm.nvvm.mma.m16n8k4.row.col.tf32, llvm.nvvm.mma.m16n8k8.row.col.bf16, llvm.nvvm.mma.m16n8k8.row.col.f32.f32, llvm.nvvm.mma.m16n8k8.row.col.tf32, llvm.nvvm.mma.m8n8k4.row.col.f64.

Out of scope

Members of the family the corpus does not call. The NVPTX backend's documentation of the NVVM intrinsics is not quoted (no local copy); that the intrinsic is the PTX instruction cited rests on reading the PTX ISA (docs/TRUST.md T7).

Open

L1 needs a semantics of the construct: the run of its test kernel stops with unsupported: mma in a warp cut by its block of threads. L2 then needs a recorded GPU run of a test of it; there is none.