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): use commit_sparse #7581

Merged
merged 1 commit into from
Jul 23, 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
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void AvmProver::execute_wire_commitments_round()
auto wire_polys = prover_polynomials.get_wires();
auto labels = commitment_labels.get_wires();
for (size_t idx = 0; idx < wire_polys.size(); ++idx) {
transcript->send_to_verifier(labels[idx], commitment_key->commit(wire_polys[idx]));
transcript->send_to_verifier(labels[idx], commitment_key->commit_sparse(wire_polys[idx]));
}
}

Expand Down Expand Up @@ -92,6 +92,7 @@ void AvmProver::execute_log_derivative_inverse_commitments_round()
{
// Commit to all logderivative inverse polynomials
for (auto [commitment, key_poly] : zip_view(witness_commitments.get_derived(), key->get_derived())) {
// We don't use commit_sparse here because the logderivative inverse polynomials are dense
commitment = commitment_key->commit(key_poly);
}

Expand Down
7 changes: 4 additions & 3 deletions bb-pilcom/bb-pil-backend/templates/prover.cpp.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void {{name}}Prover::execute_wire_commitments_round()
auto wire_polys = prover_polynomials.get_wires();
auto labels = commitment_labels.get_wires();
for (size_t idx = 0; idx < wire_polys.size(); ++idx) {
transcript->send_to_verifier(labels[idx], commitment_key->commit(wire_polys[idx]));
transcript->send_to_verifier(labels[idx], commitment_key->commit_sparse(wire_polys[idx]));
}
}

Expand Down Expand Up @@ -93,12 +93,13 @@ void {{name}}Prover::execute_log_derivative_inverse_commitments_round()
{
// Commit to all logderivative inverse polynomials
for (auto [commitment, key_poly] : zip_view(witness_commitments.get_derived(), key->get_derived())) {
commitment = commitment_key->commit(key_poly);
// We don't use commit_sparse here because the logderivative inverse polynomials are dense
commitment = commitment_key->commit(key_poly);
Copy link
Member

Choose a reason for hiding this comment

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

It depends some lookups are, as they are not active on every row

Copy link
Member

Choose a reason for hiding this comment

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

Grand product polys for the copy constraints are dense though so we can treat those differently

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah good point. I'll merge this one but we can consider later.

I did try with commit_sparse here and did see an improvement of some % points, but not as big as the other case. I preferred to err on the side of caution mem-wise, since the current implementation copies the poly.

}

// Send all commitments to the verifier
for (auto [label, commitment] : zip_view(commitment_labels.get_derived(), witness_commitments.get_derived())) {
transcript->send_to_verifier(label, commitment);
transcript->send_to_verifier(label, commitment);
}
}

Expand Down
Loading