-
Notifications
You must be signed in to change notification settings - Fork 131
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
fix: check thread-safe-region
feature(post-split)
#296
Conversation
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.
Even though the note in the code says that the thread-safe
feature should be moved to the frontend, it must be kept in both front and back because in the front is needed for the assigning regions in parallel, and in the back it is needed for the assambly keyen. Is this right?
Yes, you are right. @davidnevadoc |
I want to discuss this feature. For context:
So, while I think the current PR is correct and brings back the halo2/halo2_backend/src/plonk/permutation/keygen.rs Lines 51 to 53 in d6f7020
Sort a.copies .
And with that we would have the same outcome without the need of two implementations of What do you think about this? There's an extra thing that we can look into: since now the cycles are generated in one pass (instead of being updated in-place), maybe we can find a simpler implementation for that. |
d822aff
to
670d620
Compare
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.
I'm confused. The PR says it enables the feature but the actual PR removes the feature.
If we want to actually remove it (which I don't think we should (without discussing first)), we should also remove the docs about it that we have in Readme and MDBook.
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.
There's one question that comes to my mind: should we add #[cfg(feature = "thread-safe-region")]
before sorting the copies?
Without that feature, the regions are not thread safe so the copies should always be stable; so technically the sorting is only needed when the tread-safe-region
feature is enabled. If we add the line before sorting, we'll skip sorting when it's not needed, which may reduce the overhead?
Now this only makes sense if the overhead of the sorting is significant, but I don't know how significant it is.
The approach that the PR implements has changed since it was opened. In particular, since we now hold all the copies in a vector instead of building the cycles incrementally, we don't need a stable incremental cycle generation algorithm, because we can just sort the entries in the copies. For this reason the backend doesn't need the thread safe feature, only the frontend (which is where the Region exists). So this PR is not removing any "capability". |
I think it is better to add the |
Sounds good, I think this is the safest option :) |
thread-safe-region
feature(post-split)thread-safe-region
feature(post-split)
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.
LGTM!
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.
Thanks for the explanations! LGTM!
Description
thread-safe-region
feature usage across the cratesRelated issues
Changes
thread-safe-region
feature & related code forhalo2_backend::plonk::keygen::Assembly
structthread-safe-region
-related code inMockProver
(halo2_frontend::dev)Ord, PartialOrd
forhalo2_middleware::circuit::Cell
structcompile_circuit
(halo2_frontend) process