Skip to content

Commit 4e8d48d

Browse files
authored
feat: merge-train/barretenberg (#23025)
BEGIN_COMMIT_OVERRIDE fix(bb): clamp BatchMergeProver degree-check loop to fix nightly debug SIGABRT (#23019) feat: extend databus with 2 more cols (#23010) feat: n1 apps (#22974) chore: remove chonk bench once and for all (#23067) fix(bb): clamp BatchMergeProver degree-check loop to fix nightly debug SIGABRT (#23077) feat!: optimized Poseidon2 (#22652) END_COMMIT_OVERRIDE
2 parents 8b76042 + 3827e14 commit 4e8d48d

114 files changed

Lines changed: 8948 additions & 4995 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.test_patterns.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ tests:
6060
error_regex: "Aborted.*core dumped"
6161
owners:
6262
- *adam
63-
- regex: "barretenberg/cpp/scripts/run_bench.sh wasm bb-micro-bench/wasm/chonk build-wasm-threads/bin/chonk_bench"
64-
owners:
65-
- *luke
6663

6764
# noir
6865
# Something to do with how I run the tests now. Think these are fine in nextest.
@@ -297,11 +294,6 @@ tests:
297294
owners:
298295
- *palla
299296

300-
- regex: "bb-micro-bench/wasm/chonk build-wasm-threads/bin/chonk_bench"
301-
error_regex: "core dumped"
302-
owners:
303-
- *adam
304-
305297
- regex: "src/e2e_token_bridge_tutorial.test.ts"
306298
error_regex: "Error: Unable to find low leaf for block"
307299
owners:

barretenberg/.claude/skills/benchmark-chonk/SKILL.md

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,9 @@ argument-hint: <action> e.g. "run", "compare", "wasm", "instrument <area>", "per
66

77
# Benchmark Chonk
88

9-
Run realistic Chonk IVC benchmarks using **pinned protocol inputs** (real transaction flows captured from end-to-end tests), not the synthetic `chonk_bench` target. The synthetic benchmark (`chonk_bench`) uses trivially small mock circuits — it is useful for quick regression checks but does NOT reflect production proving performance. Users invoking `/benchmark-chonk` want the real thing.
9+
Run realistic Chonk IVC benchmarks using **pinned protocol inputs** (real transaction flows captured from end-to-end tests).
1010

11-
## What makes this different from `chonk_bench`
12-
13-
| | `chonk_bench` (synthetic) | This skill (realistic) |
14-
|---|---|---|
15-
| Input data | Mock circuits via `test_bench_shared.hpp` | Pinned msgpack from real Aztec transactions |
16-
| Circuit count | 2 or 5 tiny circuits | Full transaction flows (10+ circuits) |
17-
| Circuit variety | All identical | Mixed: app, kernel, tail, public |
18-
| BB command | `./chonk_bench --benchmark_filter=...` | `bb prove --scheme chonk --ivc_inputs_path ...` |
11+
**Chonk has no synthetic micro-benchmark.** Past attempts (`chonk_bench`) used trivially small mock circuits and produced misleading numbers — the target was deleted to prevent regression of that mistake. Always benchmark Chonk via `bb prove --scheme chonk` against pinned `ivc-inputs.msgpack` for real transaction flows. If a Chonk proving question seems to call for a micro-benchmark, the answer is still `bb prove` on a real flow.
1912

2013
## Step 1: Get pinned IVC inputs
2114

@@ -158,7 +151,7 @@ The macros create `BenchReporter` RAII objects that:
158151
159152
### Google Benchmark integration
160153
161-
For `chonk_bench` and other `.bench.cpp` targets:
154+
For `.bench.cpp` targets that integrate BB_BENCH into Google Benchmark counters:
162155
```cpp
163156
#include "barretenberg/common/google_bb_bench.hpp"
164157
@@ -275,15 +268,15 @@ python3 barretenberg/cpp/scripts/extract_component_benchmarks.py <output_dir> <n
275268

276269
This reads `benchmark_breakdown.json`, finds operations matching key components (sumcheck, pcs, pippenger, commitment, circuit, oink, compute), and appends them to `benchmarks.bench.json` with stacked chart markers for the dashboard.
277270

278-
## A/B comparison scripts
271+
## A/B comparison
272+
273+
For Chonk A/B between branches, run `bb prove --scheme chonk` against the same pinned `ivc-inputs.msgpack` on each branch and compare the resulting `--bench_out_hierarchical` JSON manually. Use the **remote machine** (`/remote-bench`) for stable, single-run numbers.
279274

280-
These use Google Benchmark's `compare.py` for statistical analysis. Note: these use the **remote machine** — see `/remote-bench`.
275+
The generic Google-Benchmark A/B scripts still exist for non-Chonk targets:
281276

282277
| Script | What it compares |
283278
|--------|-----------------|
284-
| `scripts/compare_chonk_bench.sh` | Native ChonkBench/Full/6, branch vs baseline |
285-
| `scripts/compare_chonk_bench_wasm.sh` | WASM ChonkBench/Full/6, branch vs baseline |
286-
| `scripts/compare_branch_vs_baseline_remote.sh` | Generic native A/B |
279+
| `scripts/compare_branch_vs_baseline_remote.sh` | Generic native A/B (any `*_bench` target) |
287280
| `scripts/compare_branch_vs_baseline_remote_wasm.sh` | Generic WASM A/B |
288281

289282
## Key scripts reference
@@ -293,7 +286,6 @@ These use Google Benchmark's `compare.py` for statistical analysis. Note: these
293286
| `scripts/test_chonk_standalone_vks_havent_changed.sh` | Download/update/verify pinned inputs |
294287
| `scripts/ci_benchmark_ivc_flows.sh` | CI: proves a flow, extracts components, uploads to dashboard |
295288
| `scripts/benchmark_example_ivc_flow_remote.sh` | Proves a pinned flow on the remote machine (uses `/remote-bench`) |
296-
| `scripts/benchmark_chonk.sh` | Synthetic `chonk_bench` on remote |
297289
| `scripts/wasmtime.sh` | wasmtime wrapper with standard flags |
298290
| `scripts/extract_component_benchmarks.py` | Extract component timings from hierarchical breakdown |
299291

@@ -307,7 +299,7 @@ These use Google Benchmark's `compare.py` for statistical analysis. Note: these
307299
- **WASM preset:** `wasm-threads`. Build dir is `build-wasm-threads/`. The preset enables `ENABLE_WASM_BENCH=ON` automatically.
308300
- **WASM is ~2.8x slower than native** — this ratio is consistent across all circuit types.
309301
- **CRS:** Ensure `~/.bb-crs` exists. For WASM, wasmtime needs `--dir=$HOME/.bb-crs`.
310-
- **`BB_BENCH=1` vs `--print_bench`:** Either activates profiling. `--print_bench` also triggers the hierarchical tree output to stderr. In `chonk_bench`, the `GOOGLE_BB_BENCH_REPORTER` macro enables it automatically when `BB_BENCH=1` is set.
302+
- **`BB_BENCH=1` vs `--print_bench`:** Either activates profiling. `--print_bench` also triggers the hierarchical tree output to stderr. In Google-Benchmark targets that wrap their loops with `GOOGLE_BB_BENCH_REPORTER`, the same activation happens automatically when `BB_BENCH=1` is set.
311303
- **Dashboard:** CI uploads breakdown data to `bench/bb-breakdown/` on S3. The dashboard at `ci3/dashboard/chonk-breakdowns/` visualizes it.
312304
- **Rebuilding after instrumentation changes:** Only `ninja bb` is needed — no need to reconfigure.
313305

barretenberg/.claude/skills/remote-bench/SKILL.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: remote-bench
33
description: Run benchmarks on the dedicated remote EC2 benchmarking machine for noise-free, single-run results. Handles env var validation, lock management, binary transfer, and result collection. Use with /benchmark-chonk or any BB benchmark target.
4-
argument-hint: <target> e.g. "bb", "chonk_bench", "ultra_honk_bench", "wasm bb"
4+
argument-hint: <target> e.g. "bb", "ultra_honk_bench", "wasm bb"
55
---
66

77
# Remote Bench
@@ -95,7 +95,7 @@ The standard flow used by `scripts/benchmark_remote.sh`:
9595
```bash
9696
cd barretenberg/cpp
9797

98-
BENCHMARK="bb" # or chonk_bench, ultra_honk_bench, etc.
98+
BENCHMARK="bb" # or ultra_honk_bench, etc. (Chonk: use bb with --scheme chonk on real example flows — there is no synthetic chonk benchmark)
9999
PRESET="clang20-no-avm" # or clang20
100100
BUILD_DIR="build-no-avm" # matches preset
101101

@@ -204,14 +204,14 @@ Compare current branch vs baseline (builds and runs both on remote):
204204

205205
```bash
206206
# Native
207-
./scripts/compare_chonk_bench.sh # ChonkBench/Full/6
208207
./scripts/compare_branch_vs_baseline_remote.sh <target> '<filter>'
209208

210209
# WASM
211-
./scripts/compare_chonk_bench_wasm.sh # ChonkBench/Full/6
212210
./scripts/compare_branch_vs_baseline_remote_wasm.sh <target> '<filter>'
213211
```
214212

213+
For Chonk A/B, do not use a synthetic benchmark — measure `bb prove --scheme chonk` against pinned `ivc-inputs.msgpack` for both branches and compare manually.
214+
215215
These use Google Benchmark's `compare.py` for statistical analysis. Note: comparison scripts check out the baseline branch locally, so your working tree must be clean.
216216

217217
## Scripts reference
@@ -220,10 +220,7 @@ These use Google Benchmark's `compare.py` for statistical analysis. Note: compar
220220
|--------|---------|
221221
| `scripts/benchmark_remote.sh` | Generic: build locally, scp, run remotely |
222222
| `scripts/benchmark_wasm_remote.sh` | Same for WASM (wasmtime on remote) |
223-
| `scripts/benchmark_example_ivc_flow_remote.sh` | Chonk with pinned inputs on remote |
224-
| `scripts/benchmark_chonk.sh` | Synthetic chonk_bench on remote |
225-
| `scripts/compare_chonk_bench.sh` | A/B native comparison |
226-
| `scripts/compare_chonk_bench_wasm.sh` | A/B WASM comparison |
223+
| `scripts/benchmark_example_ivc_flow_remote.sh` | Chonk with pinned inputs on remote (the only realistic Chonk bench) |
227224
| `scripts/compare_branch_vs_baseline_remote.sh` | Generic A/B native |
228225
| `scripts/compare_branch_vs_baseline_remote_wasm.sh` | Generic A/B WASM |
229226
| `scripts/_benchmark_remote_lock.sh` | Lock mechanism (source it, don't run it) |

barretenberg/cpp/CMakePresets.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,6 @@
788788
"barretenberg-debug.wasm",
789789
"ecc_tests",
790790
"ultra_honk_bench",
791-
"chonk_bench",
792791
"bb"
793792
]
794793
},

barretenberg/cpp/bootstrap.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,12 +324,8 @@ function bench_cmds {
324324
prefix="$hash:CPUS=8"
325325
echo "$prefix barretenberg/cpp/scripts/run_bench.sh native bb-micro-bench/native/ultra_honk $native_build_dir/bin/ultra_honk_bench construct_proof_ultrahonk_power_of_2/20$"
326326
echo "$prefix barretenberg/cpp/scripts/run_bench.sh native bb-micro-bench/native/ultra_honk_zk $native_build_dir/bin/ultra_honk_bench construct_proof_ultrahonk_zk_power_of_2/20$"
327-
echo "$prefix barretenberg/cpp/scripts/run_bench.sh native bb-micro-bench/native/chonk $native_build_dir/bin/chonk_bench ChonkBench/Full/5$"
328327
echo "$prefix barretenberg/cpp/scripts/run_bench.sh wasm bb-micro-bench/wasm/ultra_honk build-wasm-threads/bin/ultra_honk_bench construct_proof_ultrahonk_power_of_2/20$"
329328
echo "$prefix barretenberg/cpp/scripts/run_bench.sh wasm bb-micro-bench/wasm/ultra_honk_zk build-wasm-threads/bin/ultra_honk_bench construct_proof_ultrahonk_zk_power_of_2/20$"
330-
echo "$prefix barretenberg/cpp/scripts/run_bench.sh wasm bb-micro-bench/wasm/chonk build-wasm-threads/bin/chonk_bench ChonkBench/Full/5$"
331-
prefix="$hash:CPUS=1"
332-
echo "$prefix barretenberg/cpp/scripts/run_bench.sh native bb-micro-bench/native/chonk_verify $native_build_dir/bin/chonk_bench VerificationOnly$"
333329
}
334330

335331
# Runs benchmarks sharded over machine cores.

barretenberg/cpp/scripts/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ There are scripts that:
2828
4. If `ssh` worked, the setup is complete.
2929

3030
## How
31-
- `./scripts/benchmark_chonk.sh` lets you run `chonk_bench` remotely and analyze the results.
3231
- `./scripts/benchmark_example_ivc_flow_remote.sh` copies the example flow input you'd like to run to the remote machine, runs `bb prove`, and analyze the results.
3332
- For the script to work you need to have the example flows downloaded locally, by `AZTEC_CACHE_COMMIT=origin/next~3 FORCE_CACHE_DOWNLOAD=1 yarn-project/end-to-end/bootstrap.sh build_bench`
3433
- If you have other special needs, look inside the above scripts and see what parameters you can give, or use `./scripts/benchmark_remote.sh`.
34+
35+
Chonk proving must always be measured on real example app flows via `benchmark_example_ivc_flow_remote.sh` — there is no synthetic chonk benchmark, and there should not be one. Running synthetic Chonk benchmarks gives misleading numbers because the mock circuits do not reflect production proving costs.

barretenberg/cpp/scripts/benchmark_chonk.sh

Lines changed: 0 additions & 22 deletions
This file was deleted.

barretenberg/cpp/scripts/benchmark_remote.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# - BB_SSH_CPP_PATH: Path to barretenberg/cpp in a cloned repository on the EC2 instance
88
set -eu
99

10-
BENCHMARK=${1:-chonk_bench}
10+
BENCHMARK=${1:?usage: benchmark_remote.sh <bench_target> [command] [preset] [build_dir]}
1111
COMMAND=${2:-./$BENCHMARK}
1212
PRESET=${3:-clang20-no-avm}
1313
BUILD_DIR=${4:-build}

barretenberg/cpp/scripts/benchmark_wasm.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env bash
22
set -eu
33

4-
BENCHMARK=${1:-chonk_bench}
5-
COMMAND=${2:-./bin/$BENCHMARK --benchmark_filter=ChonkBench/Full/6}
4+
BENCHMARK=${1:?usage: benchmark_wasm.sh <bench_target> [command]}
5+
COMMAND=${2:-./bin/$BENCHMARK}
66
HARDWARE_CONCURRENCY=${HARDWARE_CONCURRENCY:-16}
77

88
# Move above script dir.

barretenberg/cpp/scripts/compare_branch_vs_baseline.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# it is up to date with local master, and run the script.
1111

1212
# Specify the benchmark suite and the "baseline" branch against which to compare
13-
BENCHMARK=${1:-chonk_bench}
13+
BENCHMARK=${1:?usage: compare_branch_vs_baseline.sh <bench_target> [filter] [preset] [build_dir]}
1414
FILTER=${2:-""}
1515
PRESET=${3:-clang20}
1616
BUILD_DIR=${4:-build}

0 commit comments

Comments
 (0)