Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(avm): some cleaning in avm prover #9311

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 4 additions & 15 deletions barretenberg/cpp/src/barretenberg/vm/avm/generated/prover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,9 @@ using FF = Flavor::FF;
*/
AvmProver::AvmProver(std::shared_ptr<Flavor::ProvingKey> input_key, std::shared_ptr<PCSCommitmentKey> commitment_key)
: key(std::move(input_key))
, prover_polynomials(*key)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is probably the right thing but can you confirm there are no performance regression?

Copy link
Contributor Author

@jeanmon jeanmon Oct 21, 2024

Choose a reason for hiding this comment

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

Couple of proving runs on mainframe do not show any significative difference. Seems rather to be a bit faster but the conducted experiment was not thorough enough to really confirm a speed up.

, commitment_key(std::move(commitment_key))
{
for (auto [prover_poly, key_poly] : zip_view(prover_polynomials.get_unshifted(), key->get_all())) {
ASSERT(bb::flavor_get_label(prover_polynomials, prover_poly) == bb::flavor_get_label(*key, key_poly));
prover_poly = key_poly.share();
}
for (auto [prover_poly, key_poly] : zip_view(prover_polynomials.get_shifted(), key->get_to_be_shifted())) {
ASSERT(bb::flavor_get_label(prover_polynomials, prover_poly) ==
bb::flavor_get_label(*key, key_poly) + "_shift");
prover_poly = key_poly.shifted();
}
}
{}

/**
* @brief Add circuit size, public input size, and public inputs to transcript
Expand Down Expand Up @@ -69,11 +60,9 @@ void AvmProver::execute_wire_commitments_round()

void AvmProver::execute_log_derivative_inverse_round()
{
auto [beta, gamm] = transcript->template get_challenges<FF>("beta", "gamma");
auto [beta, gamma] = transcript->template get_challenges<FF>("beta", "gamma");
relation_parameters.beta = beta;
relation_parameters.gamma = gamm;

auto prover_polynomials = ProverPolynomials(*key);
relation_parameters.gamma = gamma;
std::vector<std::function<void()>> tasks;

bb::constexpr_for<0, std::tuple_size_v<Flavor::LookupRelations>, 1>([&]<size_t relation_idx>() {
Expand Down
20 changes: 4 additions & 16 deletions bb-pilcom/bb-pil-backend/templates/prover.cpp.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,9 @@ using FF = Flavor::FF;
{{name}}Prover::{{name}}Prover(std::shared_ptr<Flavor::ProvingKey> input_key,
std::shared_ptr<PCSCommitmentKey> commitment_key)
: key(std::move(input_key))
, prover_polynomials(*key)
, commitment_key(std::move(commitment_key))
{
for (auto [prover_poly, key_poly] : zip_view(prover_polynomials.get_unshifted(), key->get_all())) {
ASSERT(bb::flavor_get_label(prover_polynomials, prover_poly) ==
bb::flavor_get_label(*key, key_poly));
prover_poly = key_poly.share();
}
for (auto [prover_poly, key_poly] : zip_view(prover_polynomials.get_shifted(), key->get_to_be_shifted())) {
ASSERT(bb::flavor_get_label(prover_polynomials, prover_poly) ==
bb::flavor_get_label(*key, key_poly) + "_shift");
prover_poly = key_poly.shifted();
}
}
{}

/**
* @brief Add circuit size, public input size, and public inputs to transcript
Expand Down Expand Up @@ -70,11 +60,9 @@ void {{name}}Prover::execute_wire_commitments_round()

void {{name}}Prover::execute_log_derivative_inverse_round()
{
auto [beta, gamm] = transcript->template get_challenges<FF>("beta", "gamma");
auto [beta, gamma] = transcript->template get_challenges<FF>("beta", "gamma");
relation_parameters.beta = beta;
relation_parameters.gamma = gamm;

auto prover_polynomials = ProverPolynomials(*key);
relation_parameters.gamma = gamma;
std::vector<std::function<void()>> tasks;

bb::constexpr_for<0, std::tuple_size_v<Flavor::LookupRelations>, 1>([&]<size_t relation_idx>() {
Expand Down
Loading