From 03887952ab5479ea5226731ec51935d06fe69aac Mon Sep 17 00:00:00 2001 From: ludamad Date: Thu, 22 Feb 2024 17:10:12 +0000 Subject: [PATCH] additional op count timing --- barretenberg/cpp/scripts/collect_profile_information.sh | 2 +- .../cpp/src/barretenberg/benchmark/ivc_bench/ivc.bench.cpp | 5 +++-- .../src/barretenberg/commitment_schemes/commitment_key.hpp | 2 ++ barretenberg/cpp/src/barretenberg/goblin/mock_circuits.hpp | 3 +++ .../proof_system/execution_trace/execution_trace.cpp | 1 - .../cpp/src/barretenberg/protogalaxy/protogalaxy_prover.hpp | 3 +++ 6 files changed, 12 insertions(+), 4 deletions(-) diff --git a/barretenberg/cpp/scripts/collect_profile_information.sh b/barretenberg/cpp/scripts/collect_profile_information.sh index ebc0249392e8..1323e157b020 100755 --- a/barretenberg/cpp/scripts/collect_profile_information.sh +++ b/barretenberg/cpp/scripts/collect_profile_information.sh @@ -15,7 +15,7 @@ cd $(dirname $0)/.. # Configure and build with xray preset. cmake --preset $PRESET -cmake --build --preset $PRESET +cmake --build --preset $PRESET --target $EXECUTABLE cd build-$PRESET diff --git a/barretenberg/cpp/src/barretenberg/benchmark/ivc_bench/ivc.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/ivc_bench/ivc.bench.cpp index 95eeb7d5b947..e9ba9ed185eb 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/ivc_bench/ivc.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/ivc_bench/ivc.bench.cpp @@ -98,6 +98,7 @@ BENCHMARK_DEFINE_F(IvcBench, Accumulate)(benchmark::State& state) // Perform a specified number of iterations of function/kernel accumulation for (auto _ : state) { + BB_REPORT_OP_COUNT_IN_BENCH(state); perform_ivc_accumulation_rounds(state, ivc); } } @@ -110,12 +111,12 @@ BENCHMARK_DEFINE_F(IvcBench, Decide)(benchmark::State& state) { ClientIVC ivc; - BB_REPORT_OP_COUNT_IN_BENCH(state); // Perform a specified number of iterations of function/kernel accumulation perform_ivc_accumulation_rounds(state, ivc); // Construct eccvm proof, measure only translator proof construction for (auto _ : state) { + BB_REPORT_OP_COUNT_IN_BENCH(state); ivc.decider_prove(); } } @@ -128,12 +129,12 @@ BENCHMARK_DEFINE_F(IvcBench, ECCVM)(benchmark::State& state) { ClientIVC ivc; - BB_REPORT_OP_COUNT_IN_BENCH(state); // Perform a specified number of iterations of function/kernel accumulation perform_ivc_accumulation_rounds(state, ivc); // Construct and measure eccvm only for (auto _ : state) { + BB_REPORT_OP_COUNT_IN_BENCH(state); ivc.goblin.prove_eccvm(); } } diff --git a/barretenberg/cpp/src/barretenberg/commitment_schemes/commitment_key.hpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/commitment_key.hpp index 73369a2965d7..c842e53177e3 100644 --- a/barretenberg/cpp/src/barretenberg/commitment_schemes/commitment_key.hpp +++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/commitment_key.hpp @@ -7,6 +7,7 @@ * simplify the codebase. */ +#include "barretenberg/common/op_count.hpp" #include "barretenberg/ecc/scalar_multiplication/scalar_multiplication.hpp" #include "barretenberg/numeric/bitop/pow.hpp" #include "barretenberg/polynomials/polynomial.hpp" @@ -64,6 +65,7 @@ template class CommitmentKey { */ Commitment commit(std::span polynomial) { + BB_OP_COUNT_TIME(); const size_t degree = polynomial.size(); ASSERT(degree <= srs->get_monomial_size()); return bb::scalar_multiplication::pippenger_unsafe( diff --git a/barretenberg/cpp/src/barretenberg/goblin/mock_circuits.hpp b/barretenberg/cpp/src/barretenberg/goblin/mock_circuits.hpp index 02500ee75b57..bc14c506539f 100644 --- a/barretenberg/cpp/src/barretenberg/goblin/mock_circuits.hpp +++ b/barretenberg/cpp/src/barretenberg/goblin/mock_circuits.hpp @@ -1,6 +1,7 @@ #pragma once #include "barretenberg/commitment_schemes/commitment_key.hpp" +#include "barretenberg/common/op_count.hpp" #include "barretenberg/crypto/ecdsa/ecdsa.hpp" #include "barretenberg/crypto/merkle_tree/membership.hpp" #include "barretenberg/crypto/merkle_tree/memory_store.hpp" @@ -95,6 +96,7 @@ class GoblinMockCircuits { */ static void construct_mock_function_circuit(GoblinUltraBuilder& builder, bool large = false) { + BB_OP_COUNT_TIME(); // Determine number of times to execute the below operations that constitute the mock circuit logic. Note that // the circuit size does not scale linearly with number of iterations due to e.g. amortization of lookup costs const size_t NUM_ITERATIONS_LARGE = 13; // results in circuit size 2^19 (521327 gates) @@ -216,6 +218,7 @@ class GoblinMockCircuits { const std::vector& function_fold_proof, const std::vector& kernel_fold_proof) { + BB_OP_COUNT_TIME(); using GURecursiveFlavor = GoblinUltraRecursiveFlavor_; using RecursiveVerifierInstances = ::bb::VerifierInstances_; using FoldingRecursiveVerifier = diff --git a/barretenberg/cpp/src/barretenberg/proof_system/execution_trace/execution_trace.cpp b/barretenberg/cpp/src/barretenberg/proof_system/execution_trace/execution_trace.cpp index 26532627539b..4cab2c635185 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/execution_trace/execution_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/execution_trace/execution_trace.cpp @@ -56,7 +56,6 @@ typename ExecutionTrace_::TraceData ExecutionTrace_::construct_t // For each block in the trace, populate wire polys, copy cycles and selector polys for (auto& block : trace_blocks) { auto block_size = static_cast(block.wires[0].size()); - info("block size = ", block_size); // Update wire polynomials and copy cycles // NB: The order of row/column loops is arbitrary but needs to be row/column to match old copy_cycle code diff --git a/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.hpp b/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.hpp index 0df61d1d82f1..4fd7689471e4 100644 --- a/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.hpp +++ b/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.hpp @@ -1,4 +1,5 @@ #pragma once +#include "barretenberg/common/op_count.hpp" #include "barretenberg/common/thread.hpp" #include "barretenberg/ecc/curves/bn254/fr.hpp" #include "barretenberg/flavor/flavor.hpp" @@ -247,6 +248,7 @@ template class ProtoGalaxyProver_ { static Polynomial compute_perturbator(const std::shared_ptr accumulator, const std::vector& deltas) { + BB_OP_COUNT_TIME(); auto full_honk_evaluations = compute_full_honk_evaluations( accumulator->prover_polynomials, accumulator->alphas, accumulator->relation_parameters); const auto betas = accumulator->gate_challenges; @@ -298,6 +300,7 @@ template class ProtoGalaxyProver_ { */ ExtendedUnivariateWithRandomization compute_combiner(const ProverInstances& instances, PowPolynomial& pow_betas) { + BB_OP_COUNT_TIME(); size_t common_instance_size = instances[0]->instance_size; pow_betas.compute_values(); // Determine number of threads for multithreading.