Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions barretenberg/cpp/src/barretenberg/common/bb_bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ std::string format_percentage_value(double percentage, const char* color)
std::string format_percentage(double value, double total, double min_threshold = 0.0)
{
double percentage = (total <= 0) ? 0.0 : (value / total) * 100.0;
if (total <= 0 || percentage < min_threshold) {
// TEMPORARILY DISABLED: Show all percentages no matter how small
// if (total <= 0 || percentage < min_threshold) {
// return " ";
// }
(void)min_threshold; // Suppress unused parameter warning
if (total <= 0) {
return " ";
}

Expand Down Expand Up @@ -345,7 +350,8 @@ void GlobalBenchStatsContainer::print_aggregate_counts_hierarchical(std::ostream

// Print time if available with aligned section including indent level
if (entry.time_max > 0) {
if (time_ms < 100.0) {
// TEMPORARILY DISABLED: Show full format for all times
if (false) { // was: time_ms < 100.0
// Minimal format for <100ms: only [level] and percentage, no time display
std::ostringstream minimal_oss;
minimal_oss << Colors::MAGENTA << "[" << indent_level << "] " << Colors::RESET;
Expand Down Expand Up @@ -401,7 +407,9 @@ void GlobalBenchStatsContainer::print_aggregate_counts_hierarchical(std::ostream
if (!printed_in_detail.contains(key)) {
for (const auto& [child_key, parent_map] : aggregated) {
for (const auto& [parent_key, entry] : parent_map) {
if (parent_key == key && entry.time_max >= 500000) { // 0.5ms in nanoseconds
// TEMPORARILY DISABLED: Show all children no matter how small
// if (parent_key == key && entry.time_max >= 500000) { // 0.5ms in nanoseconds
if (parent_key == key && entry.time_max > 0) { // Show everything
children.push_back(child_key);
break;
}
Expand Down Expand Up @@ -438,7 +446,9 @@ void GlobalBenchStatsContainer::print_aggregate_counts_hierarchical(std::ostream
for (const auto& child_key : children) {
if (auto it = aggregated.find(child_key); it != aggregated.end()) {
for (const auto& [parent_key, entry] : it->second) {
if (parent_key == key && entry.time_max >= 500000) { // 0.5ms in nanoseconds
// TEMPORARILY DISABLED: Count all children time
// if (parent_key == key && entry.time_max >= 500000) { // 0.5ms in nanoseconds
if (parent_key == key && entry.time_max > 0) { // Count everything
children_total_time += entry.time_max;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ThreadPool {
do_iterations();

{
BB_BENCH_NAME("spinning main thread");
// BB_BENCH_NAME("spinning main thread");
std::unique_lock<std::mutex> lock(tasks_mutex);
complete_condition_.wait(lock, [this] { return complete_ == num_iterations_; });
}
Expand Down Expand Up @@ -72,7 +72,7 @@ class ThreadPool {
}
iteration = iteration_++;
}
BB_BENCH_NAME("do_iterations()");
// BB_BENCH_NAME("do_iterations()");
task_(iteration);
{
std::unique_lock<std::mutex> lock(tasks_mutex);
Expand Down
3 changes: 2 additions & 1 deletion barretenberg/cpp/src/barretenberg/ecc/curves/bn254/bn254.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class BN254 {
ScalarField(uint256_t("0x204bd3277422fad364751ad938e2b5e6a54cf8c68712848a692c553d0329f5d6"));
// The length of the polynomials used to mask the Sumcheck Round Univariates. Computed as
// max(BATCHED_PARTIAL_RELATION_LENGTH) for BN254 Flavors with ZK
static constexpr uint32_t LIBRA_UNIVARIATES_LENGTH = 9;
// Temporarily reduced from 9 to 5 for performance testing with reduced relation lengths
static constexpr uint32_t LIBRA_UNIVARIATES_LENGTH = 5;
};
} // namespace bb::curve
2 changes: 1 addition & 1 deletion barretenberg/cpp/src/barretenberg/flavor/mega_flavor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class MegaFlavor {

static constexpr size_t MAX_PARTIAL_RELATION_LENGTH = compute_max_partial_relation_length<Relations>();
static constexpr size_t MAX_TOTAL_RELATION_LENGTH = compute_max_total_relation_length<Relations>();
static_assert(MAX_TOTAL_RELATION_LENGTH == 11);
static_assert(MAX_TOTAL_RELATION_LENGTH == 8); // Temporarily adjusted for performance testing (was 11)
// BATCHED_RELATION_PARTIAL_LENGTH = algebraic degree of sumcheck relation *after* multiplying by the `pow_zeta`
// random polynomial e.g. For \sum(x) [A(x) * B(x) + C(x)] * PowZeta(X), relation length = 2 and random relation
// length = 3
Expand Down
5 changes: 3 additions & 2 deletions barretenberg/cpp/src/barretenberg/flavor/mega_zk_flavor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ class MegaZKFlavor : public bb::MegaFlavor {
static constexpr bool HasZK = true;
// The degree has to be increased because the relation is multiplied by the Row Disabling Polynomial
static constexpr size_t BATCHED_RELATION_PARTIAL_LENGTH = MegaFlavor::BATCHED_RELATION_PARTIAL_LENGTH + 1;
static_assert(BATCHED_RELATION_PARTIAL_LENGTH == Curve::LIBRA_UNIVARIATES_LENGTH,
"LIBRA_UNIVARIATES_LENGTH must be equal to MegaZKFlavor::BATCHED_RELATION_PARTIAL_LENGTH");
// Temporarily disabled for performance testing with reduced relation lengths
// static_assert(BATCHED_RELATION_PARTIAL_LENGTH == Curve::LIBRA_UNIVARIATES_LENGTH,
// "LIBRA_UNIVARIATES_LENGTH must be equal to MegaZKFlavor::BATCHED_RELATION_PARTIAL_LENGTH");

// Proof length formula
static constexpr size_t PROOF_LENGTH_WITHOUT_PUB_INPUTS(size_t virtual_log_n = MegaFlavor::VIRTUAL_LOG_N)
Expand Down
4 changes: 2 additions & 2 deletions barretenberg/cpp/src/barretenberg/flavor/ultra_flavor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ class UltraFlavor {
using Relations = Relations_<FF>;

static constexpr size_t MAX_PARTIAL_RELATION_LENGTH = compute_max_partial_relation_length<Relations>();
static_assert(MAX_PARTIAL_RELATION_LENGTH == 7);
static_assert(MAX_PARTIAL_RELATION_LENGTH == 3); // Temporarily set to 3 for performance testing
static constexpr size_t MAX_TOTAL_RELATION_LENGTH = compute_max_total_relation_length<Relations>();
static_assert(MAX_TOTAL_RELATION_LENGTH == 11);
static_assert(MAX_TOTAL_RELATION_LENGTH == 8); // Temporarily adjusted for performance testing (was 11)
static constexpr size_t NUM_SUBRELATIONS = compute_number_of_subrelations<Relations>();
// For instances of this flavour, used in folding, we need a unique sumcheck batching challenge for each
// subrelation. This is because using powers of alpha would increase the degree of Protogalaxy polynomial $G$ (the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ class UltraKeccakZKFlavor : public UltraKeccakFlavor {
// Determine the number of evaluations of Prover and Libra Polynomials that the Prover sends to the Verifier in
// the rounds of ZK Sumcheck.
static constexpr size_t BATCHED_RELATION_PARTIAL_LENGTH = UltraKeccakFlavor::BATCHED_RELATION_PARTIAL_LENGTH + 1;
static_assert(BATCHED_RELATION_PARTIAL_LENGTH == Curve::LIBRA_UNIVARIATES_LENGTH,
"LIBRA_UNIVARIATES_LENGTH must be equal to UltraKeccakZKFlavor::BATCHED_RELATION_PARTIAL_LENGTH");
// Temporarily disabled for performance testing with reduced relation lengths
// static_assert(BATCHED_RELATION_PARTIAL_LENGTH == Curve::LIBRA_UNIVARIATES_LENGTH,
// "LIBRA_UNIVARIATES_LENGTH must be equal to UltraKeccakZKFlavor::BATCHED_RELATION_PARTIAL_LENGTH");

// Proof length formula method
static constexpr size_t PROOF_LENGTH_WITHOUT_PUB_INPUTS(size_t virtual_log_n = VIRTUAL_LOG_N)
Expand Down
5 changes: 3 additions & 2 deletions barretenberg/cpp/src/barretenberg/flavor/ultra_zk_flavor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ class UltraZKFlavor : public UltraFlavor {
// Determine the number of evaluations of Prover and Libra Polynomials that the Prover sends to the Verifier in
// the rounds of ZK Sumcheck.
static constexpr size_t BATCHED_RELATION_PARTIAL_LENGTH = UltraFlavor::BATCHED_RELATION_PARTIAL_LENGTH + 1;
static_assert(BATCHED_RELATION_PARTIAL_LENGTH == Curve::LIBRA_UNIVARIATES_LENGTH,
"LIBRA_UNIVARIATES_LENGTH must be equal to UltraZKFlavor::BATCHED_RELATION_PARTIAL_LENGTH");
// Temporarily disabled for performance testing with reduced relation lengths
// static_assert(BATCHED_RELATION_PARTIAL_LENGTH == Curve::LIBRA_UNIVARIATES_LENGTH,
// "LIBRA_UNIVARIATES_LENGTH must be equal to UltraZKFlavor::BATCHED_RELATION_PARTIAL_LENGTH");
static constexpr size_t num_frs_comm = bb::field_conversion::calc_num_bn254_frs<Commitment>();
static constexpr size_t num_frs_fr = bb::field_conversion::calc_num_bn254_frs<FF>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ template <typename FF_> class DeltaRangeConstraintRelationImpl {
using FF = FF_;

static constexpr std::array<size_t, 4> SUBRELATION_PARTIAL_LENGTHS{
6, // range constrain sub-relation 1
6, // range constrain sub-relation 2
6, // range constrain sub-relation 3
6 // range constrain sub-relation 4
3, // range constrain sub-relation 1 (temporarily reduced from 6)
3, // range constrain sub-relation 2 (temporarily reduced from 6)
3, // range constrain sub-relation 3 (temporarily reduced from 6)
3 // range constrain sub-relation 4 (temporarily reduced from 6)
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ template <typename FF_> class EllipticRelationImpl {
using FF = FF_;

static constexpr std::array<size_t, 2> SUBRELATION_PARTIAL_LENGTHS{
6, // x-coordinate sub-relation
6, // y-coordinate sub-relation
3, // x-coordinate sub-relation (temporarily reduced from 6)
3, // y-coordinate sub-relation (temporarily reduced from 6)
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ template <typename FF_> class LogDerivLookupRelationImpl {
using FF = FF_;
static constexpr size_t WRITE_TERMS = 1; // the number of write terms in the lookup relation
// 1 + polynomial degree of this relation
static constexpr size_t INVERSE_SUBRELATION_LENGTH = 5; // both subrelations are degree 4
static constexpr size_t LOOKUP_SUBRELATION_LENGTH = 5; // both subrelations are degree 4
static constexpr size_t INVERSE_SUBRELATION_LENGTH = 3; // temporarily reduced from 5
static constexpr size_t LOOKUP_SUBRELATION_LENGTH = 3; // temporarily reduced from 5
static constexpr size_t BOOLEAN_CHECK_SUBRELATION_LENGTH =
3; // deg + 1 of the relation checking that read_tag_m is a boolean value

Expand Down
12 changes: 6 additions & 6 deletions barretenberg/cpp/src/barretenberg/relations/memory_relation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ template <typename FF_> class MemoryRelationImpl {
using FF = FF_;

static constexpr std::array<size_t, 6> SUBRELATION_PARTIAL_LENGTHS{
6, // memory sub-relation;
6, // ROM consistency sub-relation 1
6, // ROM consistency sub-relation 2
6, // RAM consistency sub-relation 1
6, // RAM consistency sub-relation 2
6 // RAM consistency sub-relation 3
3, // memory sub-relation (temporarily reduced from 6)
3, // ROM consistency sub-relation 1 (temporarily reduced from 6)
3, // ROM consistency sub-relation 2 (temporarily reduced from 6)
3, // RAM consistency sub-relation 1 (temporarily reduced from 6)
3, // RAM consistency sub-relation 2 (temporarily reduced from 6)
3 // RAM consistency sub-relation 3 (temporarily reduced from 6)
};

static constexpr std::array<size_t, 6> TOTAL_LENGTH_ADJUSTMENTS{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ template <typename FF_> class NonNativeFieldRelationImpl {
using FF = FF_;

static constexpr std::array<size_t, 1> SUBRELATION_PARTIAL_LENGTHS{
6 // nnf sub-relation;
3 // nnf sub-relation (temporarily reduced from 6)
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ template <typename FF_> class UltraPermutationRelationImpl {
using FF = FF_;

static constexpr std::array<size_t, 2> SUBRELATION_PARTIAL_LENGTHS{
6, // grand product construction sub-relation
3, // grand product construction sub-relation (temporarily reduced from 6)
3 // left-shiftable polynomial sub-relation
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ template <typename FF_> class Poseidon2ExternalRelationImpl {
using FF = FF_;

static constexpr std::array<size_t, 4> SUBRELATION_PARTIAL_LENGTHS{
7, // external poseidon2 round sub-relation for first value
7, // external poseidon2 round sub-relation for second value
7, // external poseidon2 round sub-relation for third value
7, // external poseidon2 round sub-relation for fourth value
3, // external poseidon2 round sub-relation for first value (temporarily reduced from 7)
3, // external poseidon2 round sub-relation for second value (temporarily reduced from 7)
3, // external poseidon2 round sub-relation for third value (temporarily reduced from 7)
3, // external poseidon2 round sub-relation for fourth value (temporarily reduced from 7)
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ template <typename FF_> class Poseidon2InternalRelationImpl {
using FF = FF_;

static constexpr std::array<size_t, 4> SUBRELATION_PARTIAL_LENGTHS{
7, // internal poseidon2 round sub-relation for first value
7, // internal poseidon2 round sub-relation for second value
7, // internal poseidon2 round sub-relation for third value
7, // internal poseidon2 round sub-relation for fourth value
3, // internal poseidon2 round sub-relation for first value (temporarily reduced from 7)
3, // internal poseidon2 round sub-relation for second value (temporarily reduced from 7)
3, // internal poseidon2 round sub-relation for third value (temporarily reduced from 7)
3, // internal poseidon2 round sub-relation for fourth value (temporarily reduced from 7)
};

static constexpr fr D1 = crypto::Poseidon2Bn254ScalarFieldParams::internal_matrix_diagonal[0]; // decremented by 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ template <typename FF_> class TranslatorDecompositionRelationImpl {
static constexpr size_t RELATION_LENGTH =
4; // degree(lagrange_even_in_minicircuit_in_minicircuit(a - a_0 - a_1*2¹⁴ ... - a_l⋅2¹⁴ˡ )op) = 3
static constexpr std::array<size_t, 48> SUBRELATION_PARTIAL_LENGTHS{
4, // decomposition of accumulator limb 0 into microlimbs subrelation
4, // decomposition of accumulator limb 1 into microlimbs subrelation
4, // decomposition of accumulator limb 2 into microlimbs subrelation
4, // decomposition of accumulator limb 3 into microlimbs subrelation
3, // decomposition of accumulator limb 0 into microlimbs subrelation (temporarily reduced from 4)
3, // decomposition of accumulator limb 1 into microlimbs subrelation (temporarily reduced from 4)
3, // decomposition of accumulator limb 2 into microlimbs subrelation (temporarily reduced from 4)
3, // decomposition of accumulator limb 3 into microlimbs subrelation (temporarily reduced from 4)
3, // decomposition of P.y limb 0 into microlimbs subrelation
3, // decomposition of P.y limb 1 into microlimbs subrelation
3, // decomposition of P.y limb 2 into microlimbs subrelation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ template <typename FF_> class TranslatorDeltaRangeConstraintRelationImpl {
7; // degree((lagrange_real_last - 1)(lagrange_masking - 1) * D(D - 1)(D - 2)(D - 3)) = 6

static constexpr std::array<size_t, 10> SUBRELATION_PARTIAL_LENGTHS{
7, // ordered_range_constraints_0 step in {0,1,2,3} subrelation
7, // ordered_range_constraints_1 step in {0,1,2,3} subrelation
7, // ordered_range_constraints_2 step in {0,1,2,3} subrelation
7, // ordered_range_constraints_3 step in {0,1,2,3} subrelation
7, // ordered_range_constraints_4 step in {0,1,2,3} subrelation
3, // ordered_range_constraints_0 step in {0,1,2,3} subrelation (temporarily reduced from 7)
3, // ordered_range_constraints_1 step in {0,1,2,3} subrelation (temporarily reduced from 7)
3, // ordered_range_constraints_2 step in {0,1,2,3} subrelation (temporarily reduced from 7)
3, // ordered_range_constraints_3 step in {0,1,2,3} subrelation (temporarily reduced from 7)
3, // ordered_range_constraints_4 step in {0,1,2,3} subrelation (temporarily reduced from 7)
3, // ordered_range_constraints_0 ends with defined maximum value subrelation
3, // ordered_range_constraints_1 ends with defined maximum value subrelation
3, // ordered_range_constraints_2 ends with defined maximum value subrelation
Expand Down
Loading
Loading