Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
47 changes: 9 additions & 38 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
Copy Markdown
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 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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