Skip to content

Commit

Permalink
chore: Reorganize benchmarks (AztecProtocol#3909)
Browse files Browse the repository at this point in the history
Reorganizes benchmark files for clarity.
  • Loading branch information
codygunton authored Jan 9, 2024
1 parent 307d3db commit 768904d
Show file tree
Hide file tree
Showing 19 changed files with 57 additions and 28 deletions.
4 changes: 2 additions & 2 deletions barretenberg/.github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Run Honk benchmarks
working-directory: cpp/build-bench
run: |
bin/ultra_honk_bench --benchmark_format=json > ../src/barretenberg/benchmark/honk_bench/bench_results.json
bin/ultra_honk_bench --benchmark_format=json > ../src/barretenberg/benchmark/ultra_bench/bench_results.json
# Utilize github-action-benchmark to automatically update the plots at
# https://aztecprotocol.github.io/barretenberg/dev/bench/ with new benchmark data.
Expand All @@ -53,7 +53,7 @@ jobs:
with:
name: C++ Benchmark
tool: 'googlecpp'
output-file-path: cpp/src/barretenberg/benchmark/honk_bench/bench_results.json
output-file-path: cpp/src/barretenberg/benchmark/ultra_bench/bench_results.json
# Access token to deploy GitHub Pages branch
github-token: ${{ secrets.GITHUB_TOKEN }}
# Push and deploy GitHub pages branch automatically
Expand Down
3 changes: 2 additions & 1 deletion barretenberg/cpp/src/barretenberg/benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
add_subdirectory(decrypt_bench)
add_subdirectory(pippenger_bench)
add_subdirectory(plonk_bench)
add_subdirectory(honk_bench)
add_subdirectory(ultra_bench)
add_subdirectory(goblin_bench)
add_subdirectory(relations_bench)
add_subdirectory(widgets_bench)
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Each source represents a separate benchmark suite
set(BENCHMARK_SOURCES
goblin.bench.cpp
eccvm.bench.cpp
)

# Required libraries for benchmark suites
set(LINKED_LIBRARIES
ultra_honk
eccvm
stdlib_recursion
benchmark::benchmark
)

# Add executable and custom target for each suite, e.g. ultra_honk_bench
foreach(BENCHMARK_SOURCE ${BENCHMARK_SOURCES})
get_filename_component(BENCHMARK_NAME ${BENCHMARK_SOURCE} NAME_WE) # extract name without extension
add_executable(${BENCHMARK_NAME}_bench main.bench.cpp ${BENCHMARK_SOURCE})
target_link_libraries(${BENCHMARK_NAME}_bench ${LINKED_LIBRARIES})
add_custom_target(run_${BENCHMARK_NAME} COMMAND ${BENCHMARK_NAME} WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
endforeach()
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <benchmark/benchmark.h>

#include "barretenberg/benchmark/honk_bench/benchmark_utilities.hpp"
#include "barretenberg/benchmark/ultra_bench/benchmark_utilities.hpp"
#include "barretenberg/eccvm/eccvm_composer.hpp"
#include "barretenberg/proof_system/circuit_builder/eccvm/eccvm_circuit_builder.hpp"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

#include <benchmark/benchmark.h>

#include "barretenberg/benchmark/honk_bench/benchmark_utilities.hpp"
#include "barretenberg/benchmark/ultra_bench/benchmark_utilities.hpp"
#include "barretenberg/goblin/goblin.hpp"
#include "barretenberg/goblin/mock_circuits.hpp"
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
add_executable(plonk_bench plonk.bench.cpp)
# Each source represents a separate benchmark suite
set(BENCHMARK_SOURCES
plonk.bench.cpp
standard_plonk.bench.cpp
)

target_link_libraries(
plonk_bench
# Required libraries for benchmark suites
set(LINKED_LIBRARIES
plonk
stdlib_primitives
benchmark::benchmark
)

add_custom_target(
run_plonk_bench
COMMAND plonk_bench
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
# Add executable and custom target for each suite, e.g. ultra_honk_bench
foreach(BENCHMARK_SOURCE ${BENCHMARK_SOURCES})
get_filename_component(BENCHMARK_NAME ${BENCHMARK_SOURCE} NAME_WE) # extract name without extension
add_executable(${BENCHMARK_NAME}_bench main.bench.cpp ${BENCHMARK_SOURCE})
target_link_libraries(${BENCHMARK_NAME}_bench ${LINKED_LIBRARIES})
add_custom_target(run_${BENCHMARK_NAME} COMMAND ${BENCHMARK_NAME} WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
endforeach()
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <benchmark/benchmark.h>

BENCHMARK_MAIN();
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,4 @@ void verify_proofs_bench(State& state) noexcept
state.ResumeTiming();
}
}
BENCHMARK(verify_proofs_bench)->RangeMultiplier(2)->Range(START, MAX_GATES);

BENCHMARK_MAIN();
BENCHMARK(verify_proofs_bench)->RangeMultiplier(2)->Range(START, MAX_GATES);
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "barretenberg/benchmark/honk_bench/benchmark_utilities.hpp"
#include "barretenberg/benchmark/ultra_bench/benchmark_utilities.hpp"
#include "barretenberg/plonk/composer/standard_composer.hpp"
#include "barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# Each source represents a separate benchmark suite
set(BENCHMARK_SOURCES
standard_plonk.bench.cpp
goblin.bench.cpp
eccvm.bench.cpp
ultra_honk.bench.cpp
ultra_honk_rounds.bench.cpp
ultra_plonk.bench.cpp
Expand All @@ -12,7 +9,6 @@ set(BENCHMARK_SOURCES
# Required libraries for benchmark suites
set(LINKED_LIBRARIES
ultra_honk
eccvm
stdlib_sha256
stdlib_keccak
stdlib_merkle_tree
Expand All @@ -23,7 +19,7 @@ set(LINKED_LIBRARIES
# Add executable and custom target for each suite, e.g. ultra_honk_bench
foreach(BENCHMARK_SOURCE ${BENCHMARK_SOURCES})
get_filename_component(BENCHMARK_NAME ${BENCHMARK_SOURCE} NAME_WE) # extract name without extension
add_executable(${BENCHMARK_NAME}_bench main.bench.cpp ${BENCHMARK_SOURCE} benchmark_utilities.hpp)
add_executable(${BENCHMARK_NAME}_bench main.bench.cpp ${BENCHMARK_SOURCE})
target_link_libraries(${BENCHMARK_NAME}_bench ${LINKED_LIBRARIES})
add_custom_target(run_${BENCHMARK_NAME} COMMAND ${BENCHMARK_NAME} WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
endforeach()
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ PLONK_BENCH_RESULTS="$BENCH_RESULTS_DIR/plonk_bench.json"
cd ..
cmake --preset bench > /dev/null && cmake --build --preset bench --target ultra_honk_bench
cd build-bench
HONK_BENCH_RESULTS="$BENCH_RESULTS_DIR/honk_bench.json"
HONK_BENCH_RESULTS="$BENCH_RESULTS_DIR/ultra_bench.json"
./bin/ultra_honk_bench --benchmark_format=json > $HONK_BENCH_RESULTS

# Call compare.py on the results (json) to get high level statistics.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <benchmark/benchmark.h>

BENCHMARK_MAIN();
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <benchmark/benchmark.h>

#include "barretenberg/benchmark/honk_bench/benchmark_utilities.hpp"
#include "barretenberg/benchmark/ultra_bench/benchmark_utilities.hpp"
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"
#include "barretenberg/ultra_honk/ultra_composer.hpp"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <benchmark/benchmark.h>

#include "barretenberg/benchmark/honk_bench/benchmark_utilities.hpp"
#include "barretenberg/benchmark/ultra_bench/benchmark_utilities.hpp"
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"
#include "barretenberg/ultra_honk/ultra_composer.hpp"
#include "barretenberg/ultra_honk/ultra_prover.hpp"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "barretenberg/benchmark/honk_bench/benchmark_utilities.hpp"
#include "barretenberg/benchmark/ultra_bench/benchmark_utilities.hpp"
#include "barretenberg/plonk/composer/ultra_composer.hpp"
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <benchmark/benchmark.h>

#include "barretenberg/benchmark/honk_bench/benchmark_utilities.hpp"
#include "barretenberg/benchmark/ultra_bench/benchmark_utilities.hpp"
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"

using namespace benchmark;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "barretenberg/benchmark/honk_bench/benchmark_utilities.hpp"
#include "barretenberg/benchmark/ultra_bench/benchmark_utilities.hpp"
#include "barretenberg/flavor/goblin_ultra.hpp"
#include "barretenberg/flavor/ultra.hpp"
#include "barretenberg/plonk/composer/standard_composer.hpp"
Expand Down

0 comments on commit 768904d

Please sign in to comment.