Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions barretenberg/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,12 @@ cmake --build --preset default --target run_ecc_bench

### Debugging

#### Running Realistic ClientIVC from barretenberg folder
One can now run (for example, any master commit that has finished benchmarking can be used):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does it require that the commit has benchmarked?

Copy link
Collaborator Author

@ludamad ludamad Mar 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the ivc inputs are only created during benchmarking, they require running select e2e with a CAPTURE_IVC_FOLDER env var (which before would not have ran on PRs for time saving sake, but now we also run benchmarking on each PR so a bit muddled)

`barretenberg/cpp/bootstrap.sh e2e_ivc_bench 88c0e046ccb8381910a4615ac6218dcdbf04d898`

If one doesn't provide the commit this (if yarn project is bootstrapped) generate these IVC inputs on the fly.

#### Debugging Verifification Failures

The CircuitChecker::check_circuit function is used to get the gate index and block information about a failing circuit constraint.
Expand Down
49 changes: 10 additions & 39 deletions barretenberg/cpp/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,6 @@ function bench {

rm -rf bench-out && mkdir -p bench-out

# A bit pattern breaking, but the best code to instrument our private IVC flows exists in yarn-project,
# while the best code for benchmarking these IVC flows exists here.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remnants of bench refactor

../../yarn-project/end-to-end/bootstrap.sh generate_example_app_ivc_inputs

# Ultra honk.
function ultra_honk_release {
./build/bin/ultra_honk_bench \
Expand Down Expand Up @@ -256,34 +252,6 @@ function bench {
--benchmark_out=./bench-out/client_ivc_wasm.json \
--benchmark_filter="ClientIVCBench/Full/6$"
}
function client_ivc_flow {
set -eu
local flow=$1
local inputs_folder="$capture_ivc_folder/$flow"
local start=$(date +%s%N)
mkdir -p "bench-out/$flow-proof-files"
# TODO(AD) this should verify but doesn't!
if [ "$flow" == "amm-add-liquidity" ]; then
set +e
fi
./build/bin/bb prove -o "bench-out/$flow-proof-files" -b "$inputs_folder/acir.msgpack" -w "$inputs_folder/witnesses.msgpack" --scheme client_ivc --input_type runtime_stack
set -e
echo "$flow has proven."
local end=$(date +%s%N)
local elapsed_ns=$(( end - start ))
local elapsed_ms=$(( elapsed_ns / 1000000 ))
cat > "./bench-out/$flow-ivc.json" <<EOF
{
"benchmarks": [
{
"name": "$flow-ivc-proof",
"time_unit": "ms",
"real_time": ${elapsed_ms}
}
]
}
EOF
}

function run_benchmark {
set -eu
Expand All @@ -293,7 +261,7 @@ EOF
taskset -c $start_core-$end_core bash -c "$2"
}

export -f ultra_honk_release ultra_honk_wasm client_ivc_17_in_20_release client_ivc_release client_ivc_op_count client_ivc_op_count_time client_ivc_wasm client_ivc_flow run_benchmark
export -f ultra_honk_release ultra_honk_wasm client_ivc_17_in_20_release client_ivc_release client_ivc_op_count client_ivc_op_count_time client_ivc_wasm run_benchmark

local num_cpus=$(get_num_cpus)
local jobs=$((num_cpus / HARDWARE_CONCURRENCY))
Expand Down Expand Up @@ -331,17 +299,20 @@ case "$cmd" in
build
test
;;
download_e2e_ivc_inputs)
e2e_ivc_bench)
# Download the inputs for the private flows.
# Takes an optional master commit to download them from. Otherwise, downloads from latest master commit.
git fetch origin master
# Setting this env var will cause the script to download the inputs from the given commit (through the behavior of cache_content_hash).
export AZTEC_CACHE_COMMIT=${1:-origin/master}

# Error if the inputs are not found in cache.
export DOWNLOAD_ONLY=${DOWNLOAD_ONLY:-1}
if [ -n "${1:-}" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this flow work if we don't specify a commit hash?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't spot where we generate the inputs on the fly

echo "Downloading inputs from commit $1."
export AZTEC_CACHE_COMMIT=$1
export DOWNLOAD_ONLY=1
# Since this path doesn't otherwise need a non-bb bootstrap, we make sure the one dependency is built.
yarn --cwd ../../yarn-project/bb-prover generate
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: what is this doing? maybe a comment would help

fi
../../yarn-project/end-to-end/bootstrap.sh generate_example_app_ivc_inputs
echo "Downloaded inputs for private flows to $capture_ivc_folder"
../../barretenberg/cpp/scripts/ci_benchmark_ivc_flows.sh $(pwd)/../../yarn-project/end-to-end/example-app-ivc-inputs-out $(pwd)/bench-out
;;
"hash")
echo $hash
Expand Down
2 changes: 1 addition & 1 deletion barretenberg/cpp/scripts/ci_benchmark_ivc_flows.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
source $(git rev-parse --show-toplevel)/ci3/source

if [ $# -ne 2 || $# -ne 3 ]; then
if [[ $# -ne 2 && $# -ne 3 ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

won't this always trigger?

echo "Usage: $0 <input_folder> <output_folder> <max_jobs?>"
exit 1
fi
Expand Down
9 changes: 3 additions & 6 deletions ci3/cache_content_hash
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ for arg in "$@"; do
fi
done

# For sanity when iterating on build scripts as bootstrap.sh scripts are in every .rebuild_patterns.
if [ -n "${AZTEC_CACHE_NO_SCRIPTS:-}" ]; then
rebuild_patterns=$(echo "$rebuild_patterns" | grep -v '.sh')
fi
GREP_PATTERN=$(echo "$rebuild_patterns" | grep -v '^$')
# Concatenate patterns with '|' and double escape backslashes for AWK filter empty lines
AWK_PATTERN=$(echo "$rebuild_patterns" | grep -v '^$' | sed 's/\\/\\\\/g' | tr '\n' '|' | sed 's/|$//')
Expand All @@ -48,9 +44,10 @@ diff="$({
# Check for uncommitted files/changes.
# Only use this check if AZTEC_CACHE_COMMIT is the default, otherwise the user is being explicit about using git history.
if [ -n "$diff" ] && [ "$AZTEC_CACHE_COMMIT" == "HEAD" ]; then
# Fail. We shouldn't be writing files during the build.
# Fail. We shouldn't be changing files during the CI run.
if [ "${CI:-0}" = 1 ]; then
echo_stderr "WARNING: Noticed changes to rebuild patterns: $diff"
echo_stderr "ERROR: Noticed changes to rebuild patterns: $diff"
exit 1
fi
# Signal to cache_upload and cache_download to not touch this file.
echo "disabled-cache"
Expand Down