diff --git a/barretenberg/cpp/scripts/benchmark_tracy.sh b/barretenberg/cpp/scripts/benchmark_tracy.sh index e39f6517bbc..f9b00282f42 100644 --- a/barretenberg/cpp/scripts/benchmark_tracy.sh +++ b/barretenberg/cpp/scripts/benchmark_tracy.sh @@ -29,6 +29,7 @@ ssh $BOX " ./tracy-capture -a 127.0.0.1 -f -o trace-$BENCHMARK & ; sleep 0.1 ; cd ~/aztec-packages/barretenberg/cpp/build-$PRESET ; + ninja $BENCHMARK ; $COMMAND ; " & wait # TODO(AD) hack - not sure why needed diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp index 74a47dd676b..857a70ddb5b 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp @@ -213,7 +213,10 @@ ClientIVC::Proof ClientIVC::prove() ASSERT(merge_verification_queue.size() == 1); // ensure only a single merge proof remains in the queue FoldProof& fold_proof = verification_queue[0].proof; MergeProof& merge_proof = merge_verification_queue[0]; - return { fold_proof, decider_prove(), goblin.prove(merge_proof) }; + HonkProof decider_proof = decider_prove(); + // Free the accumulator to save memory + fold_output.accumulator = nullptr; + return { fold_proof, std::move(decider_proof), goblin.prove(merge_proof) }; }; bool ClientIVC::verify(const Proof& proof, diff --git a/barretenberg/cpp/src/barretenberg/goblin/goblin.hpp b/barretenberg/cpp/src/barretenberg/goblin/goblin.hpp index 18415c42637..134db00a929 100644 --- a/barretenberg/cpp/src/barretenberg/goblin/goblin.hpp +++ b/barretenberg/cpp/src/barretenberg/goblin/goblin.hpp @@ -58,15 +58,14 @@ class GoblinProver { // on the first call to accumulate there is no merge proof to verify bool merge_proof_exists{ false }; - std::shared_ptr get_eccvm_proving_key() const { return eccvm_prover->key; } + std::shared_ptr get_eccvm_proving_key() const { return eccvm_key; } std::shared_ptr get_translator_proving_key() const { return translator_prover->key; } private: // TODO(https://github.com/AztecProtocol/barretenberg/issues/798) unique_ptr use is a hack - std::unique_ptr eccvm_builder; - std::unique_ptr translator_builder; std::unique_ptr translator_prover; std::unique_ptr eccvm_prover; + std::shared_ptr eccvm_key; GoblinAccumulationOutput accumulator; // Used only for ACIR methods for now @@ -171,11 +170,21 @@ class GoblinProver { */ void prove_eccvm() { - eccvm_builder = std::make_unique(op_queue); - eccvm_prover = std::make_unique(*eccvm_builder); - goblin_proof.eccvm_proof = eccvm_prover->construct_proof(); - goblin_proof.translation_evaluations = eccvm_prover->translation_evaluations; - }; + { + ZoneScopedN("Create ECCVMBuilder and ECCVMProver"); + auto eccvm_builder = std::make_unique(op_queue); + eccvm_prover = std::make_unique(*eccvm_builder); + } + { + ZoneScopedN("Construct ECCVM Proof"); + goblin_proof.eccvm_proof = eccvm_prover->construct_proof(); + } + + { + ZoneScopedN("Assign Translation Evaluations"); + goblin_proof.translation_evaluations = eccvm_prover->translation_evaluations; + } + } /** * @brief Construct a translator proof @@ -183,11 +192,23 @@ class GoblinProver { */ void prove_translator() { - translator_builder = std::make_unique( - eccvm_prover->translation_batching_challenge_v, eccvm_prover->evaluation_challenge_x, op_queue); - translator_prover = std::make_unique(*translator_builder, eccvm_prover->transcript); - goblin_proof.translator_proof = translator_prover->construct_proof(); - }; + fq translation_batching_challenge_v = eccvm_prover->translation_batching_challenge_v; + fq evaluation_challenge_x = eccvm_prover->evaluation_challenge_x; + std::shared_ptr transcript = eccvm_prover->transcript; + eccvm_key = eccvm_prover->key; + eccvm_prover = nullptr; + { + ZoneScopedN("Create TranslatorBuilder and TranslatorProver"); + auto translator_builder = + std::make_unique(translation_batching_challenge_v, evaluation_challenge_x, op_queue); + translator_prover = std::make_unique(*translator_builder, transcript); + } + + { + ZoneScopedN("Construct Translator Proof"); + goblin_proof.translator_proof = translator_prover->construct_proof(); + } + } /** * @brief Constuct a full Goblin proof (ECCVM, Translator, merge)