Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
relations.bench.cpp
Go to the documentation of this file.
1
#include "
barretenberg/eccvm/eccvm_flavor.hpp
"
2
#include "
barretenberg/flavor/mega_flavor.hpp
"
3
#include "
barretenberg/flavor/ultra_flavor.hpp
"
4
#include "
barretenberg/protogalaxy/protogalaxy_prover_internal.hpp
"
// just for an alias; should perhaps move to prover
5
#include "
barretenberg/translator_vm/translator_flavor.hpp
"
6
#include "
barretenberg/ultra_honk/decider_keys.hpp
"
7
#include <benchmark/benchmark.h>
8
9
namespace
{
10
auto
&
engine
=
bb::numeric::get_debug_randomness
();
11
}
12
13
namespace
bb::benchmark::relations
{
14
15
using
Fr
=
bb::fr
;
16
using
Fq
=
grumpkin::fr
;
17
18
// Generic helper for executing Relation::accumulate for the template specified input type
19
template
<
typename
Flavor,
typename
Relation,
typename
Input,
typename
Accumulator>
20
void
execute_relation
(::benchmark::State& state)
21
{
22
using
FF
=
typename
Flavor::FF
;
23
24
auto
params =
bb::RelationParameters<FF>::get_random
();
25
26
// Instantiate zero-initialized inputs and accumulator
27
Input input{};
28
Accumulator accumulator;
29
30
for
(
auto
_ : state) {
31
Relation::accumulate(accumulator, input, params, 1);
32
}
33
}
34
35
// Single execution of relation on values (FF), e.g. Sumcheck verifier / PG perturbator work
36
template
<
typename
Flavor,
typename
Relation>
void
execute_relation_for_values
(::benchmark::State& state)
37
{
38
using
Input =
typename
Flavor::AllValues
;
39
using
Accumulator =
typename
Relation::SumcheckArrayOfValuesOverSubrelations
;
40
41
execute_relation<Flavor, Relation, Input, Accumulator>(state);
42
}
43
44
// Single execution of relation on Sumcheck univariates, i.e. Sumcheck/Decider prover work
45
template
<
typename
Flavor,
typename
Relation>
void
execute_relation_for_univariates
(::benchmark::State& state)
46
{
47
using
Input =
typename
Flavor::ExtendedEdges
;
48
using
Accumulator =
typename
Relation::SumcheckTupleOfUnivariatesOverSubrelations
;
49
50
execute_relation<Flavor, Relation, Input, Accumulator>(state);
51
}
52
53
// Single execution of relation on PG univariates, i.e. PG combiner work
54
template
<
typename
Flavor,
typename
Relation>
void
execute_relation_for_pg_univariates
(::benchmark::State& state)
55
{
56
using
DeciderProvingKeys =
DeciderProvingKeys_<Flavor>
;
57
using
Input =
ProtogalaxyProverInternal<DeciderProvingKeys>::ExtendedUnivariates
;
58
using
Accumulator =
59
typename
Relation::template ProtogalaxyTupleOfUnivariatesOverSubrelations<DeciderProvingKeys::NUM>;
60
61
execute_relation<Flavor, Relation, Input, Accumulator>(state);
62
}
63
64
// Ultra relations (PG prover combiner work)
65
BENCHMARK
(
execute_relation_for_pg_univariates
<
UltraFlavor
,
UltraArithmeticRelation<Fr>
>);
66
BENCHMARK
(
execute_relation_for_pg_univariates
<
UltraFlavor
,
DeltaRangeConstraintRelation<Fr>
>);
67
BENCHMARK
(
execute_relation_for_pg_univariates
<
UltraFlavor
,
EllipticRelation<Fr>
>);
68
BENCHMARK
(
execute_relation_for_pg_univariates
<
UltraFlavor
,
MemoryRelation<Fr>
>);
69
BENCHMARK
(
execute_relation_for_pg_univariates
<
UltraFlavor
,
NonNativeFieldRelation<Fr>
>);
70
BENCHMARK
(
execute_relation_for_pg_univariates
<
UltraFlavor
,
LogDerivLookupRelation<Fr>
>);
71
BENCHMARK
(
execute_relation_for_pg_univariates
<
UltraFlavor
,
UltraPermutationRelation<Fr>
>);
72
73
// Goblin-Ultra only relations (PG prover combiner work)
74
BENCHMARK
(
execute_relation_for_pg_univariates
<
MegaFlavor
,
EccOpQueueRelation<Fr>
>);
75
BENCHMARK
(
execute_relation_for_pg_univariates
<
MegaFlavor
,
DatabusLookupRelation<Fr>
>);
76
BENCHMARK
(
execute_relation_for_pg_univariates
<
MegaFlavor
,
Poseidon2ExternalRelation<Fr>
>);
77
BENCHMARK
(
execute_relation_for_pg_univariates
<
MegaFlavor
,
Poseidon2InternalRelation<Fr>
>);
78
79
// Ultra relations (Sumcheck prover work)
80
BENCHMARK
(
execute_relation_for_univariates
<
UltraFlavor
,
UltraArithmeticRelation<Fr>
>);
81
BENCHMARK
(
execute_relation_for_univariates
<
UltraFlavor
,
DeltaRangeConstraintRelation<Fr>
>);
82
BENCHMARK
(
execute_relation_for_univariates
<
UltraFlavor
,
EllipticRelation<Fr>
>);
83
BENCHMARK
(
execute_relation_for_univariates
<
UltraFlavor
,
MemoryRelation<Fr>
>);
84
BENCHMARK
(
execute_relation_for_univariates
<
UltraFlavor
,
NonNativeFieldRelation<Fr>
>);
85
BENCHMARK
(
execute_relation_for_univariates
<
UltraFlavor
,
LogDerivLookupRelation<Fr>
>);
86
BENCHMARK
(
execute_relation_for_univariates
<
UltraFlavor
,
UltraPermutationRelation<Fr>
>);
87
88
// Goblin-Ultra only relations (Sumcheck prover work)
89
BENCHMARK
(
execute_relation_for_univariates
<
MegaFlavor
,
EccOpQueueRelation<Fr>
>);
90
BENCHMARK
(
execute_relation_for_univariates
<
MegaFlavor
,
DatabusLookupRelation<Fr>
>);
91
BENCHMARK
(
execute_relation_for_univariates
<
MegaFlavor
,
Poseidon2ExternalRelation<Fr>
>);
92
BENCHMARK
(
execute_relation_for_univariates
<
MegaFlavor
,
Poseidon2InternalRelation<Fr>
>);
93
94
// Ultra relations (verifier work)
95
BENCHMARK
(
execute_relation_for_values
<
UltraFlavor
,
UltraArithmeticRelation<Fr>
>);
96
BENCHMARK
(
execute_relation_for_values
<
UltraFlavor
,
DeltaRangeConstraintRelation<Fr>
>);
97
BENCHMARK
(
execute_relation_for_values
<
UltraFlavor
,
EllipticRelation<Fr>
>);
98
BENCHMARK
(
execute_relation_for_values
<
UltraFlavor
,
MemoryRelation<Fr>
>);
99
BENCHMARK
(
execute_relation_for_values
<
UltraFlavor
,
NonNativeFieldRelation<Fr>
>);
100
BENCHMARK
(
execute_relation_for_values
<
UltraFlavor
,
LogDerivLookupRelation<Fr>
>);
101
BENCHMARK
(
execute_relation_for_values
<
UltraFlavor
,
UltraPermutationRelation<Fr>
>);
102
103
// Goblin-Ultra only relations (verifier work)
104
BENCHMARK
(
execute_relation_for_values
<
MegaFlavor
,
EccOpQueueRelation<Fr>
>);
105
BENCHMARK
(
execute_relation_for_values
<
MegaFlavor
,
DatabusLookupRelation<Fr>
>);
106
BENCHMARK
(
execute_relation_for_values
<
MegaFlavor
,
Poseidon2ExternalRelation<Fr>
>);
107
BENCHMARK
(
execute_relation_for_values
<
MegaFlavor
,
Poseidon2InternalRelation<Fr>
>);
108
109
// Translator VM
110
BENCHMARK
(
execute_relation_for_values
<
TranslatorFlavor
,
TranslatorDecompositionRelation<Fr>
>);
111
BENCHMARK
(
execute_relation_for_values
<
TranslatorFlavor
,
TranslatorOpcodeConstraintRelation<Fr>
>);
112
BENCHMARK
(
execute_relation_for_values
<
TranslatorFlavor
,
TranslatorAccumulatorTransferRelation<Fr>
>);
113
BENCHMARK
(
execute_relation_for_values
<
TranslatorFlavor
,
TranslatorDeltaRangeConstraintRelation<Fr>
>);
114
BENCHMARK
(
execute_relation_for_values
<
TranslatorFlavor
,
TranslatorNonNativeFieldRelation<Fr>
>);
115
BENCHMARK
(
execute_relation_for_values
<
TranslatorFlavor
,
TranslatorPermutationRelation<Fr>
>);
116
117
// ECCVM
118
BENCHMARK
(
execute_relation_for_values
<
ECCVMFlavor
,
ECCVMLookupRelation<Fq>
>);
119
BENCHMARK
(
execute_relation_for_values
<
ECCVMFlavor
,
ECCVMMSMRelation<Fq>
>);
120
BENCHMARK
(
execute_relation_for_values
<
ECCVMFlavor
,
ECCVMPointTableRelation<Fq>
>);
121
BENCHMARK
(
execute_relation_for_values
<
ECCVMFlavor
,
ECCVMSetRelation<Fq>
>);
122
BENCHMARK
(
execute_relation_for_values
<
ECCVMFlavor
,
ECCVMTranscriptRelation<Fq>
>);
123
BENCHMARK
(
execute_relation_for_values
<
ECCVMFlavor
,
ECCVMWnafRelation<Fq>
>);
124
BENCHMARK
(
execute_relation_for_values
<
ECCVMFlavor
,
ECCVMBoolsRelation<Fq>
>);
125
126
}
// namespace bb::benchmark::relations
127
128
BENCHMARK_MAIN
();
bb::ECCVMFlavor
Definition
eccvm_flavor.hpp:34
bb::MegaFlavor::AllValues
A field element for each entity of the flavor. These entities represent the prover polynomials evalua...
Definition
mega_flavor.hpp:352
bb::MegaFlavor
Definition
mega_flavor.hpp:33
bb::MegaFlavor::FF
Curve::ScalarField FF
Definition
mega_flavor.hpp:37
bb::MegaFlavor::ExtendedEdges
ProverUnivariates< MAX_PARTIAL_RELATION_LENGTH > ExtendedEdges
A container for univariates produced during the hot loop in sumcheck.
Definition
mega_flavor.hpp:549
bb::ProtogalaxyProverInternal::ExtendedUnivariates
typename Flavor::template ProverUnivariatesWithOptimisticSkipping< ExtendedUnivariate::LENGTH, DeciderPKs::NUM - 1 > ExtendedUnivariates
Definition
protogalaxy_prover_internal.hpp:77
bb::Relation
A wrapper for Relations to expose methods used by the Sumcheck prover or verifier to add the contribu...
Definition
relation_types.hpp:153
bb::Relation::SumcheckArrayOfValuesOverSubrelations
ArrayOfValues< FF, RelationImpl::SUBRELATION_PARTIAL_LENGTHS > SumcheckArrayOfValuesOverSubrelations
Definition
relation_types.hpp:178
bb::Relation::SumcheckTupleOfUnivariatesOverSubrelations
TupleOfUnivariates< FF, RelationImpl::SUBRELATION_PARTIAL_LENGTHS > SumcheckTupleOfUnivariatesOverSubrelations
Definition
relation_types.hpp:176
bb::TranslatorFlavor
Definition
translator_flavor.hpp:30
bb::UltraFlavor
Definition
ultra_flavor.hpp:35
decider_keys.hpp
eccvm_flavor.hpp
engine
numeric::RNG & engine
Definition
eccvm_transcript.test.cpp:282
mega_flavor.hpp
bb::benchmark::relations
Definition
relations.bench.cpp:13
bb::benchmark::relations::execute_relation_for_pg_univariates
void execute_relation_for_pg_univariates(::benchmark::State &state)
Definition
relations.bench.cpp:54
bb::benchmark::relations::execute_relation
void execute_relation(::benchmark::State &state)
Definition
relations.bench.cpp:20
bb::benchmark::relations::execute_relation_for_values
void execute_relation_for_values(::benchmark::State &state)
Definition
relations.bench.cpp:36
bb::benchmark::relations::execute_relation_for_univariates
void execute_relation_for_univariates(::benchmark::State &state)
Definition
relations.bench.cpp:45
bb::benchmark::relations::BENCHMARK
BENCHMARK(execute_relation_for_pg_univariates< UltraFlavor, UltraArithmeticRelation< Fr > >)
bb::grumpkin::fr
bb::fq fr
Definition
grumpkin.hpp:18
bb::numeric::get_debug_randomness
RNG & get_debug_randomness(bool reset, std::uint_fast64_t seed)
Definition
engine.cpp:190
bb::FF
typename Flavor::FF FF
Definition
protogalaxy.bench.cpp:16
bb::fr
field< Bn254FrParams > fr
Definition
fr.hpp:174
protogalaxy_prover_internal.hpp
BENCHMARK_MAIN
BENCHMARK_MAIN()
bb::DeciderProvingKeys_
Definition
decider_keys.hpp:14
bb::RelationParameters::get_random
static RelationParameters get_random()
Definition
relation_parameters.hpp:58
bb::field< Bn254FrParams >
translator_flavor.hpp
ultra_flavor.hpp
src
barretenberg
benchmark
relations_bench
relations.bench.cpp
Generated by
1.9.8