-
Notifications
You must be signed in to change notification settings - Fork 598
feat: check op queue wires are zero past minicircuit in Translator #16858
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,8 +27,9 @@ template <typename FF_> class TranslatorOpcodeConstraintRelationImpl { | |
| * @brief Returns true if the contribution from all subrelations for the provided inputs is identically zero | ||
| * | ||
| */ | ||
| template <typename AllEntities> inline static bool skip(const AllEntities& in) | ||
| template <typename AllEntities> static bool skip(const AllEntities& in) | ||
| { | ||
| // All contributions are zero outside the minicircuit or at odd indices not masked | ||
| return (in.lagrange_even_in_minicircuit + in.lagrange_mini_masking).is_zero(); | ||
| } | ||
| /** | ||
|
|
@@ -79,9 +80,13 @@ template <typename FF_> class TranslatorAccumulatorTransferRelationImpl { | |
| * slower. | ||
| * | ||
| */ | ||
| template <typename AllEntities> inline static bool skip(const AllEntities& in) | ||
| template <typename AllEntities> static bool skip(const AllEntities& in) | ||
| { | ||
| return (in.lagrange_odd_in_minicircuit + in.lagrange_last_in_minicircuit + in.lagrange_result_row).is_zero(); | ||
| // All contributions are zero outside the minicircuit or at even indices within the minicircuite excluding | ||
| // masked areas (except from the last and result row in minicircuit) | ||
| return (in.lagrange_odd_in_minicircuit + in.lagrange_last_in_minicircuit + in.lagrange_result_row + | ||
| in.lagrange_mini_masking) | ||
| .is_zero(); | ||
| } | ||
| /** | ||
| * @brief Relation enforcing non-arithmetic transitions of accumulator (value that is tracking the batched | ||
|
|
@@ -110,7 +115,7 @@ template <typename FF_> class TranslatorZeroConstraintsRelationImpl { | |
| // 1 + polynomial degree of this relation | ||
| static constexpr size_t RELATION_LENGTH = 4; // degree((some lagrange)(A)) = 2 | ||
|
|
||
| static constexpr std::array<size_t, 64> SUBRELATION_PARTIAL_LENGTHS{ | ||
| static constexpr std::array<size_t, 68> SUBRELATION_PARTIAL_LENGTHS{ | ||
| 4, // p_x_low_limbs_range_constraint_0 is zero outside of the minicircuit | ||
| 4, // p_x_low_limbs_range_constraint_1 is zero outside of the minicircuit | ||
| 4, // p_x_low_limbs_range_constraint_2 is zero outside of the minicircuit | ||
|
|
@@ -175,18 +180,25 @@ template <typename FF_> class TranslatorZeroConstraintsRelationImpl { | |
| 4, // accumulator_high_limbs_range_constraint_tail is zero outside of the minicircuit | ||
| 4, // quotient_low_limbs_range_constraint_tail is zero outside of the minicircuit | ||
| 4, // quotient_high_limbs_range_constraint_tail is zero outside of the minicircuit | ||
| 4, // op is zero outside of the minicircuit | ||
| 4, // x_lo_y_hi is zero outside of the minicircuit | ||
| 4, // x_hi_z_1 is zero outside of the minicircuit | ||
| 4, // y_lo_z_2 is zero outside of the minicircuit | ||
|
|
||
| }; | ||
|
|
||
| /** | ||
| * @brief Might return true if the contribution from all subrelations for the provided inputs is identically zero | ||
| * @brief Returns true if the contribution from all subrelations for the provided inputs is identically zero | ||
| * | ||
| * | ||
| */ | ||
| template <typename AllEntities> inline static bool skip(const AllEntities& in) | ||
| template <typename AllEntities> static bool skip(const AllEntities& in) | ||
| { | ||
| // All contributions are identically zero if outside the minicircuit and masked area or when we have a | ||
| // no-op (i.e. op is zero at an even index) | ||
| static constexpr auto minus_one = -FF(1); | ||
| return (in.lagrange_even_in_minicircuit + in.lagrange_last_in_minicircuit + minus_one).is_zero(); | ||
| return (in.lagrange_even_in_minicircuit + in.op + minus_one).is_zero() || | ||
|
Contributor
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. I guess this is ok given that 1 is not a valid value for
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. Yes, op can be 0,3,4,8 |
||
| (in.lagrange_odd_in_minicircuit + in.lagrange_even_in_minicircuit + in.lagrange_mini_masking).is_zero(); | ||
| } | ||
| /** | ||
| * @brief Relation enforcing all the range-constraint polynomials to be zero after the minicircuit | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
is this an unrelated fix?
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.
Also, I'm surprised that we want to skip only when NOT masking.. is that intentional?