Implementation:2akouwu Reverify corpus build
| Knowledge Sources | |
|---|---|
| Domains | Benchmarking, Compilation |
| Last Updated | 2026-10-24 12:00 GMT |
Overview
Concrete tool for building a reproducible benchmark corpus from C sources with every compiler at -O0/-O2, provided by the Reverify library.
Description
The build function compiles C source files from benchmarks/corpus/src/*.c into shared libraries with each available compiler (gcc, clang, cl) at -O0 and -O2. It records a manifest.json with toolchain versions, flags, and SHA-256 of each artifact. This produces a reproducible corpus for the prologue prior and verifier matrix benchmarks.
Usage
Use this function when you need to:
- Build the benchmark corpus before running the prologue prior or verifier matrix.
- Reproduce benchmark results on a new platform.
- Verify that the corpus is deterministic (same sources, same compilers, same flags).
Code Reference
Source Location
- Repository: Reverify
- File: benchmarks/corpus/build.py
- Lines: L41-89
Signature
def build(out_dir: str) -> Dict[str, Any]:
"""Build shared libraries from C sources; return manifest dict."""
Import
from benchmarks.corpus.build import build
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| out_dir | str | Yes | Output directory for built artifacts |
Outputs
| Name | Type | Description |
|---|---|---|
| return | Dict | Manifest: generated, platform, machine, sources (with SHA-256), compilers (with versions), artifacts (file, compiler, opt, source, flags, size, sha256), failures |
Usage Examples
CLI Usage
# Build the corpus
python benchmarks/corpus/build.py build/
# Artifacts: build/gcc-O0-frames.so, build/clang-O2-mathlib.so, etc.
# Manifest: build/manifest.json
Programmatic
from benchmarks.corpus.build import build
manifest = build("corpus_output/")
print(f"Built {len(manifest['artifacts'])} artifacts")
for art in manifest["artifacts"]:
print(f" {art['file']} ({art['compiler']} {art['opt']}, {art['sha256'][:12]})")