From 035cff451ca2171e08279b9d36b23f38b840efea Mon Sep 17 00:00:00 2001 From: ledwards2225 <98505400+ledwards2225@users.noreply.github.com> Date: Wed, 28 Feb 2024 17:51:41 -0700 Subject: [PATCH] fix: use size hint for ivc circuits (#4802) Adds size hint (2^17) to ivc bench circuits so wire/selector vector memory can be reserved in advance of circuit construction. --- .../benchmark/client_ivc_bench/client_ivc.bench.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 1e10564f6f7..cbdfcb2c0c8 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 @@ -41,13 +41,14 @@ class ClientIVCBench : public benchmark::Fixture { */ static void perform_ivc_accumulation_rounds(State& state, ClientIVC& ivc) { + const size_t size_hint = 1 << 17; // Size hint for reserving wires/selector vector memory in builders // Initialize IVC with function circuit - Builder function_circuit{ ivc.goblin.op_queue }; + Builder function_circuit{ size_hint, ivc.goblin.op_queue }; GoblinMockCircuits::construct_mock_function_circuit(function_circuit); ivc.initialize(function_circuit); // Accumulate kernel circuit (first kernel mocked as simple circuit since no folding proofs yet) - Builder kernel_circuit{ ivc.goblin.op_queue }; + Builder kernel_circuit{ size_hint, ivc.goblin.op_queue }; GoblinMockCircuits::construct_mock_function_circuit(kernel_circuit); auto kernel_fold_proof = ivc.accumulate(kernel_circuit); @@ -56,12 +57,12 @@ class ClientIVCBench : public benchmark::Fixture { for (size_t circuit_idx = 0; circuit_idx < NUM_CIRCUITS; ++circuit_idx) { // Accumulate function circuit - Builder function_circuit{ ivc.goblin.op_queue }; + Builder function_circuit{ size_hint, ivc.goblin.op_queue }; GoblinMockCircuits::construct_mock_function_circuit(function_circuit); auto function_fold_proof = ivc.accumulate(function_circuit); // Accumulate kernel circuit - Builder kernel_circuit{ ivc.goblin.op_queue }; + Builder kernel_circuit{ size_hint, ivc.goblin.op_queue }; GoblinMockCircuits::construct_mock_folding_kernel(kernel_circuit, function_fold_proof, kernel_fold_proof); auto kernel_fold_proof = ivc.accumulate(kernel_circuit); }