diff --git a/barretenberg/cpp/Earthfile b/barretenberg/cpp/Earthfile index c9049c4456f..a7e7438d1bb 100644 --- a/barretenberg/cpp/Earthfile +++ b/barretenberg/cpp/Earthfile @@ -230,6 +230,7 @@ bench-client-ivc: COPY --dir +bench-binaries/* . # install SRS needed for proving COPY --dir ./srs_db/+build/. srs_db + RUN cd release && ./bin/client_ivc_bench --benchmark_out=../client_ivc_17_in_20_release.json --benchmark_filter="ClientIVCBench/Ambient_17_in_20/6$" RUN cd release && ./bin/client_ivc_bench --benchmark_out=../client_ivc_release.json --benchmark_filter="ClientIVCBench/Full/6$" RUN cd op-count && ./bin/client_ivc_bench --benchmark_out=../client_ivc_op_count.json --benchmark_filter="ClientIVCBench/Full/6$" RUN cd op-count-time && ./bin/client_ivc_bench --benchmark_out=../client_ivc_op_count_time.json --benchmark_filter="ClientIVCBench/Full/6$" @@ -248,6 +249,7 @@ bench: END COPY ./scripts/ci/combine_benchmarks.py ./scripts/ci/combine_benchmarks.py RUN ./scripts/ci/combine_benchmarks.py \ + native client_ivc_17_in_20_release.json \ native client_ivc_release.json \ native ultra_honk_release.json \ wasm client_ivc_wasm.json \ diff --git a/barretenberg/cpp/src/barretenberg/benchmark/client_ivc_bench/client_ivc.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/client_ivc_bench/client_ivc.bench.cpp index 6033648972c..2acbb568272 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/client_ivc_bench/client_ivc.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/client_ivc_bench/client_ivc.bench.cpp @@ -45,9 +45,29 @@ BENCHMARK_DEFINE_F(ClientIVCBench, Full)(benchmark::State& state) } } +/** + * @brief Benchmark the prover work for the full PG-Goblin IVC protocol + * @details Processes "dense" circuits of size 2^17 in a size 2^20 structured trace + */ +BENCHMARK_DEFINE_F(ClientIVCBench, Ambient_17_in_20)(benchmark::State& state) +{ + ClientIVC ivc{ { E2E_FULL_TEST_STRUCTURE } }; + + auto total_num_circuits = 2 * static_cast(state.range(0)); // 2x accounts for kernel circuits + auto mocked_vkeys = mock_verification_keys(total_num_circuits); + + for (auto _ : state) { + BB_REPORT_OP_COUNT_IN_BENCH(state); + perform_ivc_accumulation_rounds( + total_num_circuits, ivc, mocked_vkeys, /* mock_vk */ true, /* large_first_app */ false); + ivc.prove(); + } +} + #define ARGS Arg(ClientIVCBench::NUM_ITERATIONS_MEDIUM_COMPLEXITY)->Arg(2) BENCHMARK_REGISTER_F(ClientIVCBench, Full)->Unit(benchmark::kMillisecond)->ARGS; +BENCHMARK_REGISTER_F(ClientIVCBench, Ambient_17_in_20)->Unit(benchmark::kMillisecond)->ARGS; } // namespace diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/mock_circuit_producer.hpp b/barretenberg/cpp/src/barretenberg/client_ivc/mock_circuit_producer.hpp index 49a7915f0ee..b2ba3f3656d 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/mock_circuit_producer.hpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/mock_circuit_producer.hpp @@ -96,7 +96,13 @@ class PrivateFunctionExecutionMockCircuitProducer { MockDatabusProducer mock_databus; + bool large_first_app = true; // if true, first app is 2^19, else 2^17 + public: + PrivateFunctionExecutionMockCircuitProducer(bool large_first_app = true) + : large_first_app(large_first_app) + {} + /** * @brief Create the next circuit (app/kernel) in a mocked private function execution stack */ @@ -113,7 +119,7 @@ class PrivateFunctionExecutionMockCircuitProducer { mock_databus.populate_kernel_databus(circuit); // populate databus inputs/outputs ivc.complete_kernel_circuit_logic(circuit); // complete with recursive verifiers etc } else { - bool use_large_circuit = (circuit_counter == 1); // first circuit is size 2^19 + bool use_large_circuit = large_first_app && (circuit_counter == 1); // first circuit is size 2^19 GoblinMockCircuits::construct_mock_app_circuit(circuit, use_large_circuit); // construct mock app mock_databus.populate_app_databus(circuit); // populate databus outputs } diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/test_bench_shared.hpp b/barretenberg/cpp/src/barretenberg/client_ivc/test_bench_shared.hpp index 44d07e4cd0f..07d20b5e02e 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/test_bench_shared.hpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/test_bench_shared.hpp @@ -33,11 +33,12 @@ bool verify_ivc(ClientIVC::Proof& proof, ClientIVC& ivc) void perform_ivc_accumulation_rounds(size_t NUM_CIRCUITS, ClientIVC& ivc, auto& precomputed_vks, - const bool& mock_vk = false) + const bool& mock_vk = false, + const bool large_first_app = true) { ASSERT(precomputed_vks.size() == NUM_CIRCUITS); // ensure presence of a precomputed VK for each circuit - PrivateFunctionExecutionMockCircuitProducer circuit_producer; + PrivateFunctionExecutionMockCircuitProducer circuit_producer(large_first_app); for (size_t circuit_idx = 0; circuit_idx < NUM_CIRCUITS; ++circuit_idx) { MegaCircuitBuilder circuit;