Skip to content
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

U8Air Extended #115

Draft
wants to merge 6 commits into
base: develop
Choose a base branch
from
Draft

U8Air Extended #115

wants to merge 6 commits into from

Conversation

hecmas
Copy link
Contributor

@hecmas hecmas commented Nov 22, 2024

A new air has been added:

airtemplate U8AirExtended(const int N = 2**16) {
    // The same as U8Air, but with the cartisian product of U8 with itself to allow for lookups from two to two

    if (N != 2**16) {
        error(`The number of rows N should be 2**16 to use the predefined range U8xU8, got N=${N} instead`);
    }

    col witness mul;

    col fixed U8_A = [0..BYTE]...;
    col fixed U8_B = [0:P2_8..BYTE:P2_8];
    lookup_proves(DEFAULT_OPIDS[2], [U8_A, U8_B], mul, PIOP_NAME_RANGE_CHECK);
}

that allows to optimize multiple range checks to the range $[0,2^8-1]$ by a factor of two.

  • Used for the case where the the range is of the form $[a,b]$, with $a \geq 0$ and $b \leq 2^8-1$, except for the range $[0,2^8-1]$.
  • Used to divide the number of assumes to the exact range $[0,2^8-1]$ by a factor of two, since two range checks to the range $[0,2^8-1]$ can be compressed to a single range check to the (cartesian product) range $[0,2^8-1] \times [0,2^8-1]$.
  • Do the second one for the generic case!!!! $[0,2^N-1]$ as long as the cartesian product is not too large. We can also do it for the cartesian product of the same range three times or more as long as it is not too large.
  • We whould do it with a new api like range_check_double(), range_check_triple...
  • Fix witness computation issue where the std needs to group columns into pairs and keep this grouping along all the std_range_check wintess computation.
Type #RangeChecks #Cols #Const #Evals
Old 1 11 3 8
Old 2 16 4 11
Old 4 23 4 16
Old 8 37 6 26
Old 16 65 10 46
New 1 11 3 8
New 2 13 3 10
New 4 20 3 15
New 8 31 4 24
New 16 53 6 42

@hecmas hecmas requested a review from zkronos73 November 22, 2024 18:01
@hecmas hecmas mentioned this pull request Nov 25, 2024
16 tasks
@hecmas hecmas marked this pull request as ready for review November 26, 2024 07:48
@cla-bot cla-bot bot added the cla-signed label Nov 27, 2024
@hecmas hecmas marked this pull request as draft November 27, 2024 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant