-
Notifications
You must be signed in to change notification settings - Fork 101
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
Better optimization of intermediate polynomials #2532
base: linear-constraint-remover
Are you sure you want to change the base?
Better optimization of intermediate polynomials #2532
Conversation
pilopt/src/lib.rs
Outdated
AlgebraicExpression::Number(value) => { | ||
let ((name, poly_id), value) = symbols_and_definitions.next().unwrap(); | ||
match value { | ||
AlgebraicExpression::Number(_) | AlgebraicExpression::Reference(_) => { |
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.
Where do you check for "no shift"?
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.
Actually, non-shifted is not required. Changed.
Co-authored-by: chriseth <[email protected]>
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.
less complexity and better results, nice! 👍
Before this PR, we different optimizers for the cases:
col i = constant
-> inlinei
w_0 = w_1
for two witnesses, only keepw_0
w = lin
, replace witnessw
with intermediate, only if lin is NOT a single witness, to avoid overlapping with the previous optimizerAfter this PR, we have:
w = lin
, replace witnessw
(without the edge case above)col i = e
ife
is a number or a polynomial reference -> inlinei
This reduces complexity in the optimizer, and also produces more optimized code, as seen in the tests.
One "breaking" change is that now when many witness are constrained to be equal, the kept on is not the first, but the last, as shown below:
x
does disappear.This works for larger sets of equal-constrained witnesses, as shown in the tests.