Skip to content

Commit

Permalink
Make benchmarks run
Browse files Browse the repository at this point in the history
% taskset -c 0-15 ./bin/goblin_bench                                                                      3m 25s ~/aztec-packages/barretenberg/cpp/build ad/feat/goblin-bench + mainframe
2023-12-13T22:09:18+00:00
Running ./bin/goblin_bench
Run on (128 X 2649.99 MHz CPU s)
CPU Caches:
  L1 Data 32 KiB (x64)
  L1 Instruction 32 KiB (x64)
  L2 Unified 512 KiB (x64)
  L3 Unified 32768 KiB (x8)
Load Average: 3.64, 11.05, 9.25
-----------------------------------------------------------
Benchmark                 Time             CPU   Iterations
-----------------------------------------------------------
goblin_recursion      25552 ms        18249 ms            1
  • Loading branch information
codygunton committed Dec 13, 2023
1 parent e59523a commit e4b9cf9
Showing 1 changed file with 22 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,37 @@ using namespace barretenberg;
using namespace proof_system;

namespace {
void goblin_recursion(State& /*unused*/) noexcept
void goblin_recursion(State& state) noexcept
{
barretenberg::srs::init_crs_factory("../srs_db/ignition");
barretenberg::srs::init_grumpkin_crs_factory("../srs_db/grumpkin");

Goblin goblin;

// Construct an initial circuit; its proof will be recursively verified by the first kernel
GoblinUltraCircuitBuilder initial_circuit{ goblin.op_queue };
GoblinMockCircuits::construct_simple_initial_circuit(initial_circuit);
Goblin::AccumulationOutput kernel_input = goblin.accumulate(initial_circuit);

// Construct a series of simple Goblin circuits; generate and verify their proofs
size_t NUM_CIRCUITS = 2;
for (size_t circuit_idx = 0; circuit_idx < NUM_CIRCUITS; ++circuit_idx) {
// Construct a circuit with logic resembling that of the "kernel circuit"
GoblinUltraCircuitBuilder circuit_builder{ goblin.op_queue };
GoblinMockCircuits::construct_mock_kernel_circuit(circuit_builder, kernel_input);

// Construct proof of the current kernel circuit to be recursively verified by the next one
kernel_input = goblin.accumulate(circuit_builder);
for (auto _ : state) {
// Construct a series of simple Goblin circuits; generate and verify their proofs
size_t NUM_CIRCUITS = 2;
for (size_t circuit_idx = 0; circuit_idx < NUM_CIRCUITS; ++circuit_idx) {
// Construct a circuit with logic resembling that of the "kernel circuit"
GoblinUltraCircuitBuilder circuit_builder{ goblin.op_queue };
GoblinMockCircuits::construct_mock_kernel_circuit(circuit_builder, kernel_input);

// Construct proof of the current kernel circuit to be recursively verified by the next one
kernel_input = goblin.accumulate(circuit_builder);
}

Goblin::Proof proof = goblin.prove();
// Verify the final ultra proof
honk::GoblinUltraVerifier ultra_verifier{ kernel_input.verification_key };
ultra_verifier.verify_proof(kernel_input.proof);
// Verify the goblin proof (eccvm, translator, merge)
goblin.verify(proof);
}

Goblin::Proof proof = goblin.prove();
// Verify the final ultra proof
honk::GoblinUltraVerifier ultra_verifier{ kernel_input.verification_key };
ultra_verifier.verify_proof(kernel_input.proof);
// Verify the goblin proof (eccvm, translator, merge)
goblin.verify(proof);
}
} // namespace

Expand Down

0 comments on commit e4b9cf9

Please sign in to comment.