-
Notifications
You must be signed in to change notification settings - Fork 615
feat: share the commitment key between instances to reduce mem #8154
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,11 +44,14 @@ template <class Flavor> class ProverInstance_ { | |
| std::vector<FF> gate_challenges; | ||
| FF target_sum; | ||
|
|
||
| ProverInstance_(Circuit& circuit, TraceStructure trace_structure = TraceStructure::NONE) | ||
| ProverInstance_(Circuit& circuit, | ||
| TraceStructure trace_structure = TraceStructure::NONE, | ||
| std::shared_ptr<typename Flavor::CommitmentKey> commitment_key = nullptr) | ||
| { | ||
| BB_OP_COUNT_TIME_NAME("ProverInstance(Circuit&)"); | ||
| circuit.add_gates_to_ensure_all_polys_are_non_zero(); | ||
| circuit.finalize_circuit(); | ||
| info("finalized gate count: ", circuit.num_gates); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should probably be deleted but I wish it was here so people would see what their gate counts are all the time.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are living with clientivc printing data, I'm sure we could live with this for now |
||
|
|
||
| // Set flag indicating whether the polynomials will be constructed with fixed block sizes for each gate type | ||
| const bool is_structured = (trace_structure != TraceStructure::NONE); | ||
|
|
@@ -70,7 +73,7 @@ template <class Flavor> class ProverInstance_ { | |
| } | ||
| { | ||
| ZoneScopedN("constructing proving key"); | ||
| proving_key = ProvingKey(dyadic_circuit_size, circuit.public_inputs.size()); | ||
| proving_key = ProvingKey(dyadic_circuit_size, circuit.public_inputs.size(), commitment_key); | ||
| } | ||
|
|
||
| // Construct and add to proving key the wire, selector and copy constraint polynomials | ||
|
|
||
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.
had to make these changes to ultra and ultra_keccak because otherwise the call to the constructor was just calling the Base one directly. That meant the polynomials did not get initialized to circuit_size length leading to a segfault.
I briefly tried getting rid of the Base constructors (from the
using Base::Base;line), but other parts of the code complained.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.
actually, maybe adding default constructors to ProvingKey of each flavor would fix this and allow us to delete
using Base::Base. I find it weird that we would want to directly call the base class constructorThere 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.
Seems ok. Calling the parent class constructor from a child class constructor seems like a really natural pattern to me
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.
oh, this comment wasn't referring to that pattern. It was referring to the using Base::Base line which brings in the base class constructors to the derived class, which was causing me to hit a segfault rather than a compile error.
Like I was just calling the base class constructor when I thought it would call the derived class constructor (because I forgot to change the derived constructor to take in the commitment_key).