For the Chinese version, see README_zh.md.
BasefoldOverGR contains C++ implementations of BaseFold-style encoding, IOPP,
and PCS over finite fields and Galois rings, together with Z_{2^k} compiler
benchmarks for ring-switch and Frobenius variants.
The main benchmark entrypoint is
scripts/run_release_c4_lambda128.sh.
It auto-configures a Release build in build-release/ and writes fresh sweep
outputs under results/ unless OUT_DIR is set explicitly.
Requirements:
- CMake 3.16 or newer
- A C++17 compiler
- NTL and GMP
- OpenMP if you want multithreaded benches
python3andmatplotlibfor scripts/plot_benchmark_results.py
Manual build and test:
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel
ctest --test-dir build --output-on-failureThe sweep script manages its own build-release/ tree. Local directories such
as build/, build-release/, results/, and .venv/ are git-ignored and may
exist in a working tree without being part of the tracked repository layout.
.
├── CMakeLists.txt
├── README.md
├── README_zh.md
├── LICENSE
├── bench/ # benchmark binaries and calc_iopp_params
├── include/ # public headers
├── src/ # library implementation
├── tests/ # unit tests and CLI/path hygiene checks
├── scripts/
│ ├── run_release_c4_lambda128.sh
│ ├── run_backend_eval_single_thread_7contexts.sh
│ └── plot_benchmark_results.py
├── FRI_Ligero-based_results.md # tracked FRI/Ligero baseline tables
├── results-new/ # tracked current-format CSVs and figures
└── results-legacy/ # tracked older CSVs and plots
Tracked data currently lives in:
results-new/1-thread/backend_eval_results.csvresults-new/8-thread/backend_eval_results.csvresults-new/8-thread/compiler_eval_results.csvresults-new/fri_ligero_based_eval_results.csvresults-new/figures/*.pngresults-legacy/for older CSV names and*_vs_d.pngplots
scripts/run_release_c4_lambda128.sh is fully environment-variable driven.
Current suites are:
basefold_releasecompiler_eval_ring_switchcompiler_eval_frobeniuscompiler_outer_commit_ring_switchcompiler_outer_commit_frobenius
Current defaults:
C=4K0=1LAMBDA=128D_MIN=3,D_MAX=29COMMIT_WARMUP=1,COMMIT_REPS=3EVAL_WARMUP=1,EVAL_REPS=3BENCH_THREADS=8CONTEXTS=all(16 contexts)
Current context ids:
field-255ring-gr-2p16-162field-f2p256ring-gr-2p2-162field-prime64-extfield-f2p64-extfield-prime128-extfield-f2p128-extfield-f3p40-extfield-f3p81-extring-gr-2p16-64-extring-gr-2p16-128-extring-gr-2p32-64-extring-gr-2p32-128-extring-gr-2p2-64-extring-gr-2p2-128-ext
When BENCH_THREADS > 0, the runner also exports:
OMP_NUM_THREADSBASEFOLD_MERKLE_MAX_THREADSBASEFOLD_VERIFY_QUERY_MAX_THREADS
to the same value. Set BENCH_THREADS=0 if you want to keep the runtime's
default threading policy.
Representative commands:
# Default BaseFold release sweep
scripts/run_release_c4_lambda128.sh
# One BaseFold context with a smaller d range
CONTEXTS=field-prime128-ext \
D_MIN=10 D_MAX=20 \
BENCH_THREADS=1 \
scripts/run_release_c4_lambda128.sh
# Ring-switch compiler full eval on GR(2^32,64)
RUN_SUITE=compiler_eval_ring_switch \
CONTEXTS=ring-gr-2p32-64-ext \
COMPILER_KAPPA=6 \
COMPILER_ELL_MIN=9 \
COMPILER_ELL_MAX=12 \
EVAL_WARMUP=0 EVAL_REPS=1 \
BENCH_THREADS=1 \
scripts/run_release_c4_lambda128.sh
# Frobenius compiler full eval on GR(2^32,128)
RUN_SUITE=compiler_eval_frobenius \
CONTEXTS=ring-gr-2p32-128-ext \
COMPILER_KAPPA=7 \
COMPILER_ELL_MIN=9 \
COMPILER_ELL_MAX=12 \
EVAL_WARMUP=0 EVAL_REPS=1 \
BENCH_THREADS=1 \
scripts/run_release_c4_lambda128.shImportant current constraints:
- Compiler suites accept ring contexts only.
- The selected ring context must satisfy
deg(F) = 2^COMPILER_KAPPA. - Current compiler benches support
K0=1only. - Frobenius compiler suites skip
GR(2^2,r)contexts and emitstatus=disabled_gr2p2_context. - Sweep CSV
queriesare derived fromcalc_iopp_paramsby parsingl_min_for_IOPP.
Useful environment variables:
CONTEXTSfor selecting a subset of contextsCOMPILER_KAPPA,COMPILER_ELL_MIN,COMPILER_ELL_MAXfor compiler suitesOUT_DIR,OUT_ROOT,RUN_ID,TIMESTAMPfor output placementBUILD_DIR,ISOLATE_BUILD_DIR,PIN_BUILDfor build-tree controlCPU_PIN_MODE,CPU_SET,RUN_SLOT,RUN_SLOTS_TOTAL,USE_SMT_IN_SLOTfor CPU pinningCMD_TIMEOUT_SEC,CONTINUE_ON_ERRORfor failure handling
The full per-context parameter table and environment-variable reference are in bench/exp_params_release_c4_lambda128.md.
scripts/run_backend_eval_single_thread_7contexts.sh
launches seven single-thread basefold_release runs in parallel, pins each
child to one CPU, and merges the child CSVs into one combined
backend_eval_results.csv.
Default example:
scripts/run_backend_eval_single_thread_7contexts.shThis helper expects bash, lscpu, python3, and taskset.
The run directory defaults to results/release_c4_lambda128_sweep_<RUN_ID>/.
Depending on RUN_SUITE, it can contain:
backend_eval_results.csvforbasefold_releasecompiler_eval_results.csvforcompiler_eval_ring_switchandcompiler_eval_frobeniuscompiler_outer_commit_results.csvforcompiler_outer_commit_ring_switchandcompiler_outer_commit_frobeniusRESULTS.mdfor markdown summarieslogs/*.logfor rawcalc_iopp_paramsand benchmark logs
backend_eval_results.csv uses the current backend schema:
commit_mean_msopen_mean_msprove_mean_msverifier_mean_msproof_size_kbproof_size_bytes
compiler_eval_results.csv uses the current compiler schema, including:
outer_commit_mean_msbackend_commit_mean_mscommit_total_mean_msopen_total_mean_msprove_total_mean_msverify_total_mean_msouter_proof_size_kbtotal_proof_size_kb
scripts/plot_benchmark_results.py reads one or more benchmark CSV files and
plots commit, open, prover, verifier, and proof_size against the
number of constraints.
If you omit -o, the script writes PNG files to result/plots. Use -o when
you want to regenerate the tracked figures under results-new/figures.
Examples:
# Regenerate the tracked single-thread backend figures
python3 scripts/plot_benchmark_results.py \
results-new/1-thread/backend_eval_results.csv \
-o results-new/figures \
--prefix PCSoverGaloisRing_1_thread
# Regenerate the tracked 8-thread compiler figures
python3 scripts/plot_benchmark_results.py \
results-new/8-thread/compiler_eval_results.csv \
-o results-new/figures \
--prefix PCSoverZ2K_8_threadsUseful plotting options:
--metrics commit prover verifier proof_size--proof-size-column <column>--legend-mode auto|inline|split- Multi-input mode for overlaying several CSVs in one figure