Perf: Improve MultiLin.Eval number of constraints #788
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Evaluation of large multilinear extensions is a major bottleneck in GKR verification. Currently the hypercube bases are evaluated at the requested point and the linear combination of these results with the corresponding hypercube values is taken. A massive reduction in the number of constraints can be achieved by performing successive foldings instead. For the 20-variable case we get
a 25% improvement for SCS.
A second optimization defers scaling of folding operations which is corrected at the end. My experiments suggest that this starts paying off at around the$2^{16}$ size. It doesn't help with R1CS at all, but doesn't hurt significantly either. With SCS we see significant additional gains:
ops 1&2 (successive fold + defer scaling for large sizes):