Science Score: 57.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 2 DOI reference(s) in README -
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (7.9%) to scientific vocabulary
Repository
The Vellvm (Verified LLVM) coq development.
Basic Info
Statistics
- Stars: 442
- Watchers: 20
- Forks: 37
- Open Issues: 121
- Releases: 7
Metadata Files
README.md
Vellvm
Vellvm is an ongoing project aiming at the formal verification in the Rocq proof assistant of a compilation infrastructure inspired by the LLVM compiler.
The central piece of Vellvm is the Verified IR (VIR), a Rocq formalization of the semantics of (a subset of) the LLVM IR that is intended for formal verification of LLVM-based software. It is being developed at the University of Pennsylvania as part of the DeepSpec project.
After VIR, the second component whose development is reaching maturity is the verification of a verified front-end for the Helix chain of compilation.
LLVM Compatibility
Vellvm covers most features of the core sequential fragment of LLVM IR 14.0.0 as per its informal specification in LangRef, including:
- basic operations on 1-, 8-, 32-, and 64-bit integers
- doubles, floats, structs, arrays, pointers
- casts
- undef and poison
- SSA-structured control-flow-graphs
- global data
- mutually-recursive functions
- some intrinsics (in a user-extensible)
The main features that are currently unsupported are:
- some block terminators (switch, resume, indirect branching, invoke),
- the landing_pad and va_arg instructions
- architecture-specific floats
- opaque types
Vellvm does not yet provide support for many C standard library functions (such
as printf), but does support puts and malloc. From a semantics perspective, the main
limitations have to do with concurrency.
See also:
Participants
- Steve Zdancewic
- Yannick Zakowski
- Calvin Beck
- Irene Yoon
- Gary (Hanxi) Chen
- Roger Burtonpatel
Past Contributors
- Vivien Durey
- Dmitri Garbuzov
- Eduardo Gonzalez
- Olek Gierczak
- William Mansky
- Milo Martin
- Santosh Nagarakatte
- Emmett Neyman
- Christine Rizkallah
- Zak Sines
- Nathan Sobotka
- Robert Zajac
- Ilia Zaichuk
- Vadim Zaliva
- Richard Zhang
- Jianzhou Zhao
Recent Related Publications:
- "A Two-Phase Infinite/Finite Low-Level Memory Model" (ICFP'24), Calvin Beck, Irene Yoon, Hanxi Chen, Yannick Zakowski, Steve Zdancewic
- "Modular, Compositional, and Executable Formal Semantics for LLVM IR" (ICFP'21), Yannick Zakowski, Calvin Beck, Irene Yoon, Ilia Zaichuk, Vadim Zaliva, Steve Zdancewic
- "Formal Reasoning About Layered Monadic Interpreters" (ICFP'22), Irene Yoon, Yannick Zakowski, and Steve Zdancewic.
- "Interaction Trees" (POPL'20) Li-yao Xia, Yannick Zakowski, Paul He, Chung-Kil Hur, Gregory Malecha, Benjamin C. Pierce, and Steve Zdancewic.
Older Vellvm-related papers:
- "A Formal C Memory Model Supporting Integer-Pointer Casts" (PLDI'15), Jeehoon Kang, Chung-Kil Hur, William Mansky, Dmitri Garbuzov, Steve Zdancewic, and Viktor Vafeiadis.
- "Formal Verification of SSA-Based Optimizations for LLVM" (PLDI'13), Jianzhou Zhao, Santosh Nagarakatte, Milo M. K. Martin, and Steve Zdancewic.
- "Formalizing the LLVM Intermediate Representation for Verified Program Transformations" (POPL'12), Jianzhou Zhao, Santosh Nagarakatte, Milo M. K. Martin, and Steve Zdancewic.
- "Mechanized Verification of Computing Dominators for Formalizing Compilers" (CPP'12), Jianzhou Zhao and Steve Zdancewic.
Structure of the development
The development is organized as follows.
Interaction Trees
Vellvm heavily relies on the Interaction Trees. Its development is hence
tied to contributions to the itree libraries. Temporary itree contributions not yet ready for merge are stored in the src/rocq/Utils
folder.
Rocq formalization
The core of the project is encompassed by the Rocq formalization of LLVM IR and the proof of its metatheory.
This formalization is entirely contained in the src/rocq folder.
More specifically, the following selection of files are among the most important to understand the development:
Syntax, in src/rocq/Syntax/
- LLVMAst.v the front VIR internal AST. Our parser of native llvm syntax returns an element of this AST.
- CFG.v the VIR internal AST as used for the semantics.
Semantics, in src/rocq/Semantics/:
- DynamicValues.v definition of the dynamic values and underdefined values.
- LLVMEvents.v inventory of all events.
- Denotation.v definitions of the representation of VIR programs as ITrees.
- Handlers/ includes the code for all of the handlers. They are broken up into files based on the nature of the event handled, each file hence corresponding to a subsection.
- TopLevel.v provides the full model and the full interpreter, by plugging all components together.
Theory, in src/rocq/Theory/:
- src/rocq/Utils/PropT.v metatheory required to reason about sets of itrees, i.e. about the propositional monad transformer.
- InterpreterMCFG.v the layers of interpretation and some of their metatheory
- InterpreterCFG.v the same layers of interpretation and metatheory, but when reasoning about single functions (i.e. single cfg)
- Refinement.v definition of the refinement relations between layers of interpretations
- TopLevelRefinements.v proof of inclusion of the refinement relations between layers of interpretations; proof of soundness of the interpreter as described in Section 5
- DenotationTheory Equational theory to reason directly about the structure of vir programs; in particular, reasoning principles about open control-flow-graphs.
OCaml front-end and driver for execution and testing
On the OCaml side, we provide a parser for legal LLVM IR syntax as well as an
infrastructure to run differential tests between our interpreter and llc.
These unverified parts of the development live in the src/ml folder.
extracted/Extract.vinstructions for the extraction of the development to OCamllibvellvm/interpreter.mlOCaml driver for running the interpreter; thestepfunction walks over the ITree that remains after complete interpretation of the denotation of a programlibvellvm/llvm_parser.mlythe parser, adapted from Vellvm,testing/assertion.mlcustom annotations of llvm programs as comments used to define our tests.main.mltop-level from which our executable is obtained.
Test suite
Our current test-suite of LLVM programs for which we compare our semantics against llc is stored in tests/
tests/directory containing the test suite of LLVM IR programs discussed in Section 6
Installing / Compiling Vellvm
Assumes:
- OCaml 4.14.1 (typically installed via
opam, see below) - Rocq 9.0.0
- opam 2.0.0+
- Clang 14.0.1+ (available for Mac OSX in XCode 4.2+, or installed via, e.g.
sudo apt-get install clang) gnu-sedseddefaults tognu-sedon linux.- for Mac OS X with homebrew, do
brew install gnu-sedand then create a symlink fromsedto thegsedexecutable in your path.)
Compilation:
- Clone the vellvm git repo with the
--recurse-submoduleoption- If you forgot to clone recursively, run
git submodule update --init --recursiveto fetch the extra libraries inlib/
- If you forgot to clone recursively, run
- Install all external dependencies
- Note: you should be able to install all of the opam libraries with
make opamin thesrc/directory.
- Note: you should be able to install all of the opam libraries with
- Run
makein thesrc/directory: it will produce the OCaml executable calledvellvm
opam, Rocq, and opam dependencies
opam is available via homebrew on Mac, and most system's package managers on Linux, e.g. sudo apt-get install opam.
If this is the first time you are using opam you need to initialize it:
- On Linux: opam init
- On Mac: opam init --disable-sandboxing (sandboxing needs to be disabled due to a known issue).
Then:
Add the Rocq package repository:
opam repo add rocq-released https://rocq-prover.org/opam/released.Create an opam vellvm development switch with:
opam switch create vellvm ocaml-base-compiler.4.14.1.Install Rocq:
opam pin add rocq 9.0.0Install opam dependencies (run in the root directory of the project):
opam install -y --verbose --deps-only .
Note: the dependency constraints in the opam file should be sufficient
for installing vellvm, however if you are having compilation
problems checking the logs from CI may give you the appropriate
versions,
as shown
here.
Using nix:
If you are a nix user, another way to install / compile Vellvm is with nix. Instructions can be found here.
Running Vellvm
The executable vellvm will be found in src/.
Do src/vellvm -help from the command line to see all available options.
In particular:
- src/vellvm -interpret tests/ll/factorial.ll to run the interpreter on a given file.
- cd src && ./vellvm -test to run the test suite against clang
- src/vellvm -test-file tests/ll/gep2.ll to test a specific file using inlined assertions
Adding a new test case
One way to create new test cases for Vellvm is to compile a C program using clang and then add assertions to turn it in to an executable for adding assertions. The steps below illustrate this process:
- Create a C program (e.g. in the directory
tests/c), for instance,example.c.
- The C program should not use C libraries (yet!), which are not part of the LLVM IR standard, but the program should be able to use general C language features.
For example: the following C program contains a simple function called foo that multiplies its input by 3:
int foo(int x) {
return 3*x;
}
- Compile the C program using
clangwith the-emit-llvmand-Sflags to generate an LLVM.llversion.
~/vellvm/tests/c> clang -S -emit-llvm example.c
- The resulting
.llfile should look something like this: ``` ~/vellvm/tests/c> cat example.ll ; ModuleID = 'example.c' sourcefilename = "example.c" target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target triple = "x8664-apple-macosx10.15.0"
; Function Attrs: noinline nounwind optnone ssp uwtable define i32 @foo(i32) #0 { %2 = alloca i32, align 4 store i32 %0, i32* %2, align 4 %3 = load i32, i32* %2, align 4 %4 = mul nsw i32 3, %3 ret i32 %4 }
attributes #0 = { noinline nounwind optnone ssp uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "darwin-stkchk-strong-link" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "probe-stack"="__chkstkdarwin" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
!llvm.module.flags = !{!0, !1, !2} !llvm.ident = !{!3}
!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 10, i32 15]} !1 = !{i32 1, !"wchar_size", i32 4} !2 = !{i32 7, !"PIC Level", i32 2} !3 = !{!"Apple clang version 11.0.0 (clang-1100.0.33.16)"} ```
- Edit the
.llfile to add some assertions about the behavior of the program. For example, we could add the following three assertions (the last of which is actually incorrect):
- The syntax for each assertion is a comment of the form:
; ASSERT EQ: <typ> <val> = call <typ> @<fun>(<typ1> arg1, ..., <typN> argN)
; ASSERT EQ: i32 0 = call i32 @foo(i32 0)
; ASSERT EQ: i32 3 = call i32 @foo(i32 1)
; ASSERT EQ: i32 5 = call i32 @foo(i32 2)
- Run vellvm with the
-test-file example.llflags to see the results of running the test cases:
``` ~/vellvm/tests/c> ../../src/vellvm -test-file example.ll (* -------- Vellvm Test Harness -------- *)
example: passed - UVALUEI32(0) = foo(UVALUEI32(0)) passed - UVALUEI32(3) = foo(UVALUEI32(1)) failed - UVALUEI32(5) = foo(UVALUEI32(2)) ERROR: not equal (*-------------------------------------- *) Passed: 2/3 Failed: 1/3 ```
- The command
vellvm -test-dir <dir>will run theASSERTs found in all the.llfiles in directory<dir>.
Owner
- Name: vellvm
- Login: vellvm
- Kind: organization
- Repositories: 4
- Profile: https://github.com/vellvm
Citation (CITATION.cff)
# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!
cff-version: 1.2.0
title: Vellvm
url: "https://github.com/vellvm/vellvm"
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- given-names: Steve
family-names: Zdancewic
affiliation: University of Pennsylvania
orcid: 'https://orcid.org/0000-0002-3516-1512'
- given-names: Yannick
family-names: Zakowsky
affiliation: Inria
orcid: 'https://orcid.org/0000-0003-4585-6470'
- given-names: Calvin
family-names: Beck
email: hobbes@seas.upenn.edu
affiliation: University of Pennsylvania
orcid: 'https://orcid.org/0000-0002-3469-7219'
- given-names: Irene
family-names: Yoon
affiliation: Inria
orcid: 'https://orcid.org/0000-0003-3388-1257'
- given-names: Hanxi
family-names: Chen
affiliation: University of Pennsylvania
orcid: 'https://orcid.org/0009-0006-4486-7222'
abstract: >-
Vellvm is an ongoing project aiming at the formal
verification in the Coq proof assistant of a compilation
infrastructure inspired by the LLVM compiler.
The central piece of Vellvm is the Verified IR (VIR), a
Coq formalization of the semantics of (a subset of) the
LLVM IR that is intended for formal verification of
LLVM-based software. It is being developed at the
University of Pennsylvania as part of the DeepSpec
project.
keywords:
- LLVM
- Coq
- Compilers
- Semantics
license: GPL-3.0
GitHub Events
Total
- Create event: 35
- Release event: 3
- Issues event: 14
- Watch event: 36
- Delete event: 16
- Issue comment event: 40
- Push event: 201
- Pull request event: 11
- Fork event: 2
Last Year
- Create event: 35
- Release event: 3
- Issues event: 14
- Watch event: 36
- Delete event: 16
- Issue comment event: 40
- Push event: 201
- Pull request event: 11
- Fork event: 2
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 7
- Total pull requests: 6
- Average time to close issues: 8 months
- Average time to close pull requests: 5 months
- Total issue authors: 5
- Total pull request authors: 3
- Average comments per issue: 1.57
- Average comments per pull request: 1.33
- Merged pull requests: 2
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 6
- Pull requests: 5
- Average time to close issues: 3 days
- Average time to close pull requests: 2 days
- Issue authors: 4
- Pull request authors: 2
- Average comments per issue: 1.5
- Average comments per pull request: 1.2
- Merged pull requests: 2
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- Chobbes (17)
- klausnat (2)
- rsofaer (2)
- hanxic (1)
- paul-snively (1)
- Ptival (1)
- YaZko (1)
- math-fehr (1)
- davidtr1037 (1)
Pull Request Authors
- rogerburtonpatel (5)
- Chobbes (4)
- Zdancewic (3)
- lastland (1)
- hanxic (1)
- YaZko (1)
- Lysxia (1)
- Ef55 (1)