-
Notifications
You must be signed in to change notification settings - Fork 193
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
use number of partitions for buffer allocation instead of partition size #339
Conversation
Hi @TheMenko! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
) -> (Self, TracePolyTable<E>) { | ||
// extend the main execution trace and build a commitment to the extended trace | ||
let (main_segment_lde, main_segment_vector_com, main_segment_polys) = | ||
build_trace_commitment::<E, E::BaseField, H, V>( | ||
main_trace, | ||
domain, | ||
partition_option.partition_size::<E::BaseField>(main_trace.num_cols()), |
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.
Compilation error. Needs to be partition_options
.
let partition_size = partition_options.partition_size::<E>(self.num_cols()); | ||
let num_partitions = partition_options.num_partitons(); |
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.
Question: should this be the "specified" number or partitions or the "implied" number of partitions? For example, let's say we have 7 columns in the degree 2 extension field and the specified number of partitions is 4 with min partition size being 8.
With these parameters, the implied number of partitions is actually 2 (because partition size would be 4 columns and there are 7 columns total). So, would we want to use 2 or 4 for the number of partitions?
@@ -383,7 +383,11 @@ impl PartitionOptions { | |||
self.min_partition_size as usize, | |||
); | |||
|
|||
base_elements_per_partition.div(E::EXTENSION_DEGREE) | |||
base_elements_per_partition.div_ceil(E::EXTENSION_DEGREE) |
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.
We may need to make this a bit more sophisticated because I think it will produce rather suboptimal results in some situations. For example:
num_columns = 7
E::EXTENSION_DEGREE = 3
self.num_partitions = 4
self.min_partition_size = 8
If I did my math correctly, with this approach, we'd get partition size of 3 columns which would imply 9 base field columns per partition. This would require 2 permutations of the hash function in each partition.
The previous approach would have actually resulted in a better outcome here (i.e., partition size 2, so so the 4 partitions would have 2, 2, 2, 1 columns). But this result would have been technically incorrect because we'd have 6 base field elements per partition and this would be smaller than min_partition_size
.
Maybe instead of min_partition_size
we should be specifying the number of base elements that can be absorbed per permutation and then we can adjust this algorithm to output more optimal results.
EDIT: Please disregard the comment below. I've created a new PR that takes @irakliyk feedback into account: #340 Hi @irakliyk, thank you for your initial review. I'm going to pick up this work from @TheMenko. Here is some context that might be helpful:
I'm going to rework this PR, but let's first agree what a desirable solution looks like. To make sure we are on the same page, below are my calculations for 7 "logical" columns and extension degree 2 and 3. Extension Degree = 2
yields:
Extension Degree = 3
yields:
I understand this is not what you want. We have two options here:
Next StepsLet me know which option makes more sense to you.
EDIT: Please disregard this comment. I've created a new PR that takes @irakliyk feedback into account: #340 |
Superseded by #340. |
Buffer allocation was too big when using partition size. Only "num partition" values would be filled, leaving everything else as 0.
This Changes the size to number of partitions.