Skip to content

Commit

Permalink
feat: new 17 in 20 IVC bench added to actions (#10777)
Browse files Browse the repository at this point in the history
Adds an IVC benchmark for the case of size 2^17 circuits in a 2^20
structured trace. (Adds tracking to the bench action).
  • Loading branch information
ledwards2225 authored Dec 16, 2024
1 parent b086c52 commit 9fbcff6
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
2 changes: 2 additions & 0 deletions barretenberg/cpp/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ bench-client-ivc:
COPY --dir +bench-binaries/* .
# install SRS needed for proving
COPY --dir ./srs_db/+build/. srs_db
RUN cd release && ./bin/client_ivc_bench --benchmark_out=../client_ivc_17_in_20_release.json --benchmark_filter="ClientIVCBench/Ambient_17_in_20/6$"
RUN cd release && ./bin/client_ivc_bench --benchmark_out=../client_ivc_release.json --benchmark_filter="ClientIVCBench/Full/6$"
RUN cd op-count && ./bin/client_ivc_bench --benchmark_out=../client_ivc_op_count.json --benchmark_filter="ClientIVCBench/Full/6$"
RUN cd op-count-time && ./bin/client_ivc_bench --benchmark_out=../client_ivc_op_count_time.json --benchmark_filter="ClientIVCBench/Full/6$"
Expand All @@ -248,6 +249,7 @@ bench:
END
COPY ./scripts/ci/combine_benchmarks.py ./scripts/ci/combine_benchmarks.py
RUN ./scripts/ci/combine_benchmarks.py \
native client_ivc_17_in_20_release.json \
native client_ivc_release.json \
native ultra_honk_release.json \
wasm client_ivc_wasm.json \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,29 @@ BENCHMARK_DEFINE_F(ClientIVCBench, Full)(benchmark::State& state)
}
}

/**
* @brief Benchmark the prover work for the full PG-Goblin IVC protocol
* @details Processes "dense" circuits of size 2^17 in a size 2^20 structured trace
*/
BENCHMARK_DEFINE_F(ClientIVCBench, Ambient_17_in_20)(benchmark::State& state)
{
ClientIVC ivc{ { E2E_FULL_TEST_STRUCTURE } };

auto total_num_circuits = 2 * static_cast<size_t>(state.range(0)); // 2x accounts for kernel circuits
auto mocked_vkeys = mock_verification_keys(total_num_circuits);

for (auto _ : state) {
BB_REPORT_OP_COUNT_IN_BENCH(state);
perform_ivc_accumulation_rounds(
total_num_circuits, ivc, mocked_vkeys, /* mock_vk */ true, /* large_first_app */ false);
ivc.prove();
}
}

#define ARGS Arg(ClientIVCBench::NUM_ITERATIONS_MEDIUM_COMPLEXITY)->Arg(2)

BENCHMARK_REGISTER_F(ClientIVCBench, Full)->Unit(benchmark::kMillisecond)->ARGS;
BENCHMARK_REGISTER_F(ClientIVCBench, Ambient_17_in_20)->Unit(benchmark::kMillisecond)->ARGS;

} // namespace

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,13 @@ class PrivateFunctionExecutionMockCircuitProducer {

MockDatabusProducer mock_databus;

bool large_first_app = true; // if true, first app is 2^19, else 2^17

public:
PrivateFunctionExecutionMockCircuitProducer(bool large_first_app = true)
: large_first_app(large_first_app)
{}

/**
* @brief Create the next circuit (app/kernel) in a mocked private function execution stack
*/
Expand All @@ -113,7 +119,7 @@ class PrivateFunctionExecutionMockCircuitProducer {
mock_databus.populate_kernel_databus(circuit); // populate databus inputs/outputs
ivc.complete_kernel_circuit_logic(circuit); // complete with recursive verifiers etc
} else {
bool use_large_circuit = (circuit_counter == 1); // first circuit is size 2^19
bool use_large_circuit = large_first_app && (circuit_counter == 1); // first circuit is size 2^19
GoblinMockCircuits::construct_mock_app_circuit(circuit, use_large_circuit); // construct mock app
mock_databus.populate_app_databus(circuit); // populate databus outputs
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ bool verify_ivc(ClientIVC::Proof& proof, ClientIVC& ivc)
void perform_ivc_accumulation_rounds(size_t NUM_CIRCUITS,
ClientIVC& ivc,
auto& precomputed_vks,
const bool& mock_vk = false)
const bool& mock_vk = false,
const bool large_first_app = true)
{
ASSERT(precomputed_vks.size() == NUM_CIRCUITS); // ensure presence of a precomputed VK for each circuit

PrivateFunctionExecutionMockCircuitProducer circuit_producer;
PrivateFunctionExecutionMockCircuitProducer circuit_producer(large_first_app);

for (size_t circuit_idx = 0; circuit_idx < NUM_CIRCUITS; ++circuit_idx) {
MegaCircuitBuilder circuit;
Expand Down

1 comment on commit 9fbcff6

@AztecBot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'C++ Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.05.

Benchmark suite Current: 9fbcff6 Previous: e077980 Ratio
wasmconstruct_proof_ultrahonk_power_of_2/20 16532.326059000003 ms/iter 15383.449391 ms/iter 1.07

This comment was automatically generated by workflow using github-action-benchmark.

CC: @ludamad @codygunton

Please sign in to comment.