This repository contains the code for the paper Evaluating Compiler Optimization Impacts on zkVM Performance, which resulted from my Bachelor's thesis at ETH Zürich.
To get started, build the runner:
$ ./scripts/build.shAlternatively, with CUDA support, use:
$ ./scripts/build_cuda.shAfter the runner is built, most commands are available via the zkbench cli:
$ ./zkbench.sh --help
Usage: python -m zkbench [OPTIONS] COMMAND [ARGS]...
Options:
--log-level TEXT
--log-file TEXT
--help Show this message and exit.
Commands:
asm
bench
build
clean
plot
plot-tune
run
tuneTo rerun all benchmarks, first build the binaries:
$ ./zkbench.sh build -j$(nproc)Next, run the benchmarks via ./zkbench.sh bench. To see all available options, run ./zkbench.sh bench --help.
To explore the optimization space, use the tune subcommand.
Examples:
$ ./zkbench.sh tune --program fibonacci --config ./configs/tune/all-passes.json --metric cycle-count --out test genetic --depth 10 --baseline o3 --mode depth
$ ./zkbench.sh tune --program fibonacci --config ./configs/tune/all-passes-o3-codegen.json --metric cycle-count --out test ffd --resolution 7
$ ./zkbench.sh tune --program fibonacci --config ./configs/tune/all-passes.json --metric cycle-count --out test exhaustive --depth 2The plots generated from the raw data for the respective experiments in the paper are located in the results directory. All of the raw data is available here. For documentation on how to plot these results, refer to the plotting documentation.
| Environment | Tool | Version |
|---|---|---|
| risc0 | rust | 1.85.0 |
| risc0 | cpp | 2024.1.5 |
| risc0 | r0vm | 2.0.0 |
| risc0 | cargo-risczero | 2.0.0 |
| sp1 | sp1-sdk | 4.1.4 |
| x86 | rust | 1.85-x86_64-unknown-linux-gnu |