LLVM IR constructs
Written by scripts/roadmap_llvm.py from the importer, the rule table, the corpus and its refusals. Do not edit; run python3 scripts/roadmap_llvm.py after changing one of them.
Scope
The LLVM IR the 116 corpus files use: every opcode the importer reads that some corpus file uses, every intrinsic family some corpus file calls, every form of inline assembly the importer accepts, and every construct the importer refuses. The corpus IR declares no LLVM version (it has no llvm.ident); the cards cite the LangRef and PTX ISA versions the semantics was read from (LangRef 24.0.0git, PTX ISA 9.5, docs/TRUST.md T7). An opcode or family card is L1 when its lean names exist and the semantics runs the construct: the grid evaluator runs a kernel of it until every thread returns, the row returns of the table MojoProofTest/Modelled.lean pins (its build checks the table). A construct the importer reads and the semantics stops at (with unsupported or another fault) is L0, parsed but not modelled, and its card says so.
Items
Opcodes
- inst-add: The
addinstruction (tested against the GPU, used by a proved kernel) - inst-addrspacecast: The
addrspacecastinstruction - inst-alloca: The
allocainstruction - inst-and: The
andinstruction - inst-ashr: The
ashrinstruction - inst-atomicrmw: The
atomicrmwinstruction - inst-bitcast: The
bitcastinstruction - term-br: The
brterminator (tested against the GPU, used by a proved kernel) - inst-call: The
callinstruction (tested against the GPU, used by a proved kernel) - inst-extractelement: The
extractelementinstruction - inst-extractvalue: The
extractvalueinstruction (tested against the GPU, used by a proved kernel) - inst-fadd: The
faddinstruction (tested against the GPU, used by a proved kernel) - inst-fdiv: The
fdivinstruction - inst-fmul: The
fmulinstruction (tested against the GPU, used by a proved kernel) - inst-fpext: The
fpextinstruction - inst-fptrunc: The
fptruncinstruction - inst-fsub: The
fsubinstruction (tested against the GPU, used by a proved kernel) - inst-getelementptr: The
getelementptrinstruction (tested against the GPU, used by a proved kernel) - inst-icmp: The
icmpinstruction (tested against the GPU, used by a proved kernel) - inst-insertelement: The
insertelementinstruction - inst-insertvalue: The
insertvalueinstruction - inst-load: The
loadinstruction (tested against the GPU, used by a proved kernel) - inst-lshr: The
lshrinstruction - inst-mul: The
mulinstruction (tested against the GPU, used by a proved kernel) - inst-or: The
orinstruction - inst-phi: The
phiinstruction (tested against the GPU, used by a proved kernel) - inst-ptrtoint: The
ptrtointinstruction - term-ret: The
retterminator (tested against the GPU, used by a proved kernel) - inst-sdiv: The
sdivinstruction - inst-select: The
selectinstruction (tested against the GPU, used by a proved kernel) - inst-sext: The
sextinstruction (tested against the GPU, used by a proved kernel) - inst-shl: The
shlinstruction - inst-shufflevector: The
shufflevectorinstruction - inst-sitofp: The
sitofpinstruction - inst-store: The
storeinstruction (tested against the GPU, used by a proved kernel) - inst-sub: The
subinstruction - inst-trunc: The
truncinstruction (tested against the GPU, used by a proved kernel) - inst-udiv: The
udivinstruction - inst-urem: The
ureminstruction - inst-xor: The
xorinstruction - inst-zext: The
zextinstruction (tested against the GPU, used by a proved kernel)
Intrinsic families
- intrinsic-sreg: The intrinsic family
Intrinsic.sreg(tested against the GPU, used by a proved kernel) - intrinsic-laneid: The intrinsic family
Intrinsic.laneid - intrinsic-barrier: The intrinsic family
Intrinsic.barrier - intrinsic-shfl: The intrinsic family
Intrinsic.shfl - intrinsic-minmax: The intrinsic family
Intrinsic.minmax(tested against the GPU, used by a proved kernel) - intrinsic-fminmax: The intrinsic family
Intrinsic.fminmax - intrinsic-rsqrtapprox: The intrinsic family
Intrinsic.rsqrtApprox - intrinsic-lifetime: The intrinsic family
Intrinsic.lifetime - intrinsic-reduceand: The intrinsic family
Intrinsic.reduceAnd - intrinsic-extract: The intrinsic family
Intrinsic.extract - intrinsic-stepvector: The intrinsic family
Intrinsic.stepvector - intrinsic-griddepwait: The intrinsic family
Intrinsic.griddepWait - intrinsic-griddeplaunch: The intrinsic family
Intrinsic.griddepLaunch - intrinsic-cpasynccommit: The intrinsic family
Intrinsic.cpAsyncCommit - intrinsic-cpasyncwait: The intrinsic family
Intrinsic.cpAsyncWait - intrinsic-ldmatrix: The intrinsic family
Intrinsic.ldmatrix(parsed, not modelled) - intrinsic-mma: The intrinsic family
Intrinsic.mma(parsed, not modelled)
Accepted inline assembly
- asm-cp-async-cg-shared-global-3: Inline asm
cp.async.cg.shared.globalwith 3 operands (parsed, not modelled) - asm-cp-async-cg-shared-global-4: Inline asm
cp.async.cg.shared.globalwith 4 operands (parsed, not modelled)
Refused constructs
- refused-asm-cvt-rn-f16x2-e4m3x2-2: Refused: inline asm
cvt.rn.f16x2.e4m3x2with 2 operands - refused-asm-cvt-rn-satfinite-e4m3x2-f32-3: Refused: inline asm
cvt.rn.satfinite.e4m3x2.f32with 3 operands - refused-load-atomic: Refused:
load atomic - refused-store-atomic: Refused:
store atomic
Out of scope
Opcodes the importer reads (51 keywords) that no corpus file uses, and intrinsic families no corpus file calls: the cards follow the corpus. Calls of functions defined in the module are calls, not intrinsics, and have no card of their own.
Depends on
The corpus (tests/corpus/MANIFEST.tsv) and the importer's tables; the reading of LangRef and PTX ISA (docs/TRUST.md T7, T9, T10).
Coverage in MojoProof
56 of the 58 opcode and family cards are L1: the importer reads the construct, MojoProof.Sem.exec, MojoProof.Sem.step or MojoProof.Sem.intrinsic gives it a meaning, and the grid evaluator runs a kernel of it to the end (MojoProofTest/Modelled.lean); the card repeats the block checker's rules and refusals for its constructors. The intrinsic-ldmatrix and intrinsic-mma cards are L0, parsed but not modelled: the semantics stops a run at the construct. The accepted inline asm cards asm-cp-async-cg-shared-global-3 and asm-cp-async-cg-shared-global-4 are L0: the importer accepts the call, and MojoProof.Sem.exec stops a run at it. The refused constructs are L0. 20 of the L1 cards are L2: a record of a GPU run that agrees with the evaluator ran a corpus kernel whose IR uses the construct (tests/gpu/naive/record.txt, tests/gpu/vadd/record.txt, tests/gpu/vmul/record.txt, tests/gpu/vsub/record.txt; a conformance test, not a proof). 20 of the L2 cards are L3: a kernel card with L2 evidence, a proved kernel, has a Kernel.Sound theorem about a program whose IR uses the construct. The proved kernels, their L2 theorems and the corpus files of the programs those are about (the program of the elaborated conclusion and the corpus file of the imported program it unfolds to, programs.tsv, which scripts/L3Programs.lean writes; the other files a kernel card cites do not count): naive-matmul: MojoProofTest.NaiveKernel.correct (tests/corpus/mgemm/g_matmul_kernel_naive_float32_float32_float32_True_16_16826c8c.nvptx.ll), MojoProofTest.NaiveOff.correct (tests/corpus/mgemm_nocontract/g_matmul_kernel_naive_float32_float32_float32_True_16_16826c8c.nvptx.ll); vadd: MojoProof.Kernels.vadd.correct (tests/corpus/vadd/vadd_vector_addition_vector_addition6A6A_793e5fe36a195e73.nvptx.ll); vmul: MojoProof.Kernels.vmul.correct (tests/corpus/vmul/vector_multiply_vector_multiply_vector_multiply6A6A_227fc544da3deaff.nvptx.ll); vsub: MojoProof.Kernels.vsub.correct (tests/corpus/vsub/vector_subtraction_vector_subtraction_vector_subtr6A6A_a0b4d9d2b6e652e1.nvptx.ll). L3 here means used by a proved kernel, not that the construct has a theorem of its own: a kernel's theorem covers the forms of the construct in the IR of its program, at the launches and on the memories its premises admit, and no other form.
Next steps
- A recorded GPU run of a kernel that uses the construct, for L2 of the L1 cards that are not L2.
- A semantics of the constructs parsed but not modelled (
intrinsic-ldmatrix,intrinsic-mma), for L1. - A model of the refused inline asm (
cvtto and from e4m3), so the refused files import, and a semantics of the acceptedcp.async.cgcopies, for L1 of their cards. - The block checker's refusals listed in each card, which bound what a proved kernel can use today.
Status of the cards
From roadmap/status.yaml, which the roadmap script writes from the code.
| Card | Kind | Level | Evidence above the level | Next | Corpus kernels |
|---|---|---|---|---|---|
asm-cp-async-cg-shared-global-3: Inline asm cp.async.cg.shared.global with 3 operands | construct | L0 | - | L1 needs a Lean model | 5 |
asm-cp-async-cg-shared-global-4: Inline asm cp.async.cg.shared.global with 4 operands | construct | L0 | - | L1 needs a Lean model | 5 |
inst-add: The add instruction | construct | L3 | - | top level | 5 |
inst-addrspacecast: The addrspacecast instruction | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
inst-alloca: The alloca instruction | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
inst-and: The and instruction | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
inst-ashr: The ashr instruction | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
inst-atomicrmw: The atomicrmw instruction | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 1 |
inst-bitcast: The bitcast instruction | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
inst-call: The call instruction | construct | L3 | - | top level | 5 |
inst-extractelement: The extractelement instruction | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
inst-extractvalue: The extractvalue instruction | construct | L3 | - | top level | 5 |
inst-fadd: The fadd instruction | construct | L3 | - | top level | 5 |
inst-fdiv: The fdiv instruction | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
inst-fmul: The fmul instruction | construct | L3 | - | top level | 5 |
inst-fpext: The fpext instruction | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
inst-fptrunc: The fptrunc instruction | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
inst-fsub: The fsub instruction | construct | L3 | - | top level | 5 |
inst-getelementptr: The getelementptr instruction | construct | L3 | - | top level | 5 |
inst-icmp: The icmp instruction | construct | L3 | - | top level | 5 |
inst-insertelement: The insertelement instruction | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
inst-insertvalue: The insertvalue instruction | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
inst-load: The load instruction | construct | L3 | - | top level | 5 |
inst-lshr: The lshr instruction | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
inst-mul: The mul instruction | construct | L3 | - | top level | 5 |
inst-or: The or instruction | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
inst-phi: The phi instruction | construct | L3 | - | top level | 5 |
inst-ptrtoint: The ptrtoint instruction | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
inst-sdiv: The sdiv instruction | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
inst-select: The select instruction | construct | L3 | - | top level | 5 |
inst-sext: The sext instruction | construct | L3 | - | top level | 5 |
inst-shl: The shl instruction | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
inst-shufflevector: The shufflevector instruction | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
inst-sitofp: The sitofp instruction | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 3 |
inst-store: The store instruction | construct | L3 | - | top level | 5 |
inst-sub: The sub instruction | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
inst-trunc: The trunc instruction | construct | L3 | - | top level | 5 |
inst-udiv: The udiv instruction | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
inst-urem: The urem instruction | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
inst-xor: The xor instruction | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
inst-zext: The zext instruction | construct | L3 | - | top level | 5 |
intrinsic-barrier: The intrinsic family Intrinsic.barrier | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
intrinsic-cpasynccommit: The intrinsic family Intrinsic.cpAsyncCommit | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
intrinsic-cpasyncwait: The intrinsic family Intrinsic.cpAsyncWait | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
intrinsic-extract: The intrinsic family Intrinsic.extract | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
intrinsic-fminmax: The intrinsic family Intrinsic.fminmax | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
intrinsic-griddeplaunch: The intrinsic family Intrinsic.griddepLaunch | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
intrinsic-griddepwait: The intrinsic family Intrinsic.griddepWait | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
intrinsic-laneid: The intrinsic family Intrinsic.laneid | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
intrinsic-ldmatrix: The intrinsic family Intrinsic.ldmatrix | construct | L0 | - | L1 needs a Lean model | 5 |
intrinsic-lifetime: The intrinsic family Intrinsic.lifetime | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
intrinsic-minmax: The intrinsic family Intrinsic.minmax | construct | L3 | - | top level | 5 |
intrinsic-mma: The intrinsic family Intrinsic.mma | construct | L0 | - | L1 needs a Lean model | 5 |
intrinsic-reduceand: The intrinsic family Intrinsic.reduceAnd | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
intrinsic-rsqrtapprox: The intrinsic family Intrinsic.rsqrtApprox | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
intrinsic-shfl: The intrinsic family Intrinsic.shfl | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
intrinsic-sreg: The intrinsic family Intrinsic.sreg | construct | L3 | - | top level | 5 |
intrinsic-stepvector: The intrinsic family Intrinsic.stepvector | construct | L1 | - | L2 needs a recorded GPU run (a conformance test, not a proof) | 5 |
refused-asm-cvt-rn-f16x2-e4m3x2-2: Refused: inline asm cvt.rn.f16x2.e4m3x2 with 2 operands | construct | L0 | - | L1 needs a Lean model | 4 |
refused-asm-cvt-rn-satfinite-e4m3x2-f32-3: Refused: inline asm cvt.rn.satfinite.e4m3x2.f32 with 3 operands | construct | L0 | - | L1 needs a Lean model | 3 |
refused-load-atomic: Refused: load atomic | construct | L0 | - | L1 needs a Lean model | 0 |
refused-store-atomic: Refused: store atomic | construct | L0 | - | L1 needs a Lean model | 0 |
term-br: The br terminator | construct | L3 | - | top level | 5 |
term-ret: The ret terminator | construct | L3 | - | top level | 5 |