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

Perf: Improve MultiLin.Eval number of constraints #788

Merged
merged 5 commits into from
Jul 26, 2023
Merged

Conversation

Tabaie
Copy link
Contributor

@Tabaie Tabaie commented Jul 25, 2023

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

develop:
r1cs: 2100657 constraints
scs : 4194301 constraints

opt1 (successive fold):
r1cs: 1048576 constraints 49%
scs: 3145726 constraints 75%

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):

r1cs: 1048627 constraints 50%
scs: 2097226 constraints 50%

@Tabaie Tabaie changed the title bench: multilin eval constraints number Perf: Improve MultiLin.Eval number of constraints Jul 25, 2023
@Tabaie Tabaie marked this pull request as ready for review July 25, 2023 21:44
Copy link
Collaborator

@ivokub ivokub left a comment

Choose a reason for hiding this comment

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

Confirming @AlexandreBelling approval.

@ivokub ivokub merged commit b39b13f into develop Jul 26, 2023
4 checks passed
@ivokub ivokub deleted the perf/multilin-eval branch July 26, 2023 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants