-
Notifications
You must be signed in to change notification settings - Fork 599
feat: Free instances and circuits earlier to reduce max memory usage #8118
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 all commits
69e4b23
4d6a49d
692e1f1
52b6787
9a37c32
bdf7601
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 |
|---|---|---|
|
|
@@ -37,5 +37,5 @@ TEST_F(MockKernelTest, PinFoldingKernelSizes) | |
| ivc.accumulate(circuit_2); | ||
| ivc.accumulate(kernel_circuit); | ||
|
|
||
| EXPECT_EQ(ivc.prover_instance->proving_key.log_circuit_size, 17); | ||
| EXPECT_EQ(ivc.fold_output.accumulator->proving_key.log_circuit_size, 17); | ||
|
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. core change here is that we don't store the prover_instance anymore, but we can just get the size from the accumulator instead. |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,6 +62,7 @@ template <size_t NUM_WIRES, bool generalized> struct PermutationMapping { | |
| */ | ||
| PermutationMapping(size_t circuit_size) | ||
| { | ||
| ZoneScopedN("PermutationMapping constructor"); | ||
| for (uint8_t col_idx = 0; col_idx < NUM_WIRES; ++col_idx) { | ||
| sigmas[col_idx].reserve(circuit_size); | ||
| if constexpr (generalized) { | ||
|
|
@@ -109,13 +110,13 @@ PermutationMapping<Flavor::NUM_WIRES, generalized> compute_permutation_mapping( | |
|
|
||
| // Go through each cycle | ||
| size_t cycle_index = 0; | ||
| for (auto& copy_cycle : wire_copy_cycles) { | ||
| for (const auto& copy_cycle : wire_copy_cycles) { | ||
|
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. some changes Facundo suggested (not sure how impactful they are since the compiler is pretty smart usually) |
||
| for (size_t node_idx = 0; node_idx < copy_cycle.size(); ++node_idx) { | ||
| // Get the indices of the current node and next node in the cycle | ||
| cycle_node current_cycle_node = copy_cycle[node_idx]; | ||
| const cycle_node& current_cycle_node = copy_cycle[node_idx]; | ||
| // If current node is the last one in the cycle, then the next one is the first one | ||
| size_t next_cycle_node_index = (node_idx == copy_cycle.size() - 1 ? 0 : node_idx + 1); | ||
| cycle_node next_cycle_node = copy_cycle[next_cycle_node_index]; | ||
| const cycle_node& next_cycle_node = copy_cycle[next_cycle_node_index]; | ||
| const auto current_row = current_cycle_node.gate_index; | ||
| const auto next_row = next_cycle_node.gate_index; | ||
|
|
||
|
|
@@ -383,10 +384,16 @@ void compute_permutation_argument_polynomials(const typename Flavor::CircuitBuil | |
| } | ||
| } else if constexpr (IsUltraFlavor<Flavor>) { // any UltraHonk flavor | ||
| // Compute Honk-style sigma and ID polynomials from the corresponding mappings | ||
| compute_honk_style_permutation_lagrange_polynomials_from_mapping<Flavor>( | ||
| key->polynomials.get_sigmas(), mapping.sigmas, key); | ||
| compute_honk_style_permutation_lagrange_polynomials_from_mapping<Flavor>( | ||
| key->polynomials.get_ids(), mapping.ids, key); | ||
| { | ||
| ZoneScopedN("compute_honk_style_permutation_lagrange_polynomials_from_mapping"); | ||
| compute_honk_style_permutation_lagrange_polynomials_from_mapping<Flavor>( | ||
| key->polynomials.get_sigmas(), mapping.sigmas, key); | ||
| } | ||
| { | ||
| ZoneScopedN("compute_honk_style_permutation_lagrange_polynomials_from_mapping"); | ||
| compute_honk_style_permutation_lagrange_polynomials_from_mapping<Flavor>( | ||
| key->polynomials.get_ids(), mapping.ids, key); | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
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.
main deletion here to free up memory