Skip to content

Commit 9fbcff6

Browse files
authored
feat: new 17 in 20 IVC bench added to actions (#10777)
Adds an IVC benchmark for the case of size 2^17 circuits in a 2^20 structured trace. (Adds tracking to the bench action).
1 parent b086c52 commit 9fbcff6

File tree

4 files changed

+32
-3
lines changed

4 files changed

+32
-3
lines changed

barretenberg/cpp/Earthfile

+2
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ bench-client-ivc:
230230
COPY --dir +bench-binaries/* .
231231
# install SRS needed for proving
232232
COPY --dir ./srs_db/+build/. srs_db
233+
RUN cd release && ./bin/client_ivc_bench --benchmark_out=../client_ivc_17_in_20_release.json --benchmark_filter="ClientIVCBench/Ambient_17_in_20/6$"
233234
RUN cd release && ./bin/client_ivc_bench --benchmark_out=../client_ivc_release.json --benchmark_filter="ClientIVCBench/Full/6$"
234235
RUN cd op-count && ./bin/client_ivc_bench --benchmark_out=../client_ivc_op_count.json --benchmark_filter="ClientIVCBench/Full/6$"
235236
RUN cd op-count-time && ./bin/client_ivc_bench --benchmark_out=../client_ivc_op_count_time.json --benchmark_filter="ClientIVCBench/Full/6$"
@@ -248,6 +249,7 @@ bench:
248249
END
249250
COPY ./scripts/ci/combine_benchmarks.py ./scripts/ci/combine_benchmarks.py
250251
RUN ./scripts/ci/combine_benchmarks.py \
252+
native client_ivc_17_in_20_release.json \
251253
native client_ivc_release.json \
252254
native ultra_honk_release.json \
253255
wasm client_ivc_wasm.json \

barretenberg/cpp/src/barretenberg/benchmark/client_ivc_bench/client_ivc.bench.cpp

+20
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,29 @@ BENCHMARK_DEFINE_F(ClientIVCBench, Full)(benchmark::State& state)
4545
}
4646
}
4747

48+
/**
49+
* @brief Benchmark the prover work for the full PG-Goblin IVC protocol
50+
* @details Processes "dense" circuits of size 2^17 in a size 2^20 structured trace
51+
*/
52+
BENCHMARK_DEFINE_F(ClientIVCBench, Ambient_17_in_20)(benchmark::State& state)
53+
{
54+
ClientIVC ivc{ { E2E_FULL_TEST_STRUCTURE } };
55+
56+
auto total_num_circuits = 2 * static_cast<size_t>(state.range(0)); // 2x accounts for kernel circuits
57+
auto mocked_vkeys = mock_verification_keys(total_num_circuits);
58+
59+
for (auto _ : state) {
60+
BB_REPORT_OP_COUNT_IN_BENCH(state);
61+
perform_ivc_accumulation_rounds(
62+
total_num_circuits, ivc, mocked_vkeys, /* mock_vk */ true, /* large_first_app */ false);
63+
ivc.prove();
64+
}
65+
}
66+
4867
#define ARGS Arg(ClientIVCBench::NUM_ITERATIONS_MEDIUM_COMPLEXITY)->Arg(2)
4968

5069
BENCHMARK_REGISTER_F(ClientIVCBench, Full)->Unit(benchmark::kMillisecond)->ARGS;
70+
BENCHMARK_REGISTER_F(ClientIVCBench, Ambient_17_in_20)->Unit(benchmark::kMillisecond)->ARGS;
5171

5272
} // namespace
5373

barretenberg/cpp/src/barretenberg/client_ivc/mock_circuit_producer.hpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,13 @@ class PrivateFunctionExecutionMockCircuitProducer {
9696

9797
MockDatabusProducer mock_databus;
9898

99+
bool large_first_app = true; // if true, first app is 2^19, else 2^17
100+
99101
public:
102+
PrivateFunctionExecutionMockCircuitProducer(bool large_first_app = true)
103+
: large_first_app(large_first_app)
104+
{}
105+
100106
/**
101107
* @brief Create the next circuit (app/kernel) in a mocked private function execution stack
102108
*/
@@ -113,7 +119,7 @@ class PrivateFunctionExecutionMockCircuitProducer {
113119
mock_databus.populate_kernel_databus(circuit); // populate databus inputs/outputs
114120
ivc.complete_kernel_circuit_logic(circuit); // complete with recursive verifiers etc
115121
} else {
116-
bool use_large_circuit = (circuit_counter == 1); // first circuit is size 2^19
122+
bool use_large_circuit = large_first_app && (circuit_counter == 1); // first circuit is size 2^19
117123
GoblinMockCircuits::construct_mock_app_circuit(circuit, use_large_circuit); // construct mock app
118124
mock_databus.populate_app_databus(circuit); // populate databus outputs
119125
}

barretenberg/cpp/src/barretenberg/client_ivc/test_bench_shared.hpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ bool verify_ivc(ClientIVC::Proof& proof, ClientIVC& ivc)
3333
void perform_ivc_accumulation_rounds(size_t NUM_CIRCUITS,
3434
ClientIVC& ivc,
3535
auto& precomputed_vks,
36-
const bool& mock_vk = false)
36+
const bool& mock_vk = false,
37+
const bool large_first_app = true)
3738
{
3839
ASSERT(precomputed_vks.size() == NUM_CIRCUITS); // ensure presence of a precomputed VK for each circuit
3940

40-
PrivateFunctionExecutionMockCircuitProducer circuit_producer;
41+
PrivateFunctionExecutionMockCircuitProducer circuit_producer(large_first_app);
4142

4243
for (size_t circuit_idx = 0; circuit_idx < NUM_CIRCUITS; ++circuit_idx) {
4344
MegaCircuitBuilder circuit;

0 commit comments

Comments
 (0)