-
Notifications
You must be signed in to change notification settings - Fork 129
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
Send and Sync Region
#173
Comments
Region
and/or Layouter
Region
Quick update on this. I implemented the above using just the I roughly tested it in a parallelized setting and it works a-ok by mock proving. Will test out with full proving soon. The modifications did not require wrapping the inner |
For some visibility in the changes made see: zkonduit@5eebade In terms of impact on other repos:
|
Alright yet another update. One note is that the copy constraint labels can be non-deterministic in the case of a parallelized layout. In particular, referring to step 2 of the algorithm in the Halo2 Book for permutation arguments:
The smaller cycle in a multi-threaded setting can be non-deterministic and as such, the constructed copy constraint labels can differ between the key generation and proof stage. A way to mitigate this is to make this label deterministic. What I've done in zkonduit@5eebade is to swap: halo2/halo2_proofs/src/plonk/permutation/keygen.rs Lines 83 to 85 in 17e9765
for a deterministic label propagation such as: if right_cycle.0 >= left_cycle.0 && right_cycle.1 > left_cycle.1 {
std::mem::swap(&mut left_cycle, &mut right_cycle);
} The downside is that sometimes this means that the re-labelling of the |
How do you deal with hundreds of milions of constraints? Shouldn't this force you to have a massive trusted setup??
How are you able to have parallel witness assignments if you don't wrap the Could you elaborate a bit more on that @alexander-camuto ?? |
Hey @CPerezz good question ! The way we've been able to deal with this is by having operations "wrap" around advice columns. To illustrate this consider our dot product argument: | a0 | a1 | m | s_dot |
|-----|-----|-------|-------|
| x_i | y_i |m_{i-1}| s_dot |
| | |m_i | | where constraints are such that Lets say In this manner we can have a relatively large number of constraints by increasing the # of columns, rather than increasing the number of rows. The way we get around the region shuffling that may break this is .... we have a single region for the entire circuit and make sure to keep track of the current offset.
For this part what we do is that when putting the
|
Ohh I'm sure about that. You have dynamic circuits basically. Looks cool!! I like it!! If I'm honest, I'm a bit skeptical about marking Let me think about this and get back to you. On the meantime, feel free to send a PR! |
Resolved via #180 |
…-hk/dev-feature/transcript-chip-book Add in-circuit random oracle book chapter
Hey all.
I'm working on ezkl https://github.com/zkonduit/ezkl a zk-ml library leveraging your repos :) We've recently been able to load and create circuits for models with hundreds of millions of parameters, which generates even more constraints ! Assigning values / laying out can now take quite a while and because our circuit shapes lend themselves to parallel assignment, we were hoping to parallelize this process.
However
Region
and its innerregion
field (see below) are not thread safe as they are notSend
/Sync
.The idea here would be to make
Region
Send + Sync
.Field
is alreadySend
+Sync
so it would just be a matter of constraining theRegionLayouter
trait to beSend
andSync
as well (and any resulting changes in the rest of the codebase those constraints may induce) i.e:Presumably the inner region field of Region may need to be wrapped in aArc<Mutex<>>
orArc<RwLock<>>
sort of patternThis wrapping could be conditional on a feature flag ?Alternatively could make an entirely different thread safe Region structThe text was updated successfully, but these errors were encountered: