The sitofp instruction
- Area
- LLVM IR constructs
- 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
LLVM LangRef 24.0.0git #sitofp-to-instruction- Quote
The ‘sitofp’ instruction regards value as a signed integer and converts that value to the ty2 type.
- Lean declarations
MojoProof.LLVM.Parser.instMojoProof.LLVM.InstMojoProof.Sem.execMojoProof.Sem.intToFloatMojoProof.Sym.exec_cast
- Corpus files
tests/corpus/mma/m_test_layout_mma_c_fragment_kern6A6A_805197d96be57147.nvptx.lltests/corpus/mma/m_test_layout_mma_c_fragment_kern6A6A_957f36c79da62114.nvptx.lltests/corpus/mma/m_test_layout_mma_c_fragment_kern6A6A_fb4d0f20fa0d4d7a.nvptx.ll
3 kernel files (
.ll) in the corpus.- Tests
MojoProofTest.RuleMojoProofTest.CorpusMojoProofTest.Modelled
- Upstream issue
- None filed.
- Depends on
- No other card.
Rule
LangRef's section on sitofp (the quote is the first sentence of its overview). The importer reads sitofp as Inst.cast with CastOp.sitofp (Parser.inst); the semantics gives it a meaning in MojoProof.Sem.exec, with MojoProof.Sem.intToFloat. MojoProofTest/Modelled.lean runs a kernel of it (its row sitofp), and the run returns. The block checker (MojoProof/Sym/Rules.lean): Sym.exec_cast (the casts castV evaluates (castOk): not fptoui, fptosi or inttoptr; ptrtoint after an alloca on the memory the effects before it make (SNode.castAfter)); refused (fptoui, fptosi, inttoptr or an ill-typed cast): SState.stmt takes the casts castOk admits (castOk_iff: those castV evaluates).
Corpus
3 of the 116 corpus files use it (10 uses).
Out of scope
Forms of the instruction the corpus does not use are read by the same parser case, but no corpus file exercises them. That the semantics gives sitofp the meaning LLVM gives it rests on reading LangRef (docs/TRUST.md T7), not on a check against LLVM.
Open
L2 needs a recorded GPU run of a test of the construct; there is none.