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
Optimize prover boundary evaluations in construction of composition polynomial #22
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Do we have some benchmark results? |
src/air/constraints/evaluator.rs
Outdated
let mut boundary_polys_evaluations = Vec::with_capacity(boundary_polys.len()); | ||
for poly in boundary_polys.iter() { | ||
let evaluations = evaluate_polynomial_on_lde_domain( | ||
poly, | ||
domain.blowup_factor, | ||
domain.interpolation_domain_size, | ||
&domain.coset_offset, | ||
) | ||
.unwrap(); | ||
boundary_polys_evaluations.push(evaluations); | ||
} | ||
|
||
let mut boundary_zerofiers_inverse_evaluations = | ||
Vec::with_capacity(boundary_zerofiers.len()); | ||
for poly in boundary_zerofiers.iter() { | ||
let mut evaluations = evaluate_polynomial_on_lde_domain( | ||
poly, | ||
domain.blowup_factor, | ||
domain.interpolation_domain_size, | ||
&domain.coset_offset, | ||
) | ||
.unwrap(); | ||
FieldElement::inplace_batch_inverse(&mut evaluations); | ||
boundary_zerofiers_inverse_evaluations.push(evaluations); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can evaluate the polynomials before collecting the original vectors, so we halve the memory taken by the whole operation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Done!
Codecov Report
@@ Coverage Diff @@
## main #22 +/- ##
==========================================
+ Coverage 97.92% 97.93% +0.01%
==========================================
Files 33 33
Lines 4872 4902 +30
==========================================
+ Hits 4771 4801 +30
Misses 101 101
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Improves 2 times the prover speed.