diff --git a/barretenberg/cpp/scripts/analyze_client_ivc_bench.py b/barretenberg/cpp/scripts/analyze_client_ivc_bench.py index 4feaa6577a6..600854679c5 100755 --- a/barretenberg/cpp/scripts/analyze_client_ivc_bench.py +++ b/barretenberg/cpp/scripts/analyze_client_ivc_bench.py @@ -18,30 +18,11 @@ "construct_circuits(t)", "DeciderProvingKey(Circuit&)(t)", "ProtogalaxyProver::prove(t)", - "oink_constructor(t)", -# "execute_preamble_round(t)", -# "execute_wire_commitments_round(t)", -# "execute_sorted_list_accumulator_round(t)", -# "execute_log_derivative_inverse_round(t)", -# "compute_logderivative_inverses(t)", -"execute_grand_product_computation_round(t)", -# "compute_grand_product(t)", -"MegaFlavor::get_row(t)", -"fr::batch_invert(t)", -"total(t)", -"inner commit structured(t)", -"this(t)", -"add_in_place(t)", -"finalise_result(t)", -"hum(t)", - "point_table(t)", - "simple commit(t)" - - # "Decider::construct_proof(t)", - # "ECCVMProver(CircuitBuilder&)(t)", - # "ECCVMProver::construct_proof(t)", - # "TranslatorProver::construct_proof(t)", - # "Goblin::merge(t)" + "Decider::construct_proof(t)", + "ECCVMProver(CircuitBuilder&)(t)", + "ECCVMProver::construct_proof(t)", + "TranslatorProver::construct_proof(t)", + "Goblin::merge(t)" ] with open(PREFIX / IVC_BENCH_JSON, "r") as read_file: 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 6f189179dd9..6033648972c 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 @@ -33,7 +33,6 @@ class ClientIVCBench : public benchmark::Fixture { */ BENCHMARK_DEFINE_F(ClientIVCBench, Full)(benchmark::State& state) { - // ClientIVC ivc{ { EXAMPLE_20 } }; ClientIVC ivc{ { CLIENT_IVC_BENCH_STRUCTURE } }; auto total_num_circuits = 2 * static_cast(state.range(0)); // 2x accounts for kernel circuits diff --git a/barretenberg/cpp/src/barretenberg/commitment_schemes/commitment_key.hpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/commitment_key.hpp index d7bd87d9db4..81ef54a2b9d 100644 --- a/barretenberg/cpp/src/barretenberg/commitment_schemes/commitment_key.hpp +++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/commitment_key.hpp @@ -85,7 +85,7 @@ template class CommitmentKey { */ Commitment commit(PolynomialSpan polynomial) { - // PROFILE_THIS(); + PROFILE_THIS_NAME("commit"); // We must have a power-of-2 SRS points *after* subtracting by start_index. size_t dyadic_poly_size = numeric::round_up_power_2(polynomial.size()); // Because pippenger prefers a power-of-2 size, we must choose a starting index for the points so that we don't @@ -133,7 +133,7 @@ template class CommitmentKey { */ Commitment commit_sparse(PolynomialSpan polynomial) { - // PROFILE_THIS(); + PROFILE_THIS_NAME("commit_sparse"); const size_t poly_size = polynomial.size(); ASSERT(polynomial.end_index() <= srs->get_monomial_size()); @@ -207,7 +207,7 @@ template class CommitmentKey { const std::vector>& active_ranges, size_t final_active_wire_idx = 0) { - // BB_OP_COUNT_TIME(); + PROFILE_THIS_NAME("commit_structured"); ASSERT(polynomial.end_index() <= srs->get_monomial_size()); // Percentage of nonzero coefficients beyond which we resort to the conventional commit method @@ -215,8 +215,8 @@ template class CommitmentKey { // Compute the number of non-zero coefficients in the polynomial size_t total_num_scalars = 0; - for (const auto& range : active_ranges) { - total_num_scalars += range.second - range.first; + for (const auto& [first, second] : active_ranges) { + total_num_scalars += second - first; } // Compute "active" percentage of polynomial; resort to standard commit if appropriate @@ -265,7 +265,7 @@ template class CommitmentKey { const std::vector>& active_ranges, size_t final_active_wire_idx = 0) { - PROFILE_THIS_NAME("total"); + PROFILE_THIS_NAME("commit_structured_with_nonzero_complement"); ASSERT(polynomial.end_index() <= srs->get_monomial_size()); using BatchedAddition = BatchedAffineAddition; @@ -277,9 +277,8 @@ template class CommitmentKey { // Note: the range from the end of the last active range to the end of the polynomial is excluded from the // complement since the polynomial is assumed to be zero there. std::vector> active_ranges_complement; - // Compute the total number of scalars in the constant regions + // Also compute total number of scalars in the constant regions size_t total_num_complement_scalars = 0; - for (size_t i = 0; i < active_ranges.size() - 1; ++i) { const size_t start = active_ranges[i].second; const size_t end = active_ranges[i + 1].first; @@ -303,8 +302,7 @@ template class CommitmentKey { // Copy the raw SRS points (no endo points) corresponding to the constant regions into contiguous memory // TODO(https://github.com/AztecProtocol/barretenberg/issues/1131): Peak memory usage could be improved by - // performing this copy and the subsequent summation as a precomputation prior to constructing the point - // table. + // performing this copy and the subsequent summation as a precomputation prior to constructing the point table. std::vector points; points.reserve(total_num_complement_scalars); @@ -326,8 +324,7 @@ template class CommitmentKey { // Reduce each sequence to a single point auto reduced_points = BatchedAddition::add_in_place(points, sequence_counts); - // Compute the full commitment as the sum of the "active" region commitment and the constant region - // contribution + // Compute the full commitment as the sum of the "active" region commitment and the constant region contribution Commitment result = commit_structured(polynomial, active_ranges, final_active_wire_idx); for (auto [scalar, point] : zip_view(unique_scalars, reduced_points)) { diff --git a/barretenberg/cpp/src/barretenberg/ecc/batched_affine_addition/batched_affine_addition.cpp b/barretenberg/cpp/src/barretenberg/ecc/batched_affine_addition/batched_affine_addition.cpp index dc6b3022fe9..058bce37738 100644 --- a/barretenberg/cpp/src/barretenberg/ecc/batched_affine_addition/batched_affine_addition.cpp +++ b/barretenberg/cpp/src/barretenberg/ecc/batched_affine_addition/batched_affine_addition.cpp @@ -10,7 +10,7 @@ template std::vector::G1> BatchedAffineAddition::add_in_place( const std::span& points, const std::vector& sequence_counts) { - PROFILE_THIS_NAME("add_in_place"); + PROFILE_THIS_NAME("BatchedAffineAddition::add_in_place"); // Instantiate scratch space for point addition denominators and their calculation std::vector scratch_space_vector(points.size()); std::span scratch_space(scratch_space_vector); diff --git a/barretenberg/cpp/src/barretenberg/ecc/fields/field_impl.hpp b/barretenberg/cpp/src/barretenberg/ecc/fields/field_impl.hpp index a5126513f77..5a747150eb1 100644 --- a/barretenberg/cpp/src/barretenberg/ecc/fields/field_impl.hpp +++ b/barretenberg/cpp/src/barretenberg/ecc/fields/field_impl.hpp @@ -416,7 +416,6 @@ template void field::batch_invert(std::span coeffs) noexcept auto* skipped = skipped_ptr.get(); field accumulator = one(); - for (size_t i = 0; i < n; ++i) { temporaries[i] = accumulator; if (coeffs[i].is_zero()) { @@ -446,7 +445,6 @@ template void field::batch_invert(std::span coeffs) noexcept accumulator = accumulator.invert(); field T0; - for (size_t i = n - 1; i < n; --i) { if (!skipped[i]) { T0 = accumulator * temporaries[i]; diff --git a/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp b/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp index 98bdd4b8d51..e6fe7ef2aa3 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp @@ -123,7 +123,7 @@ template class ProvingKey_ { // folded element by element. std::vector public_inputs; - // Ranges of the form [start, end) where witnesses have nontrivial values (hence the execution trace is "active") + // Ranges of the form [start, end) where witnesses have non-zero values (hence the execution trace is "active") std::vector> active_block_ranges; ProvingKey_() = default; diff --git a/barretenberg/cpp/src/barretenberg/plonk_honk_shared/library/grand_product_library.hpp b/barretenberg/cpp/src/barretenberg/plonk_honk_shared/library/grand_product_library.hpp index f68826178f3..ee7eeb3c437 100644 --- a/barretenberg/cpp/src/barretenberg/plonk_honk_shared/library/grand_product_library.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk_honk_shared/library/grand_product_library.hpp @@ -69,7 +69,7 @@ void compute_grand_product(typename Flavor::ProverPolynomials& full_polynomials, // the permutation grand product does not need to be computed beyond the index of the last active wire size_t domain_size = size_override == 0 ? full_polynomials.get_polynomial_size() : size_override; - size_t num_threads = domain_size >= get_num_cpus_pow2() ? get_num_cpus_pow2() : 1; + const size_t num_threads = domain_size >= get_num_cpus_pow2() ? get_num_cpus_pow2() : 1; const size_t block_size = domain_size / num_threads; const size_t final_idx = domain_size - 1; diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_flavor.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_flavor.hpp index feffc7e53c8..f34d0b48733 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_flavor.hpp @@ -328,7 +328,7 @@ class UltraFlavor { [[nodiscard]] size_t get_polynomial_size() const { return q_c.size(); } [[nodiscard]] AllValues get_row(const size_t row_idx) const { - PROFILE_THIS_NAME("get_row"); + PROFILE_THIS_NAME("UltraFlavor::get_row"); AllValues result; for (auto [result_field, polynomial] : zip_view(result.get_all(), get_all())) { result_field = polynomial[row_idx]; diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/oink_prover.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/oink_prover.cpp index 48a5f7430d7..7377c7b31c7 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/oink_prover.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/oink_prover.cpp @@ -239,7 +239,6 @@ template void OinkProver::execute_grand_product_c proving_key->proving_key.compute_grand_product_polynomial(proving_key->relation_parameters, proving_key->final_active_wire_idx + 1); - info("final active wire ", proving_key->final_active_wire_idx + 1); { PROFILE_THIS_NAME("COMMIT::z_perm"); if (proving_key->get_is_structured()) {