-
Notifications
You must be signed in to change notification settings - Fork 307
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
feat: swap polys to facilitate dynamic trace overflow #9976
Changes from 25 commits
560373c
981074c
090e720
2eded0b
d06c1e8
b4cb9de
a7231ef
0cf3757
f7e8fc7
35c15a0
515fe8b
e07eb4d
7d4ba63
ba7bfd5
559bb2e
916fc98
b23cd91
864ee3a
bfb2a70
2494af1
531c0d1
0b582eb
d781974
0b714d2
c9e6af0
90277ab
0891578
9f05f0b
c13923b
48052d0
681c1e6
1f79b46
e7d8499
1f4df0f
cd92b66
067cbb0
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 |
---|---|---|
|
@@ -18,8 +18,9 @@ struct ExecutionTraceUsageTracker { | |
using MegaTraceActiveRanges = MegaTraceBlockData<Range>; | ||
using MegaTraceFixedBlockSizes = MegaExecutionTraceBlocks; | ||
|
||
TraceStructure max_sizes; // max utilization of each block | ||
MegaTraceFixedBlockSizes fixed_sizes; // fixed size of each block prescribed by structuring | ||
TraceStructure max_sizes; // max utilization of each block | ||
// Fixed size of each block prescribed by strucuring and the highest size of an overflow block encountered | ||
MegaTraceFixedBlockSizes fixed_sizes; | ||
// Store active ranges based on the most current accumulator and those based on all but the most recently | ||
// accumulated circuit. The former is needed for the combiner calculation and the latter for the perturbator. | ||
std::vector<Range> active_ranges; | ||
|
@@ -48,7 +49,7 @@ struct ExecutionTraceUsageTracker { | |
} | ||
|
||
// Update the max block utilization and active trace ranges based on the data from a provided circuit | ||
void update(const Builder& circuit) | ||
void update(Builder& circuit) | ||
{ | ||
// Update the max utilization of each gate block | ||
for (auto [block, max_size] : zip_view(circuit.blocks.get(), max_sizes.get())) { | ||
|
@@ -72,8 +73,11 @@ struct ExecutionTraceUsageTracker { | |
} | ||
|
||
// The active ranges must also include the rows where the actual databus and lookup table data are stored. | ||
// (Note: lookup tables are constructed at the end of the trace; databus data is constructed at the start). | ||
size_t dyadic_circuit_size = fixed_sizes.get_structured_dyadic_size(); | ||
// (Note: lookup tables are constructed at the end of the trace; databus data is constructed at the start) so we | ||
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. This comment will break if the ordering in the trace structure ever changes--there's little chance that the person changing the structure remembers this comment exists, if they ever knew. 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. a way to make this more robust is to update the active ranges as we are constructing the DeciderProvingKey so if the position of the rows changes it is obvious that the tracker's active ranges also need to be updated, will add an issue. |
||
// need to determine the dyadic size for this. We call the size function on the current circuit which will have | ||
// the same fixed block sizes but might also have an overflow block potentially influencing the dyadic circuit | ||
// size. | ||
size_t dyadic_circuit_size = circuit.blocks.get_structured_dyadic_size(); | ||
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. This was the major issue: The fixed sizes are set using the trace settings so the overflow block was 0 and hence the dyadic_circuit_size was not computed correctly. This was leading us to not take into account the lookup contributions at the end of the current circuit trace in PG. Modifying the fixed_sizes to include the overflow block is not easily possible in the current design and it makes sense to compute the |
||
|
||
// TODO(https://github.com/AztecProtocol/barretenberg/issues/1152): should be able to use simply Range{ 0, | ||
// max_databus_size } but this breaks for certain choices of num_threads. | ||
|
@@ -111,6 +115,13 @@ struct ExecutionTraceUsageTracker { | |
"lookup", | ||
"overflow" }; | ||
|
||
std::vector<std::string> active_ranges_labels = [this] { | ||
maramihali marked this conversation as resolved.
Show resolved
Hide resolved
|
||
std::vector<std::string> result = block_labels; | ||
result.push_back("databus table data"); | ||
result.push_back("lookup table data"); | ||
return result; | ||
}(); | ||
|
||
void print() | ||
{ | ||
info("Minimum required block sizes for structured trace: "); | ||
|
@@ -123,7 +134,17 @@ struct ExecutionTraceUsageTracker { | |
void print_active_ranges() | ||
{ | ||
info("Active regions of accumulator: "); | ||
for (auto [label, range] : zip_view(block_labels, active_ranges)) { | ||
for (auto [label, range] : zip_view(active_ranges_labels, active_ranges)) { | ||
std::cout << std::left << std::setw(20) << (label + ":") << "(" << range.first << ", " << range.second | ||
<< ")" << std::endl; | ||
} | ||
info(""); | ||
} | ||
|
||
void print_previous_active_ranges() | ||
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. when i was printing the active ranges it wasn't reflecting everything due to the lookup and databus caveat so I think it made sense to refine the labels |
||
{ | ||
info("Active regions of previous accumulator: "); | ||
for (auto [label, range] : zip_view(active_ranges_labels, previous_active_ranges)) { | ||
std::cout << std::left << std::setw(20) << (label + ":") << "(" << range.first << ", " << range.second | ||
<< ")" << std::endl; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#include "relation_checker.hpp" | ||
|
||
// Hack to make the module compile. |
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.
If small tests structure changes behind the scenes, this test could silently break (i.e., it may continue to pass but cease to test what it's supposed to). Will you please define a new trace structure in this file for use in these two tests only?