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

Parallelize Phase2 Contributions and Preparation #41

Merged
merged 9 commits into from
Mar 28, 2020

Conversation

gakonst
Copy link

@gakonst gakonst commented Mar 27, 2020

  • Revives the buffer splitting logic I had added in earlier iterations of the code, to allow for parallel processing of non intersecting parts of the buffer
  • Contributions to H and L queries and now done in parallel
  • Reading the lagrange coefficients is done in parallel (needed when you create the Phase 2 MPC parameters)
  • Creating the lagrange coefficients is done in parallel (needed when you prepare the phase 2 parameters from phase1)

NB: Crossbeam's spawn returns a JoinHandle which we can use to get the values returned from a thread. It's a bit confusing, but Rayon's spawn has no return value. It was also fun to find out that Rust also supported scoped threads, but removed them: rust-lang/rust#24292

This seems to have ~60% speedup at ~200k constraint circuits contributions

@gakonst gakonst changed the title Gakonst/parallelize phase2 Parallelize Phase2 Mar 27, 2020
@gakonst gakonst force-pushed the gakonst/parallelize-phase2 branch from 0213d56 to 01264a9 Compare March 27, 2020 06:46
@gakonst gakonst requested a review from kobigurk March 27, 2020 07:56
@gakonst gakonst changed the title Parallelize Phase2 Parallelize Phase2 Contributions and Preparation Mar 27, 2020
gakonst added 9 commits March 28, 2020 10:29
this is useful to reduce the time required to generate the Phase 2 step
Due to passing a slice to the contribute function, we need to manually adjust the size of the file (and as a result of the mmap) to include 1 more pubkey (this would not be needed if we just passed the file itself, but then we would not be able to parallelize as well)
Previously we used a constant pubkey size which is wrong, since it depends on the curve being used
Previously we were using just the number of constraints, while the required number is the sum of constraints, public inputs and private inputs
@gakonst gakonst force-pushed the gakonst/parallelize-phase2 branch from 002dbca to 731ee91 Compare March 28, 2020 08:29
@gakonst gakonst changed the base branch from gakonst/phase2-fix to master March 28, 2020 08:30
@gakonst gakonst merged commit 2c99e6e into master Mar 28, 2020
@gakonst gakonst deleted the gakonst/parallelize-phase2 branch March 28, 2020 08:30
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.

2 participants