-
Notifications
You must be signed in to change notification settings - Fork 499
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
halo2_proofs: Avoid caching rotated polynomials in poly::Evaluator
#644
Conversation
Previously we used the existing `Polynomial::rotate` and `EvaluationDomain::rotate_extended` APIs to rotate the polynomials we query at non-zero rotations, and then stored references to the chunks of each (rotated and unrotated) polynomial as slices. When we reached an `AstLeaf`, we would then clone the corresponding polynomial chunk. We now avoid all of this with combined "rotate-and-chunk" APIs, making use of the observation that a rotation is simply a renumbering of the indices of the polynomial coefficients. Given that when we reach an `AstLeaf` we already needed to allocate, these new APIs have the same number of allocations during AST evaluation, but enable us to completely avoid caching any information about the rotations or rotated polynomials ahead of time.
Running
So for the Orchard circuit, this is a 14.9% reduction in peak heap memory consumption, and a 7.7% reduction in peak RSS. It also gives a minor performance boost to proving times (Ryzen 9 5950X):
|
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.
utACK
Previously we used the existing
Polynomial::rotate
andEvaluationDomain::rotate_extended
APIs to rotate the polynomials we query at non-zero rotations, and then stored references to the chunks of each (rotated and unrotated) polynomial as slices. When we reached anAstLeaf
, we would then clone the corresponding polynomial chunk.We now avoid all of this with combined "rotate-and-chunk" APIs, making use of the observation that a rotation is simply a renumbering of the indices of the polynomial coefficients. Given that when we reach an
AstLeaf
we already needed to allocate, these new APIs have the same number of allocations during AST evaluation, but enable us to completely avoid caching any information about the rotations or rotated polynomials ahead of time.