The intrinsic family Intrinsic.minmax
- Area
- LLVM IR constructs
- Kind
- construct
- Level
- L3, the top level.
- Evidence present above the level
- None above the level.
- Evidence
- Reference
LLVM LangRef 24.0.0git #llvm-smax-intrinsic- Quote
Return the larger of %a and %b comparing the values as signed integers.
- Lean declarations
MojoProof.LLVM.Intrinsic.ofDeclMojoProof.LLVM.IntrinsicMojoProof.Sem.intrinsicMojoProof.Sem.intMinMaxMojoProof.Sym.exec_minmax
- Corpus files
tests/corpus/gemv/gemv_f32_gemv_kernel_float32_float32_float32_False_b79a852b.nvptx.lltests/corpus/gemv/gemv_f32_gevm_kernel_float32_float32_float32_1024_1308aaae.nvptx.lltests/corpus/gevm_t512/gevm_f32_t512_gevm_kernel_float32_float32_float32_512_7a789db0.nvptx.lltests/corpus/layernorm/ln_rowwise_block_t0_r1_ax0_w1_bs1024_c4d21970.nvptx.lltests/corpus/layernorm/ln_rowwise_block_t0_r1_ax0_w1_bs128_847b1b53.nvptx.ll
5 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 the intrinsic (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 llvm.smax, llvm.smin, llvm.umax and llvm.umin; the ref is the section on llvm.smax. The semantics gives a call its meaning in MojoProof.Sem.intrinsic. MojoProofTest/Modelled.lean runs a kernel of a call (its row Intrinsic.minmax), and the run returns. The block checker (MojoProof/Sym/Rules.lean): Sym.exec_minmax (two arguments, no flags or attributes); refused (with other arguments, flags or attributes): SState.stmt takes minmax with two arguments and no flags or attributes only.
Corpus
84 of the 116 corpus files use it (464 uses); corpus lists the first 5 in path order. The members called: llvm.smax.i64, llvm.smin.i64.
GPU runs
A conformance test, not a proof. The records of GPU runs of corpus kernels whose IR uses it: tests/gpu/naive/record.txt. In each, the grid evaluator ran the imported corpus program on the inputs of the GPU run, and its output buffer agreed with the GPU's, bit for bit over the whole buffer, on every launch the record lists. That covers the forms of the construct those kernels use, on those inputs and launches, and nothing else.
Proved kernels
Used by a proved kernel, not proved on its own. The kernel cards with L2 evidence whose Kernel.Sound theorems are about a program whose IR uses it, with those theorems: naive-matmul (MojoProofTest.NaiveKernel.correct, MojoProofTest.NaiveOff.correct). A theorem's program is the corpus file mojo_import or mojo_corpus binds it to; the other files a kernel card cites do not count. Each such theorem covers the forms of the construct in the IR of the program it is about, at the launches and on the memories its premises admit.
Out of scope
Members of the family the corpus does not call. That the semantics gives the family the meaning LLVM gives it rests on reading LangRef (docs/TRUST.md T7).
Open
L3 is the top of the construct ladder. It says the construct is used by a proved kernel, not that it has a theorem of its own: the forms of it that no proved kernel's IR uses are covered by no theorem.