diff --git a/barretenberg/cpp/CMakePresets.json b/barretenberg/cpp/CMakePresets.json index 075068e6cd4..d967017743f 100644 --- a/barretenberg/cpp/CMakePresets.json +++ b/barretenberg/cpp/CMakePresets.json @@ -166,6 +166,16 @@ "LDFLAGS": "-fsanitize=memory" } }, + { + "name": "op-counting", + "displayName": "Release build with operation counts for benchmarks", + "description": "Build with op counting", + "inherits": "clang16", + "binaryDir": "build-op-counting", + "environment": { + "CXXFLAGS": "-DBB_USE_OP_COUNT" + } + }, { "name": "coverage", "displayName": "Build with coverage", @@ -300,6 +310,11 @@ "inherits": "default", "configurePreset": "clang16" }, + { + "name": "op-counting", + "inherits": "default", + "configurePreset": "op-counting" + }, { "name": "clang16-dbg", "inherits": "default", diff --git a/barretenberg/cpp/src/barretenberg/benchmark/basics_bench/basics.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/basics_bench/basics.bench.cpp index c3bf090f2cf..03614693396 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/basics_bench/basics.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/basics_bench/basics.bench.cpp @@ -20,6 +20,7 @@ * sequential_copy: 3.3 * */ +#include "barretenberg/common/op_count.hpp" #include "barretenberg/common/thread.hpp" #include "barretenberg/ecc/curves/bn254/bn254.hpp" #include diff --git a/barretenberg/cpp/src/barretenberg/benchmark/goblin_bench/goblin.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/goblin_bench/goblin.bench.cpp index 9c8fd4e51b7..44e68a5065c 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/goblin_bench/goblin.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/goblin_bench/goblin.bench.cpp @@ -2,6 +2,7 @@ #include #include "barretenberg/benchmark/ultra_bench/mock_proofs.hpp" +#include "barretenberg/common/op_count_google_bench.hpp" #include "barretenberg/goblin/goblin.hpp" #include "barretenberg/goblin/mock_circuits.hpp" #include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp" @@ -67,6 +68,7 @@ BENCHMARK_DEFINE_F(GoblinBench, GoblinFull)(benchmark::State& state) GoblinMockCircuits::perform_op_queue_interactions_for_mock_first_circuit(goblin.op_queue); for (auto _ : state) { + BB_REPORT_OP_COUNT_IN_BENCH(state); // Perform a specified number of iterations of function/kernel accumulation perform_goblin_accumulation_rounds(state, goblin); diff --git a/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_honk_rounds.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_honk_rounds.bench.cpp index e91343143a8..088308eb7db 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_honk_rounds.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_honk_rounds.bench.cpp @@ -1,6 +1,7 @@ #include #include "barretenberg/benchmark/ultra_bench/mock_proofs.hpp" +#include "barretenberg/common/op_count_google_bench.hpp" #include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp" #include "barretenberg/ultra_honk/ultra_composer.hpp" #include "barretenberg/ultra_honk/ultra_prover.hpp" @@ -27,15 +28,20 @@ enum { * @param prover - The ultrahonk prover. * @param index - The pass to measure. **/ -BBERG_PROFILE static void test_round_inner(State& state, UltraProver& prover, size_t index) noexcept +BB_PROFILE static void test_round_inner(State& state, UltraProver& prover, size_t index) noexcept { auto time_if_index = [&](size_t target_index, auto&& func) -> void { + BB_REPORT_OP_COUNT_IN_BENCH(state); if (index == target_index) { state.ResumeTiming(); } + func(); if (index == target_index) { state.PauseTiming(); + } else { + // We don't actually want to write to user-defined counters + BB_REPORT_OP_COUNT_BENCH_CANCEL(); } }; @@ -47,7 +53,7 @@ BBERG_PROFILE static void test_round_inner(State& state, UltraProver& prover, si time_if_index(RELATION_CHECK, [&] { prover.execute_relation_check_rounds(); }); time_if_index(ZEROMORPH, [&] { prover.execute_zeromorph_rounds(); }); } -BBERG_PROFILE static void test_round(State& state, size_t index) noexcept +BB_PROFILE static void test_round(State& state, size_t index) noexcept { bb::srs::init_crs_factory("../srs_db/ignition"); diff --git a/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_plonk_rounds.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_plonk_rounds.bench.cpp index 45e82fe144e..8fa44c08809 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_plonk_rounds.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/ultra_bench/ultra_plonk_rounds.bench.cpp @@ -17,7 +17,7 @@ enum { SIXTH_BATCH_OPEN }; -BBERG_PROFILE static void plonk_round( +BB_PROFILE static void plonk_round( State& state, plonk::UltraProver& prover, size_t target_index, size_t index, auto&& func) noexcept { if (index == target_index) { @@ -37,7 +37,7 @@ BBERG_PROFILE static void plonk_round( * @param prover - The ultraplonk prover. * @param index - The pass to measure. **/ -BBERG_PROFILE static void test_round_inner(State& state, plonk::UltraProver& prover, size_t index) noexcept +BB_PROFILE static void test_round_inner(State& state, plonk::UltraProver& prover, size_t index) noexcept { plonk_round(state, prover, PREAMBLE, index, [&] { prover.execute_preamble_round(); }); plonk_round(state, prover, FIRST_WIRE_COMMITMENTS, index, [&] { prover.execute_first_round(); }); @@ -47,7 +47,7 @@ BBERG_PROFILE static void test_round_inner(State& state, plonk::UltraProver& pro plonk_round(state, prover, FIFTH_COMPUTE_QUOTIENT_EVALUTION, index, [&] { prover.execute_fifth_round(); }); plonk_round(state, prover, SIXTH_BATCH_OPEN, index, [&] { prover.execute_sixth_round(); }); } -BBERG_PROFILE static void test_round(State& state, size_t index) noexcept +BB_PROFILE static void test_round(State& state, size_t index) noexcept { bb::srs::init_crs_factory("../srs_db/ignition"); for (auto _ : state) { diff --git a/barretenberg/cpp/src/barretenberg/common/compiler_hints.hpp b/barretenberg/cpp/src/barretenberg/common/compiler_hints.hpp index 1815816a3c4..9492475cc1c 100644 --- a/barretenberg/cpp/src/barretenberg/common/compiler_hints.hpp +++ b/barretenberg/cpp/src/barretenberg/common/compiler_hints.hpp @@ -1,16 +1,26 @@ #pragma once #ifdef _WIN32 -#define BBERG_INLINE __forceinline inline +#define BB_INLINE __forceinline inline #else -#define BBERG_INLINE __attribute__((always_inline)) inline +#define BB_INLINE __attribute__((always_inline)) inline #endif // TODO(AD): Other instrumentation? #ifdef XRAY -#define BBERG_PROFILE [[clang::xray_always_instrument]] [[clang::noinline]] -#define BBERG_NO_PROFILE [[clang::xray_never_instrument]] +#define BB_PROFILE [[clang::xray_always_instrument]] [[clang::noinline]] +#define BB_NO_PROFILE [[clang::xray_never_instrument]] #else -#define BBERG_PROFILE -#define BBERG_NO_PROFILE +#define BB_PROFILE +#define BB_NO_PROFILE +#endif + +// Optimization hints for clang - which outcome of an expression is expected for better +// branch-prediction optimization +#ifdef __clang__ +#define BB_LIKELY(x) __builtin_expect(!!(x), 1) +#define BB_UNLIKELY(x) __builtin_expect(!!(x), 0) +#else +#define BB_LIKELY(x) x +#define BB_UNLIKELY(x) x #endif \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/common/op_count.cpp b/barretenberg/cpp/src/barretenberg/common/op_count.cpp new file mode 100644 index 00000000000..c646c88d829 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/common/op_count.cpp @@ -0,0 +1,51 @@ + +#include +#ifdef BB_USE_OP_COUNT +#include "op_count.hpp" +#include +#include +#include + +namespace bb::detail { +void GlobalOpCountContainer::add_entry(const char* key, std::size_t* count) +{ + std::unique_lock lock(mutex); + std::stringstream ss; + ss << std::this_thread::get_id(); + counts.push_back({ key, ss.str(), count }); +} + +void GlobalOpCountContainer::print() const +{ + std::cout << "print_op_counts() START" << std::endl; + for (const Entry& entry : counts) { + if (*entry.count > 0) { + std::cout << entry.key << "\t" << *entry.count << "\t[thread=" << entry.thread_id << "]" << std::endl; + } + } + std::cout << "print_op_counts() END" << std::endl; +} + +std::map GlobalOpCountContainer::get_aggregate_counts() const +{ + std::map aggregate_counts; + for (const Entry& entry : counts) { + if (*entry.count > 0) { + aggregate_counts[entry.key] += *entry.count; + } + } + return aggregate_counts; +} + +void GlobalOpCountContainer::clear() +{ + std::unique_lock lock(mutex); + for (Entry& entry : counts) { + *entry.count = 0; + } +} + +// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) +GlobalOpCountContainer GLOBAL_OP_COUNTS; +} // namespace bb::detail +#endif diff --git a/barretenberg/cpp/src/barretenberg/common/op_count.hpp b/barretenberg/cpp/src/barretenberg/common/op_count.hpp new file mode 100644 index 00000000000..57600138fe2 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/common/op_count.hpp @@ -0,0 +1,87 @@ + +#pragma once + +#ifndef BB_USE_OP_COUNT +// require a semicolon to appease formatters +// NOLINTNEXTLINE(cppcoreguidelines-macro-usage) +#define BB_OP_COUNT_TRACK() (void)0 +// NOLINTNEXTLINE(cppcoreguidelines-macro-usage) +#define BB_OP_COUNT_TRACK_NAME(name) (void)0 +#else +/** + * Provides an abstraction that counts operations based on function names. + * For efficiency, we spread out counts across threads. + */ + +#include "barretenberg/common/compiler_hints.hpp" +#include +#include +#include +#include +#include +#include +#include +namespace bb::detail { +// Compile-time string +// See e.g. https://www.reddit.com/r/cpp_questions/comments/pumi9r/does_c20_not_support_string_literals_as_template/ +template struct OperationLabel { + // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays) + constexpr OperationLabel(const char (&str)[N]) + { + for (std::size_t i = 0; i < N; ++i) { + value[i] = str[i]; + } + } + + // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays) + char value[N]; +}; + +// Contains all statically known op counts +struct GlobalOpCountContainer { + public: + struct Entry { + std::string key; + std::string thread_id; + std::size_t* count; + }; + std::mutex mutex; + std::vector counts; + void print() const; + // NOTE: Should be called when other threads aren't active + void clear(); + void add_entry(const char* key, std::size_t* count); + std::map get_aggregate_counts() const; +}; + +// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) +extern GlobalOpCountContainer GLOBAL_OP_COUNTS; + +template struct GlobalOpCount { + public: + // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) + static thread_local std::size_t* thread_local_count; + + static constexpr void increment_op_count() + { + if (std::is_constant_evaluated()) { + // We do nothing if the compiler tries to run this + return; + } + if (BB_UNLIKELY(thread_local_count == nullptr)) { + thread_local_count = new std::size_t(); + GLOBAL_OP_COUNTS.add_entry(Op.value, thread_local_count); + } + (*thread_local_count)++; + } +}; +// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) +template thread_local std::size_t* GlobalOpCount::thread_local_count; + +} // namespace bb::detail + +// NOLINTNEXTLINE(cppcoreguidelines-macro-usage) +#define BB_OP_COUNT_TRACK() bb::detail::GlobalOpCount<__func__>::increment_op_count() +// NOLINTNEXTLINE(cppcoreguidelines-macro-usage) +#define BB_OP_COUNT_TRACK_NAME(name) bb::detail::GlobalOpCount::increment_op_count() +#endif \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/common/op_count_google_bench.hpp b/barretenberg/cpp/src/barretenberg/common/op_count_google_bench.hpp new file mode 100644 index 00000000000..f872df1544b --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/common/op_count_google_bench.hpp @@ -0,0 +1,50 @@ + +#pragma once +#include + +#ifndef BB_USE_OP_COUNT +namespace bb { +struct GoogleBenchOpCountReporter { + GoogleBenchOpCountReporter(::benchmark::State& state) + { + // unused, we don't have op counts on + (void)state; + } +}; +}; // namespace bb +// require a semicolon to appease formatters +#define BB_REPORT_OP_COUNT_IN_BENCH(state) (void)0 +#define BB_REPORT_OP_COUNT_BENCH_CANCEL() (void)0 +#else +#include "op_count.hpp" +namespace bb { +// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions) +struct GoogleBenchOpCountReporter { + // We allow having a ref member as this only lives inside a function frame + ::benchmark::State& state; + bool cancelled = false; + GoogleBenchOpCountReporter(::benchmark::State& state) + : state(state) + { + // Intent: Clear when we enter the state loop + bb::detail::GLOBAL_OP_COUNTS.clear(); + } + ~GoogleBenchOpCountReporter() + { + // Allow for conditional reporting + if (cancelled) { + return; + } + // Intent: Collect results when we exit the state loop + for (auto& entry : bb::detail::GLOBAL_OP_COUNTS.get_aggregate_counts()) { + state.counters[entry.first] = static_cast(entry.second); + } + } +}; +// Allow for integration with google benchmark user-defined counters +// NOLINTNEXTLINE(cppcoreguidelines-macro-usage) +#define BB_REPORT_OP_COUNT_IN_BENCH(state) GoogleBenchOpCountReporter __bb_report_op_count_in_bench{ state }; +// NOLINTNEXTLINE(cppcoreguidelines-macro-usage) +#define BB_REPORT_OP_COUNT_BENCH_CANCEL() __bb_report_op_count_in_bench.cancelled = true; +}; // namespace bb +#endif \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/common/parallel_for_mutex_pool.cpp b/barretenberg/cpp/src/barretenberg/common/parallel_for_mutex_pool.cpp index d3a1afac509..7c85c03927c 100644 --- a/barretenberg/cpp/src/barretenberg/common/parallel_for_mutex_pool.cpp +++ b/barretenberg/cpp/src/barretenberg/common/parallel_for_mutex_pool.cpp @@ -52,7 +52,7 @@ class ThreadPool { std::condition_variable complete_condition_; bool stop = false; - BBERG_NO_PROFILE void worker_loop(size_t thread_index); + BB_NO_PROFILE void worker_loop(size_t thread_index); void do_iterations() { diff --git a/barretenberg/cpp/src/barretenberg/ecc/fields/field_declarations.hpp b/barretenberg/cpp/src/barretenberg/ecc/fields/field_declarations.hpp index 217e2b42bd2..af92a45ae16 100644 --- a/barretenberg/cpp/src/barretenberg/ecc/fields/field_declarations.hpp +++ b/barretenberg/cpp/src/barretenberg/ecc/fields/field_declarations.hpp @@ -214,39 +214,39 @@ template struct alignas(32) field { return result; } - BBERG_INLINE constexpr field operator*(const field& other) const noexcept; - BBERG_INLINE constexpr field operator+(const field& other) const noexcept; - BBERG_INLINE constexpr field operator-(const field& other) const noexcept; - BBERG_INLINE constexpr field operator-() const noexcept; + BB_INLINE constexpr field operator*(const field& other) const noexcept; + BB_INLINE constexpr field operator+(const field& other) const noexcept; + BB_INLINE constexpr field operator-(const field& other) const noexcept; + BB_INLINE constexpr field operator-() const noexcept; constexpr field operator/(const field& other) const noexcept; // prefix increment (++x) - BBERG_INLINE constexpr field operator++() noexcept; + BB_INLINE constexpr field operator++() noexcept; // postfix increment (x++) // NOLINTNEXTLINE - BBERG_INLINE constexpr field operator++(int) noexcept; + BB_INLINE constexpr field operator++(int) noexcept; - BBERG_INLINE constexpr field& operator*=(const field& other) noexcept; - BBERG_INLINE constexpr field& operator+=(const field& other) noexcept; - BBERG_INLINE constexpr field& operator-=(const field& other) noexcept; + BB_INLINE constexpr field& operator*=(const field& other) noexcept; + BB_INLINE constexpr field& operator+=(const field& other) noexcept; + BB_INLINE constexpr field& operator-=(const field& other) noexcept; constexpr field& operator/=(const field& other) noexcept; // NOTE: comparison operators exist so that `field` is comparible with stl methods that require them. // (e.g. std::sort) // Finite fields do not have an explicit ordering, these should *NEVER* be used in algebraic algorithms. - BBERG_INLINE constexpr bool operator>(const field& other) const noexcept; - BBERG_INLINE constexpr bool operator<(const field& other) const noexcept; - BBERG_INLINE constexpr bool operator==(const field& other) const noexcept; - BBERG_INLINE constexpr bool operator!=(const field& other) const noexcept; + BB_INLINE constexpr bool operator>(const field& other) const noexcept; + BB_INLINE constexpr bool operator<(const field& other) const noexcept; + BB_INLINE constexpr bool operator==(const field& other) const noexcept; + BB_INLINE constexpr bool operator!=(const field& other) const noexcept; - BBERG_INLINE constexpr field to_montgomery_form() const noexcept; - BBERG_INLINE constexpr field from_montgomery_form() const noexcept; + BB_INLINE constexpr field to_montgomery_form() const noexcept; + BB_INLINE constexpr field from_montgomery_form() const noexcept; - BBERG_INLINE constexpr field sqr() const noexcept; - BBERG_INLINE constexpr void self_sqr() noexcept; + BB_INLINE constexpr field sqr() const noexcept; + BB_INLINE constexpr void self_sqr() noexcept; - BBERG_INLINE constexpr field pow(const uint256_t& exponent) const noexcept; - BBERG_INLINE constexpr field pow(uint64_t exponent) const noexcept; + BB_INLINE constexpr field pow(const uint256_t& exponent) const noexcept; + BB_INLINE constexpr field pow(uint64_t exponent) const noexcept; static constexpr uint256_t modulus_minus_two = uint256_t(Params::modulus_0 - 2ULL, Params::modulus_1, Params::modulus_2, Params::modulus_3); constexpr field invert() const noexcept; @@ -259,21 +259,21 @@ template struct alignas(32) field { */ constexpr std::pair sqrt() const noexcept; - BBERG_INLINE constexpr void self_neg() noexcept; + BB_INLINE constexpr void self_neg() noexcept; - BBERG_INLINE constexpr void self_to_montgomery_form() noexcept; - BBERG_INLINE constexpr void self_from_montgomery_form() noexcept; + BB_INLINE constexpr void self_to_montgomery_form() noexcept; + BB_INLINE constexpr void self_from_montgomery_form() noexcept; - BBERG_INLINE constexpr void self_conditional_negate(uint64_t predicate) noexcept; + BB_INLINE constexpr void self_conditional_negate(uint64_t predicate) noexcept; - BBERG_INLINE constexpr field reduce_once() const noexcept; - BBERG_INLINE constexpr void self_reduce_once() noexcept; + BB_INLINE constexpr field reduce_once() const noexcept; + BB_INLINE constexpr void self_reduce_once() noexcept; - BBERG_INLINE constexpr void self_set_msb() noexcept; - [[nodiscard]] BBERG_INLINE constexpr bool is_msb_set() const noexcept; - [[nodiscard]] BBERG_INLINE constexpr uint64_t is_msb_set_word() const noexcept; + BB_INLINE constexpr void self_set_msb() noexcept; + [[nodiscard]] BB_INLINE constexpr bool is_msb_set() const noexcept; + [[nodiscard]] BB_INLINE constexpr uint64_t is_msb_set_word() const noexcept; - [[nodiscard]] BBERG_INLINE constexpr bool is_zero() const noexcept; + [[nodiscard]] BB_INLINE constexpr bool is_zero() const noexcept; static constexpr field get_root_of_unity(size_t subgroup_size) noexcept; @@ -281,15 +281,15 @@ template struct alignas(32) field { static field serialize_from_buffer(const uint8_t* buffer) { return from_buffer(buffer); } - [[nodiscard]] BBERG_INLINE std::vector to_buffer() const { return ::to_buffer(*this); } + [[nodiscard]] BB_INLINE std::vector to_buffer() const { return ::to_buffer(*this); } struct wide_array { uint64_t data[8]; // NOLINT }; - BBERG_INLINE constexpr wide_array mul_512(const field& other) const noexcept; - BBERG_INLINE constexpr wide_array sqr_512() const noexcept; + BB_INLINE constexpr wide_array mul_512(const field& other) const noexcept; + BB_INLINE constexpr wide_array sqr_512() const noexcept; - BBERG_INLINE constexpr field conditionally_subtract_from_double_modulus(const uint64_t predicate) const noexcept + BB_INLINE constexpr field conditionally_subtract_from_double_modulus(const uint64_t predicate) const noexcept { if (predicate != 0) { constexpr field p{ @@ -436,8 +436,8 @@ template struct alignas(32) field { return os; } - BBERG_INLINE static void __copy(const field& a, field& r) noexcept { r = a; } // NOLINT - BBERG_INLINE static void __swap(field& src, field& dest) noexcept // NOLINT + BB_INLINE static void __copy(const field& a, field& r) noexcept { r = a; } // NOLINT + BB_INLINE static void __swap(field& src, field& dest) noexcept // NOLINT { field T = dest; dest = src; @@ -499,68 +499,62 @@ template struct alignas(32) field { {} }; - BBERG_INLINE static constexpr std::pair mul_wide(uint64_t a, uint64_t b) noexcept; + BB_INLINE static constexpr std::pair mul_wide(uint64_t a, uint64_t b) noexcept; - BBERG_INLINE static constexpr uint64_t mac( + BB_INLINE static constexpr uint64_t mac( uint64_t a, uint64_t b, uint64_t c, uint64_t carry_in, uint64_t& carry_out) noexcept; - BBERG_INLINE static constexpr void mac( + BB_INLINE static constexpr void mac( uint64_t a, uint64_t b, uint64_t c, uint64_t carry_in, uint64_t& out, uint64_t& carry_out) noexcept; - BBERG_INLINE static constexpr uint64_t mac_mini(uint64_t a, uint64_t b, uint64_t c, uint64_t& out) noexcept; + BB_INLINE static constexpr uint64_t mac_mini(uint64_t a, uint64_t b, uint64_t c, uint64_t& out) noexcept; - BBERG_INLINE static constexpr void mac_mini( + BB_INLINE static constexpr void mac_mini( uint64_t a, uint64_t b, uint64_t c, uint64_t& out, uint64_t& carry_out) noexcept; - BBERG_INLINE static constexpr uint64_t mac_discard_lo(uint64_t a, uint64_t b, uint64_t c) noexcept; - - BBERG_INLINE static constexpr uint64_t addc(uint64_t a, - uint64_t b, - uint64_t carry_in, - uint64_t& carry_out) noexcept; - - BBERG_INLINE static constexpr uint64_t sbb(uint64_t a, - uint64_t b, - uint64_t borrow_in, - uint64_t& borrow_out) noexcept; - - BBERG_INLINE static constexpr uint64_t square_accumulate(uint64_t a, - uint64_t b, - uint64_t c, - uint64_t carry_in_lo, - uint64_t carry_in_hi, - uint64_t& carry_lo, - uint64_t& carry_hi) noexcept; - BBERG_INLINE constexpr field reduce() const noexcept; - BBERG_INLINE constexpr field add(const field& other) const noexcept; - BBERG_INLINE constexpr field subtract(const field& other) const noexcept; - BBERG_INLINE constexpr field subtract_coarse(const field& other) const noexcept; - BBERG_INLINE constexpr field montgomery_mul(const field& other) const noexcept; - BBERG_INLINE constexpr field montgomery_mul_big(const field& other) const noexcept; - BBERG_INLINE constexpr field montgomery_square() const noexcept; + BB_INLINE static constexpr uint64_t mac_discard_lo(uint64_t a, uint64_t b, uint64_t c) noexcept; + + BB_INLINE static constexpr uint64_t addc(uint64_t a, uint64_t b, uint64_t carry_in, uint64_t& carry_out) noexcept; + + BB_INLINE static constexpr uint64_t sbb(uint64_t a, uint64_t b, uint64_t borrow_in, uint64_t& borrow_out) noexcept; + + BB_INLINE static constexpr uint64_t square_accumulate(uint64_t a, + uint64_t b, + uint64_t c, + uint64_t carry_in_lo, + uint64_t carry_in_hi, + uint64_t& carry_lo, + uint64_t& carry_hi) noexcept; + BB_INLINE constexpr field reduce() const noexcept; + BB_INLINE constexpr field add(const field& other) const noexcept; + BB_INLINE constexpr field subtract(const field& other) const noexcept; + BB_INLINE constexpr field subtract_coarse(const field& other) const noexcept; + BB_INLINE constexpr field montgomery_mul(const field& other) const noexcept; + BB_INLINE constexpr field montgomery_mul_big(const field& other) const noexcept; + BB_INLINE constexpr field montgomery_square() const noexcept; #if (BBERG_NO_ASM == 0) - BBERG_INLINE static field asm_mul(const field& a, const field& b) noexcept; - BBERG_INLINE static field asm_sqr(const field& a) noexcept; - BBERG_INLINE static field asm_add(const field& a, const field& b) noexcept; - BBERG_INLINE static field asm_sub(const field& a, const field& b) noexcept; - BBERG_INLINE static field asm_mul_with_coarse_reduction(const field& a, const field& b) noexcept; - BBERG_INLINE static field asm_sqr_with_coarse_reduction(const field& a) noexcept; - BBERG_INLINE static field asm_add_with_coarse_reduction(const field& a, const field& b) noexcept; - BBERG_INLINE static field asm_sub_with_coarse_reduction(const field& a, const field& b) noexcept; - BBERG_INLINE static field asm_add_without_reduction(const field& a, const field& b) noexcept; - BBERG_INLINE static void asm_self_sqr(const field& a) noexcept; - BBERG_INLINE static void asm_self_add(const field& a, const field& b) noexcept; - BBERG_INLINE static void asm_self_sub(const field& a, const field& b) noexcept; - BBERG_INLINE static void asm_self_mul_with_coarse_reduction(const field& a, const field& b) noexcept; - BBERG_INLINE static void asm_self_sqr_with_coarse_reduction(const field& a) noexcept; - BBERG_INLINE static void asm_self_add_with_coarse_reduction(const field& a, const field& b) noexcept; - BBERG_INLINE static void asm_self_sub_with_coarse_reduction(const field& a, const field& b) noexcept; - BBERG_INLINE static void asm_self_add_without_reduction(const field& a, const field& b) noexcept; - - BBERG_INLINE static void asm_conditional_negate(field& r, uint64_t predicate) noexcept; - BBERG_INLINE static field asm_reduce_once(const field& a) noexcept; - BBERG_INLINE static void asm_self_reduce_once(const field& a) noexcept; + BB_INLINE static field asm_mul(const field& a, const field& b) noexcept; + BB_INLINE static field asm_sqr(const field& a) noexcept; + BB_INLINE static field asm_add(const field& a, const field& b) noexcept; + BB_INLINE static field asm_sub(const field& a, const field& b) noexcept; + BB_INLINE static field asm_mul_with_coarse_reduction(const field& a, const field& b) noexcept; + BB_INLINE static field asm_sqr_with_coarse_reduction(const field& a) noexcept; + BB_INLINE static field asm_add_with_coarse_reduction(const field& a, const field& b) noexcept; + BB_INLINE static field asm_sub_with_coarse_reduction(const field& a, const field& b) noexcept; + BB_INLINE static field asm_add_without_reduction(const field& a, const field& b) noexcept; + BB_INLINE static void asm_self_sqr(const field& a) noexcept; + BB_INLINE static void asm_self_add(const field& a, const field& b) noexcept; + BB_INLINE static void asm_self_sub(const field& a, const field& b) noexcept; + BB_INLINE static void asm_self_mul_with_coarse_reduction(const field& a, const field& b) noexcept; + BB_INLINE static void asm_self_sqr_with_coarse_reduction(const field& a) noexcept; + BB_INLINE static void asm_self_add_with_coarse_reduction(const field& a, const field& b) noexcept; + BB_INLINE static void asm_self_sub_with_coarse_reduction(const field& a, const field& b) noexcept; + BB_INLINE static void asm_self_add_without_reduction(const field& a, const field& b) noexcept; + + BB_INLINE static void asm_conditional_negate(field& r, uint64_t predicate) noexcept; + BB_INLINE static field asm_reduce_once(const field& a) noexcept; + BB_INLINE static void asm_self_reduce_once(const field& a) noexcept; static constexpr uint64_t zero_reference = 0x00ULL; #endif static constexpr size_t COSET_GENERATOR_SIZE = 15; diff --git a/barretenberg/cpp/src/barretenberg/ecc/fields/field_impl.hpp b/barretenberg/cpp/src/barretenberg/ecc/fields/field_impl.hpp index 2149e131241..f7e8b08a718 100644 --- a/barretenberg/cpp/src/barretenberg/ecc/fields/field_impl.hpp +++ b/barretenberg/cpp/src/barretenberg/ecc/fields/field_impl.hpp @@ -1,4 +1,5 @@ #pragma once +#include "barretenberg/common/op_count.hpp" #include "barretenberg/common/slab_allocator.hpp" #include "barretenberg/common/throw_or_abort.hpp" #include "barretenberg/numeric/bitop/get_msb.hpp" @@ -25,6 +26,7 @@ namespace bb { **/ template constexpr field field::operator*(const field& other) const noexcept { + BB_OP_COUNT_TRACK_NAME("f*"); if constexpr (BBERG_NO_ASM || (T::modulus_3 >= 0x4000000000000000ULL) || (T::modulus_1 == 0 && T::modulus_2 == 0 && T::modulus_3 == 0)) { // >= 255-bits or <= 64-bits. @@ -39,6 +41,7 @@ template constexpr field field::operator*(const field& other) co template constexpr field& field::operator*=(const field& other) noexcept { + BB_OP_COUNT_TRACK_NAME("f*="); if constexpr (BBERG_NO_ASM || (T::modulus_3 >= 0x4000000000000000ULL) || (T::modulus_1 == 0 && T::modulus_2 == 0 && T::modulus_3 == 0)) { // >= 255-bits or <= 64-bits. @@ -60,6 +63,7 @@ template constexpr field& field::operator*=(const field& other) **/ template constexpr field field::sqr() const noexcept { + BB_OP_COUNT_TRACK_NAME("f::sqr"); if constexpr (BBERG_NO_ASM || (T::modulus_3 >= 0x4000000000000000ULL) || (T::modulus_1 == 0 && T::modulus_2 == 0 && T::modulus_3 == 0)) { return montgomery_square(); @@ -73,6 +77,7 @@ template constexpr field field::sqr() const noexcept template constexpr void field::self_sqr() noexcept { + BB_OP_COUNT_TRACK_NAME("f::self_sqr"); if constexpr (BBERG_NO_ASM || (T::modulus_3 >= 0x4000000000000000ULL) || (T::modulus_1 == 0 && T::modulus_2 == 0 && T::modulus_3 == 0)) { *this = montgomery_square(); @@ -92,6 +97,7 @@ template constexpr void field::self_sqr() noexcept **/ template constexpr field field::operator+(const field& other) const noexcept { + BB_OP_COUNT_TRACK_NAME("f+"); if constexpr (BBERG_NO_ASM || (T::modulus_3 >= 0x4000000000000000ULL) || (T::modulus_1 == 0 && T::modulus_2 == 0 && T::modulus_3 == 0)) { return add(other); @@ -105,6 +111,7 @@ template constexpr field field::operator+(const field& other) co template constexpr field& field::operator+=(const field& other) noexcept { + BB_OP_COUNT_TRACK_NAME("f+="); if constexpr (BBERG_NO_ASM || (T::modulus_3 >= 0x4000000000000000ULL) || (T::modulus_1 == 0 && T::modulus_2 == 0 && T::modulus_3 == 0)) { (*this) = operator+(other); @@ -120,12 +127,14 @@ template constexpr field& field::operator+=(const field& other) template constexpr field field::operator++() noexcept { + BB_OP_COUNT_TRACK_NAME("++f"); return *this += 1; } // NOLINTNEXTLINE(cert-dcl21-cpp) circular linting errors. If const is added, linter suggests removing template constexpr field field::operator++(int) noexcept { + BB_OP_COUNT_TRACK_NAME("f++"); field value_before_incrementing = *this; *this += 1; return value_before_incrementing; @@ -138,6 +147,7 @@ template constexpr field field::operator++(int) noexcept **/ template constexpr field field::operator-(const field& other) const noexcept { + BB_OP_COUNT_TRACK_NAME("f-"); if constexpr (BBERG_NO_ASM || (T::modulus_3 >= 0x4000000000000000ULL) || (T::modulus_1 == 0 && T::modulus_2 == 0 && T::modulus_3 == 0)) { return subtract_coarse(other); // modulus - *this; @@ -151,6 +161,7 @@ template constexpr field field::operator-(const field& other) co template constexpr field field::operator-() const noexcept { + BB_OP_COUNT_TRACK_NAME("-f"); if constexpr ((T::modulus_3 >= 0x4000000000000000ULL) || (T::modulus_1 == 0 && T::modulus_2 == 0 && T::modulus_3 == 0)) { constexpr field p{ modulus.data[0], modulus.data[1], modulus.data[2], modulus.data[3] }; @@ -179,6 +190,7 @@ template constexpr field field::operator-() const noexcept template constexpr field& field::operator-=(const field& other) noexcept { + BB_OP_COUNT_TRACK_NAME("f-="); if constexpr (BBERG_NO_ASM || (T::modulus_3 >= 0x4000000000000000ULL) || (T::modulus_1 == 0 && T::modulus_2 == 0 && T::modulus_3 == 0)) { *this = subtract_coarse(other); // subtract(other); @@ -194,6 +206,7 @@ template constexpr field& field::operator-=(const field& other) template constexpr void field::self_neg() noexcept { + BB_OP_COUNT_TRACK_NAME("f::self_neg"); if constexpr ((T::modulus_3 >= 0x4000000000000000ULL) || (T::modulus_1 == 0 && T::modulus_2 == 0 && T::modulus_3 == 0)) { constexpr field p{ modulus.data[0], modulus.data[1], modulus.data[2], modulus.data[3] }; @@ -206,6 +219,7 @@ template constexpr void field::self_neg() noexcept template constexpr void field::self_conditional_negate(const uint64_t predicate) noexcept { + BB_OP_COUNT_TRACK_NAME("f::self_conditional_negate"); if constexpr (BBERG_NO_ASM || (T::modulus_3 >= 0x4000000000000000ULL) || (T::modulus_1 == 0 && T::modulus_2 == 0 && T::modulus_3 == 0)) { *this = predicate ? -(*this) : *this; // NOLINT @@ -231,6 +245,7 @@ template constexpr void field::self_conditional_negate(const uint64 */ template constexpr bool field::operator>(const field& other) const noexcept { + BB_OP_COUNT_TRACK_NAME("f>"); const field left = reduce_once(); const field right = other.reduce_once(); const bool t0 = left.data[3] > right.data[3]; @@ -260,6 +275,7 @@ template constexpr bool field::operator<(const field& other) const template constexpr bool field::operator==(const field& other) const noexcept { + BB_OP_COUNT_TRACK_NAME("f=="); const field left = reduce_once(); const field right = other.reduce_once(); return (left.data[0] == right.data[0]) && (left.data[1] == right.data[1]) && (left.data[2] == right.data[2]) && @@ -273,6 +289,7 @@ template constexpr bool field::operator!=(const field& other) const template constexpr field field::to_montgomery_form() const noexcept { + BB_OP_COUNT_TRACK_NAME("f::to_montgomery_form"); constexpr field r_squared{ T::r_squared_0, T::r_squared_1, T::r_squared_2, T::r_squared_3 }; field result = *this; @@ -290,12 +307,14 @@ template constexpr field field::to_montgomery_form() const noexc template constexpr field field::from_montgomery_form() const noexcept { + BB_OP_COUNT_TRACK_NAME("f::from_montgomery_form"); constexpr field one_raw{ 1, 0, 0, 0 }; return operator*(one_raw).reduce_once(); } template constexpr void field::self_to_montgomery_form() noexcept { + BB_OP_COUNT_TRACK_NAME("f::self_to_montgomery_form"); constexpr field r_squared{ T::r_squared_0, T::r_squared_1, T::r_squared_2, T::r_squared_3 }; self_reduce_once(); self_reduce_once(); @@ -306,6 +325,7 @@ template constexpr void field::self_to_montgomery_form() noexcept template constexpr void field::self_from_montgomery_form() noexcept { + BB_OP_COUNT_TRACK_NAME("f::self_from_montgomery_form"); constexpr field one_raw{ 1, 0, 0, 0 }; *this *= one_raw; self_reduce_once(); @@ -313,6 +333,7 @@ template constexpr void field::self_from_montgomery_form() noexcept template constexpr field field::reduce_once() const noexcept { + BB_OP_COUNT_TRACK_NAME("f::reduce_once"); if constexpr (BBERG_NO_ASM || (T::modulus_3 >= 0x4000000000000000ULL) || (T::modulus_1 == 0 && T::modulus_2 == 0 && T::modulus_3 == 0)) { return reduce(); @@ -326,6 +347,7 @@ template constexpr field field::reduce_once() const noexcept template constexpr void field::self_reduce_once() noexcept { + BB_OP_COUNT_TRACK_NAME("f::self_reduce_once"); if constexpr (BBERG_NO_ASM || (T::modulus_3 >= 0x4000000000000000ULL) || (T::modulus_1 == 0 && T::modulus_2 == 0 && T::modulus_3 == 0)) { *this = reduce(); @@ -340,7 +362,7 @@ template constexpr void field::self_reduce_once() noexcept template constexpr field field::pow(const uint256_t& exponent) const noexcept { - + BB_OP_COUNT_TRACK_NAME("f::pow"); field accumulator{ data[0], data[1], data[2], data[3] }; field to_mul{ data[0], data[1], data[2], data[3] }; const uint64_t maximum_set_bit = exponent.get_msb(); @@ -366,6 +388,7 @@ template constexpr field field::pow(const uint64_t exponent) con template constexpr field field::invert() const noexcept { + BB_OP_COUNT_TRACK_NAME("f::invert"); if (*this == zero()) { throw_or_abort("Trying to invert zero in the field"); } @@ -379,6 +402,7 @@ template void field::batch_invert(field* coeffs, const size_t n) no template void field::batch_invert(std::span coeffs) noexcept { + BB_OP_COUNT_TRACK_NAME("f::batch_invert"); const size_t n = coeffs.size(); auto temporaries_ptr = std::static_pointer_cast(get_mem_slab(n * sizeof(field))); @@ -427,6 +451,7 @@ template void field::batch_invert(std::span coeffs) noexcept template constexpr field field::tonelli_shanks_sqrt() const noexcept { + BB_OP_COUNT_TRACK_NAME("f::tonelli_shanks_sqrt"); // Tonelli-shanks algorithm begins by finding a field element Q and integer S, // such that (p - 1) = Q.2^{s} @@ -506,6 +531,7 @@ template constexpr field field::tonelli_shanks_sqrt() const noex template constexpr std::pair> field::sqrt() const noexcept { + BB_OP_COUNT_TRACK_NAME("f::sqrt"); field root; if constexpr ((T::modulus_0 & 0x3UL) == 0x3UL) { constexpr uint256_t sqrt_exponent = (modulus + uint256_t(1)) >> 2; @@ -522,11 +548,13 @@ template constexpr std::pair> field::sqrt() const no template constexpr field field::operator/(const field& other) const noexcept { + BB_OP_COUNT_TRACK_NAME("f/"); return operator*(other.invert()); } template constexpr field& field::operator/=(const field& other) noexcept { + BB_OP_COUNT_TRACK_NAME("f/="); *this = operator/(other); return *this; } @@ -563,6 +591,7 @@ template constexpr field field::get_root_of_unity(size_t subgrou template field field::random_element(numeric::RNG* engine) noexcept { + BB_OP_COUNT_TRACK_NAME("f::random_element"); if (engine == nullptr) { engine = &numeric::get_randomness(); } @@ -575,6 +604,7 @@ template field field::random_element(numeric::RNG* engine) noexc template constexpr size_t field::primitive_root_log_size() noexcept { + BB_OP_COUNT_TRACK_NAME("f::primitive_root_log_size"); uint256_t target = modulus - 1; size_t result = 0; while (!target.get_bit(result)) { diff --git a/barretenberg/cpp/src/barretenberg/ecc/fields/field_impl_generic.hpp b/barretenberg/cpp/src/barretenberg/ecc/fields/field_impl_generic.hpp index 8eab68d1b24..f1bed6aa602 100644 --- a/barretenberg/cpp/src/barretenberg/ecc/fields/field_impl_generic.hpp +++ b/barretenberg/cpp/src/barretenberg/ecc/fields/field_impl_generic.hpp @@ -4,6 +4,8 @@ #include #include "./field_impl.hpp" +#include "barretenberg/common/op_count.hpp" + namespace bb { // NOLINTBEGIN(readability-implicit-bool-conversion) @@ -103,6 +105,7 @@ constexpr uint64_t field::addc(const uint64_t a, const uint64_t carry_in, uint64_t& carry_out) noexcept { + BB_OP_COUNT_TRACK(); #if defined(__SIZEOF_INT128__) && !defined(__wasm__) uint128_t res = static_cast(a) + static_cast(b) + static_cast(carry_in); carry_out = static_cast(res >> 64); diff --git a/barretenberg/cpp/src/barretenberg/ecc/groups/element.hpp b/barretenberg/cpp/src/barretenberg/ecc/groups/element.hpp index 637d3dda0a4..0c34effbfaa 100644 --- a/barretenberg/cpp/src/barretenberg/ecc/groups/element.hpp +++ b/barretenberg/cpp/src/barretenberg/ecc/groups/element.hpp @@ -84,11 +84,11 @@ template class alignas(32) element { constexpr element normalize() const noexcept; static element infinity(); - BBERG_INLINE constexpr element set_infinity() const noexcept; - BBERG_INLINE constexpr void self_set_infinity() noexcept; - [[nodiscard]] BBERG_INLINE constexpr bool is_point_at_infinity() const noexcept; - [[nodiscard]] BBERG_INLINE constexpr bool on_curve() const noexcept; - BBERG_INLINE constexpr bool operator==(const element& other) const noexcept; + BB_INLINE constexpr element set_infinity() const noexcept; + BB_INLINE constexpr void self_set_infinity() noexcept; + [[nodiscard]] BB_INLINE constexpr bool is_point_at_infinity() const noexcept; + [[nodiscard]] BB_INLINE constexpr bool on_curve() const noexcept; + BB_INLINE constexpr bool operator==(const element& other) const noexcept; static void batch_normalize(element* elements, size_t num_elements) noexcept; static void batch_affine_add(const std::span>& first_group, diff --git a/barretenberg/cpp/src/barretenberg/ecc/groups/element_impl.hpp b/barretenberg/cpp/src/barretenberg/ecc/groups/element_impl.hpp index 422065e4273..ec9eba4ffac 100644 --- a/barretenberg/cpp/src/barretenberg/ecc/groups/element_impl.hpp +++ b/barretenberg/cpp/src/barretenberg/ecc/groups/element_impl.hpp @@ -1,4 +1,5 @@ #pragma once +#include "barretenberg/common/op_count.hpp" #include "barretenberg/common/thread.hpp" #include "barretenberg/ecc/groups/element.hpp" #include "element.hpp" @@ -444,6 +445,7 @@ constexpr element element::operator+=(const element& other template constexpr element element::operator+(const element& other) const noexcept { + BB_OP_COUNT_TRACK(); element result(*this); return (result += other); } @@ -458,6 +460,7 @@ constexpr element element::operator-=(const element& other template constexpr element element::operator-(const element& other) const noexcept { + BB_OP_COUNT_TRACK(); element result(*this); return (result -= other); } diff --git a/barretenberg/cpp/src/barretenberg/ecc/groups/group.hpp b/barretenberg/cpp/src/barretenberg/ecc/groups/group.hpp index ce13dfec331..27cd56f8ca8 100644 --- a/barretenberg/cpp/src/barretenberg/ecc/groups/group.hpp +++ b/barretenberg/cpp/src/barretenberg/ecc/groups/group.hpp @@ -115,9 +115,9 @@ template & state, bool handle_edge_cases) { + BB_OP_COUNT_TRACK(); using Group = typename Curve::Group; using Element = typename Curve::Element; diff --git a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.hpp b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.hpp index a5051d6d4f9..3d8aeead828 100644 --- a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.hpp +++ b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.hpp @@ -30,17 +30,17 @@ template class ECCVMProver_ { const std::shared_ptr& commitment_key, const std::shared_ptr& transcript = std::make_shared()); - BBERG_PROFILE void execute_preamble_round(); - BBERG_PROFILE void execute_wire_commitments_round(); - BBERG_PROFILE void execute_log_derivative_commitments_round(); - BBERG_PROFILE void execute_grand_product_computation_round(); - BBERG_PROFILE void execute_relation_check_rounds(); - BBERG_PROFILE void execute_univariatization_round(); - BBERG_PROFILE void execute_pcs_evaluation_round(); - BBERG_PROFILE void execute_shplonk_batched_quotient_round(); - BBERG_PROFILE void execute_shplonk_partial_evaluation_round(); - BBERG_PROFILE void execute_final_pcs_round(); - BBERG_PROFILE void execute_transcript_consistency_univariate_opening_round(); + BB_PROFILE void execute_preamble_round(); + BB_PROFILE void execute_wire_commitments_round(); + BB_PROFILE void execute_log_derivative_commitments_round(); + BB_PROFILE void execute_grand_product_computation_round(); + BB_PROFILE void execute_relation_check_rounds(); + BB_PROFILE void execute_univariatization_round(); + BB_PROFILE void execute_pcs_evaluation_round(); + BB_PROFILE void execute_shplonk_batched_quotient_round(); + BB_PROFILE void execute_shplonk_partial_evaluation_round(); + BB_PROFILE void execute_final_pcs_round(); + BB_PROFILE void execute_transcript_consistency_univariate_opening_round(); HonkProof& export_proof(); HonkProof& construct_proof(); diff --git a/barretenberg/cpp/src/barretenberg/plonk/proof_system/prover/prover.hpp b/barretenberg/cpp/src/barretenberg/plonk/proof_system/prover/prover.hpp index 7f01159e95c..9dbe3cd4d49 100644 --- a/barretenberg/cpp/src/barretenberg/plonk/proof_system/prover/prover.hpp +++ b/barretenberg/cpp/src/barretenberg/plonk/proof_system/prover/prover.hpp @@ -19,13 +19,13 @@ template class ProverBase { ProverBase& operator=(const ProverBase& other) = delete; ProverBase& operator=(ProverBase&& other); - BBERG_PROFILE void execute_preamble_round(); - BBERG_PROFILE void execute_first_round(); - BBERG_PROFILE void execute_second_round(); - BBERG_PROFILE void execute_third_round(); - BBERG_PROFILE void execute_fourth_round(); - BBERG_PROFILE void execute_fifth_round(); - BBERG_PROFILE void execute_sixth_round(); + BB_PROFILE void execute_preamble_round(); + BB_PROFILE void execute_first_round(); + BB_PROFILE void execute_second_round(); + BB_PROFILE void execute_third_round(); + BB_PROFILE void execute_fourth_round(); + BB_PROFILE void execute_fifth_round(); + BB_PROFILE void execute_sixth_round(); void add_polynomial_evaluations_to_transcript(); void compute_batch_opening_polynomials(); diff --git a/barretenberg/cpp/src/barretenberg/protogalaxy/decider_prover.hpp b/barretenberg/cpp/src/barretenberg/protogalaxy/decider_prover.hpp index 68440d5129b..43d0b602bcc 100644 --- a/barretenberg/cpp/src/barretenberg/protogalaxy/decider_prover.hpp +++ b/barretenberg/cpp/src/barretenberg/protogalaxy/decider_prover.hpp @@ -28,9 +28,9 @@ template class DeciderProver_ { const std::shared_ptr&, const std::shared_ptr& transcript = std::make_shared()); - BBERG_PROFILE void execute_preamble_round(); - BBERG_PROFILE void execute_relation_check_rounds(); - BBERG_PROFILE void execute_zeromorph_rounds(); + BB_PROFILE void execute_preamble_round(); + BB_PROFILE void execute_relation_check_rounds(); + BB_PROFILE void execute_zeromorph_rounds(); HonkProof& export_proof(); HonkProof& construct_proof(); diff --git a/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.hpp b/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.hpp index 026c83a618c..37fe38347d4 100644 --- a/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.hpp +++ b/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.hpp @@ -91,7 +91,7 @@ template class ProtoGalaxyProver_ { * * TODO(https://github.com/AztecProtocol/barretenberg/issues/753): fold goblin polynomials */ - BBERG_PROFILE FoldingResult fold_instances(); + BB_PROFILE FoldingResult fold_instances(); /** * @brief For a new round challenge δ at each iteration of the ProtoGalaxy protocol, compute the vector diff --git a/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_prover.hpp b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_prover.hpp index 4db4f131385..c46545707ba 100644 --- a/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_prover.hpp +++ b/barretenberg/cpp/src/barretenberg/translator_vm/goblin_translator_prover.hpp @@ -27,11 +27,11 @@ class GoblinTranslatorProver { const std::shared_ptr& commitment_key, const std::shared_ptr& transcript = std::make_shared()); - BBERG_PROFILE void execute_preamble_round(); - BBERG_PROFILE void execute_wire_and_sorted_constraints_commitments_round(); - BBERG_PROFILE void execute_grand_product_computation_round(); - BBERG_PROFILE void execute_relation_check_rounds(); - BBERG_PROFILE void execute_zeromorph_rounds(); + BB_PROFILE void execute_preamble_round(); + BB_PROFILE void execute_wire_and_sorted_constraints_commitments_round(); + BB_PROFILE void execute_grand_product_computation_round(); + BB_PROFILE void execute_relation_check_rounds(); + BB_PROFILE void execute_zeromorph_rounds(); HonkProof& export_proof(); HonkProof& construct_proof(); diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/merge_prover.hpp b/barretenberg/cpp/src/barretenberg/ultra_honk/merge_prover.hpp index a615f9f816c..2b616022458 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/merge_prover.hpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/merge_prover.hpp @@ -28,7 +28,7 @@ class MergeProver { explicit MergeProver(const std::shared_ptr&); - BBERG_PROFILE HonkProof construct_proof(); + BB_PROFILE HonkProof construct_proof(); private: std::shared_ptr op_queue; diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_prover.hpp b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_prover.hpp index 8e211390dd7..e212a38abfa 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_prover.hpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/ultra_prover.hpp @@ -27,13 +27,13 @@ template class UltraProver_ { const std::shared_ptr&, const std::shared_ptr& transcript = std::make_shared()); - BBERG_PROFILE void execute_preamble_round(); - BBERG_PROFILE void execute_wire_commitments_round(); - BBERG_PROFILE void execute_sorted_list_accumulator_round(); - BBERG_PROFILE void execute_log_derivative_inverse_round(); - BBERG_PROFILE void execute_grand_product_computation_round(); - BBERG_PROFILE void execute_relation_check_rounds(); - BBERG_PROFILE void execute_zeromorph_rounds(); + BB_PROFILE void execute_preamble_round(); + BB_PROFILE void execute_wire_commitments_round(); + BB_PROFILE void execute_sorted_list_accumulator_round(); + BB_PROFILE void execute_log_derivative_inverse_round(); + BB_PROFILE void execute_grand_product_computation_round(); + BB_PROFILE void execute_relation_check_rounds(); + BB_PROFILE void execute_zeromorph_rounds(); HonkProof& export_proof(); HonkProof& construct_proof();