Skip to content
Merged
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
31 changes: 27 additions & 4 deletions barretenberg/cpp/scripts/analyze_client_ivc_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
# For each kept time, get the proportion over all kept times.
sum_of_kept_times_ms = sum(float(time)
for _, time in bench_components.items())/1e6
MAX_LABEL_LENGTH = max(len(label) for label in to_keep)
max_label_length = max(len(label) for label in to_keep)
column = {"function": "function", "ms": "ms", "%": "% sum"}
print(
f"{column['function']:<{MAX_LABEL_LENGTH}}{column['ms']:>8} {column['%']:>8}")
f"{column['function']:<{max_label_length}}{column['ms']:>8} {column['%']:>8}")
for key in to_keep:
time_ms = bench[key]/1e6
print(f"{key:<{MAX_LABEL_LENGTH}}{time_ms:>8.0f} {time_ms/sum_of_kept_times_ms:>8.2%}")
print(f"{key:<{max_label_length}}{time_ms:>8.0f} {time_ms/sum_of_kept_times_ms:>8.2%}")

# Validate that kept times account for most of the total measured time.
total_time_ms = bench["real_time"]
Expand All @@ -42,8 +42,31 @@
sum_of_kept_times_ms, total_time_ms, sum_of_kept_times_ms/total_time_ms)
print(totals)

print("\nMajor contributors:")
print(
f"{column['function']:<{max_label_length}}{column['ms']:>8} {column['%']:>7}")
for key in ['commit(t)', 'compute_combiner(t)', 'compute_perturbator(t)', 'compute_univariate(t)']:
time_ms = bench[key]/1e6
print(f"{key:<{max_label_length}}{time_ms:>8.0f} {time_ms/sum_of_kept_times_ms:>8.2%}")


print('\nBreakdown of ECCVMProver::create_prover:')
for key in ["ECCVMComposer::compute_witness(t)", "ECCVMComposer::create_proving_key(t)"]:
time_ms = bench[key]/1e6
total_time_ms = bench["ECCVMComposer::create_prover(t)"]/1e6
print(f"{key:<{MAX_LABEL_LENGTH}}{time_ms:>8.0f} {time_ms/total_time_ms:>8.2%}")
print(f"{key:<{max_label_length}}{time_ms:>8.0f} {time_ms/total_time_ms:>8.2%}")

print('\nBreakdown of ProtogalaxyProver::fold_instances:')
protogalaxy_round_labels = [
"ProtoGalaxyProver_::preparation_round(t)",
"ProtoGalaxyProver_::perturbator_round(t)",
"ProtoGalaxyProver_::combiner_quotient_round(t)",
"ProtoGalaxyProver_::accumulator_update_round(t)"
]
max_label_length = max(len(label) for label in protogalaxy_round_labels)
for key in protogalaxy_round_labels:
time_ms = bench[key]/1e6
total_time_ms = bench["ProtogalaxyProver::fold_instances(t)"]/1e6
print(f"{key:<{max_label_length}}{time_ms:>8.0f} {time_ms/total_time_ms:>8.2%}")


Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,13 @@ std::shared_ptr<typename ProverInstances::Instance> ProtoGalaxyProver_<ProverIns

template <class ProverInstances> void ProtoGalaxyProver_<ProverInstances>::preparation_round()
{
BB_OP_COUNT_TIME_NAME("ProtoGalaxyProver_::preparation_round");
prepare_for_folding();
};

template <class ProverInstances> void ProtoGalaxyProver_<ProverInstances>::perturbator_round()
{
BB_OP_COUNT_TIME_NAME("ProtoGalaxyProver_::perturbator_round");
state.accumulator = get_accumulator();
FF delta = transcript->template get_challenge<FF>("delta");
state.deltas = compute_round_challenge_pows(state.accumulator->proving_key->log_circuit_size, delta);
Expand All @@ -221,6 +223,7 @@ template <class ProverInstances> void ProtoGalaxyProver_<ProverInstances>::pertu

template <class ProverInstances> void ProtoGalaxyProver_<ProverInstances>::combiner_quotient_round()
{
BB_OP_COUNT_TIME_NAME("ProtoGalaxyProver_::combiner_quotient_round");
auto perturbator_challenge = transcript->template get_challenge<FF>("perturbator_challenge");
instances.next_gate_challenges =
update_gate_challenges(perturbator_challenge, state.accumulator->gate_challenges, state.deltas);
Expand All @@ -239,6 +242,7 @@ template <class ProverInstances> void ProtoGalaxyProver_<ProverInstances>::combi

template <class ProverInstances> void ProtoGalaxyProver_<ProverInstances>::accumulator_update_round()
{
BB_OP_COUNT_TIME_NAME("ProtoGalaxyProver_::accumulator_update_round");
FF combiner_challenge = transcript->template get_challenge<FF>("combiner_quotient_challenge");
std::shared_ptr<Instance> next_accumulator =
compute_next_accumulator(instances, state.combiner_quotient, combiner_challenge, state.compressed_perturbator);
Expand Down
2 changes: 2 additions & 0 deletions barretenberg/cpp/src/barretenberg/sumcheck/sumcheck_round.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ template <typename Flavor> class SumcheckProverRound {
const bb::PowPolynomial<FF>& pow_polynomial,
const RelationSeparator alpha)
{
BB_OP_COUNT_TIME();

// Compute the constant contribution of pow polynomials for each edge. This is the product of the partial
// evaluation result c_l (i.e. pow(u_0,...,u_{l-1})) where u_0,...,u_{l-1} are the verifier challenges from
// previous rounds) and the elements of pow(\vec{β}) not containing β_0,..., β_l.
Expand Down