-
Notifications
You must be signed in to change notification settings - Fork 178
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(avm): bounded mle implementation #8668
base: master
Are you sure you want to change the base?
Conversation
@@ -295,6 +295,7 @@ global AVM_VERIFICATION_KEY_LENGTH_IN_FIELDS: u32 = 2 + 16 * 4; | |||
// To determine latest value, hover `COMPUTED_AVM_PROOF_LENGTH_IN_FIELDS` | |||
// in barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp | |||
global AVM_PROOF_LENGTH_IN_FIELDS: u32 = 3817; | |||
global AVM_PUBLIC_COLUMN_MAX_SIZE_LOG = 8; |
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.
Ahhhh this LOG is from Logarithm, right? I was confused for a while thinking about (unencrypted) logs. Maybe use LOG2 or LOGARITHM?
const size_t n = evaluation_points.size(); | ||
ASSERT(dim <= n); | ||
|
||
std::span<const Fr, std::dynamic_extent> truncated_points = evaluation_points.first(dim); |
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.
Do you need to be explicit about dynamic extent? From https://en.cppreference.com/w/cpp/container/span it looks like it's the default, that'd mean you could do std::span<const Fr> truncated_points = evaluation_points.first(dim);
Also I wonder, do you need this function?
Cant you use the existing partial_evaluate_mle
or evaluate_mle
and create a span in the caller doing exactly std::span<const Fr> truncated_points = evaluation_points.first(dim);
and passing that?
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.
Sort of along the lines of what @fcarreiro is saying, I wonder if this should just become the default behavior of evaluate_mle. Instead of explicitly providing a dim
the function could just compute something like dim = msb(poly.start_offset() + size()) + 1
then perform the logic you've laid out here. This would in theory lead to even better efficiency unless your polys always have dim = AVM_PUBLIC_COLUMN_MAX_SIZE_LOG
. In this case your tests could compare two equivalent polys, one of which takes advantage of Adams new structured poly and one of which doesn't.
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. Made a suggestion to simply make this the default behavior of evaluate_mle
with an auto computed dim
const size_t n = evaluation_points.size(); | ||
ASSERT(dim <= n); | ||
|
||
std::span<const Fr, std::dynamic_extent> truncated_points = evaluation_points.first(dim); |
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.
Sort of along the lines of what @fcarreiro is saying, I wonder if this should just become the default behavior of evaluate_mle. Instead of explicitly providing a dim
the function could just compute something like dim = msb(poly.start_offset() + size()) + 1
then perform the logic you've laid out here. This would in theory lead to even better efficiency unless your polys always have dim = AVM_PUBLIC_COLUMN_MAX_SIZE_LOG
. In this case your tests could compare two equivalent polys, one of which takes advantage of Adams new structured poly and one of which doesn't.
Resolves #8651