1#ifdef AVM_COMPILE_BENCHMARKS
3#include <benchmark/benchmark.h>
19using namespace benchmark;
27#ifdef AVM_USE_UNIVARIATES
29struct FakeUnivariateAllEntities {
30 static constexpr size_t MAX_PARTIAL_RELATION_LENGTH = AvmFlavor::MAX_PARTIAL_RELATION_LENGTH;
33 DataType fixed_random_value;
35 FakeUnivariateAllEntities(
const DataType& fixed_random_value)
36 : fixed_random_value(fixed_random_value)
41FakeUnivariateAllEntities get_random_row()
43 return FakeUnivariateAllEntities(FakeUnivariateAllEntities::DataType::random_element());
46template <
typename Relation>
auto allocate_result()
55struct FakeAvmFullRow {
58 FakeAvmFullRow(
const FF& fixed_random_value)
59 : fixed_random_value(fixed_random_value)
63 FF fixed_random_value;
66FakeAvmFullRow get_random_row()
71template <
typename Relation>
auto allocate_result()
84 .public_input_delta = 0,
87 .eccvm_set_permutation_delta = 0,
91template <
typename Relation>
void BM_accumulate_relation(State& state)
93 auto row = get_random_row();
94 auto params = get_params();
95 FF scaling_factor = 1;
97 auto result = allocate_result<Relation>();
99 for (
auto _ : state) {
100 Relation::accumulate(result, row, params, scaling_factor);
104template <
typename Relation>
constexpr size_t get_interactions_count()
108 bb::constexpr_for<0, std::tuple_size_v<AllInteractions>, 1>([&]<
size_t i>() {
110 if constexpr (Relation::NAME == Interaction::RELATION_NAME) {
117template <
typename Relation>
void BM_accumulate_interactions(State& state)
120 bb::constexpr_for<0, std::tuple_size_v<AllInteractions>, 1>([&]<
size_t i>() {
122 if constexpr (Relation::NAME == Interaction::RELATION_NAME) {
123 BM_accumulate_relation<Interaction>(state);
130int main(
int argc,
char** argv)
132 bb::constexpr_for<0, std::tuple_size_v<typename AvmFlavor::MainRelations>, 1>([&]<
size_t i>() {
134 BENCHMARK(BM_accumulate_relation<Relation>)->Name(std::string(Relation::NAME) +
"_acc")->Unit(kMicrosecond);
135 if (get_interactions_count<Relation>() > 0) {
136 BENCHMARK(BM_accumulate_interactions<Relation>)
137 ->Name(std::string(Relation::NAME) +
"_interactions_acc")
138 ->Unit(kMicrosecond);
142 ::benchmark::Initialize(&argc, argv);
143 ::benchmark::RunSpecifiedBenchmarks();
152 std::cout <<
"This benchmark is disabled. To enable it, define AVM_COMPILE_BENCHMARKS." <<
std::endl;
BENCHMARK(parallel_for_field_element_addition) -> Unit(kMicrosecond) ->DenseRange(0, MAX_REPETITION_LOG)
A wrapper for Relations to expose methods used by the Sumcheck prover or verifier to add the contribu...
ArrayOfValues< FF, RelationImpl::SUBRELATION_PARTIAL_LENGTHS > SumcheckArrayOfValuesOverSubrelations
TupleOfUnivariates< FF, RelationImpl::SUBRELATION_PARTIAL_LENGTHS > SumcheckTupleOfUnivariatesOverSubrelations
A univariate polynomial represented by its values on {domain_start, domain_start + 1,...
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Container for parameters used by the grand product (permutation, lookup) Honk relations.
static field random_element(numeric::RNG *engine=nullptr) noexcept