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

Add final lookup constraint. #667

Merged
merged 1 commit into from
Jul 8, 2024
Merged

Conversation

alonh5
Copy link
Contributor

@alonh5 alonh5 commented Jun 18, 2024

This change is Reviewable

@alonh5 alonh5 marked this pull request as ready for review June 19, 2024 13:20
@alonh5 alonh5 force-pushed the 06-16-add_lookup_final_boundary_constraints branch from 0949cde to 6e23bb7 Compare June 20, 2024 10:51
@alonh5 alonh5 force-pushed the 06-18-add_final_lookup_constraint branch from 01cf025 to 5840c13 Compare June 20, 2024 10:51
@alonh5 alonh5 force-pushed the 06-16-add_lookup_final_boundary_constraints branch from 6e23bb7 to 68daccc Compare June 20, 2024 11:29
@alonh5 alonh5 force-pushed the 06-18-add_final_lookup_constraint branch from 5840c13 to 2239d0c Compare June 20, 2024 11:29
@alonh5 alonh5 mentioned this pull request Jun 20, 2024
@alonh5 alonh5 force-pushed the 06-16-add_lookup_final_boundary_constraints branch from 68daccc to 2d0b7f2 Compare June 23, 2024 09:18
@alonh5 alonh5 force-pushed the 06-18-add_final_lookup_constraint branch from 2239d0c to 69f679c Compare June 23, 2024 09:18
@codecov-commenter
Copy link

codecov-commenter commented Jun 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.27%. Comparing base (5d43adf) to head (446122b).

Additional details and impacted files
@@                             Coverage Diff                              @@
##           06-16-add_lookup_final_boundary_constraints     #667   +/-   ##
============================================================================
  Coverage                                        90.27%   90.27%           
============================================================================
  Files                                               75       75           
  Lines                                            10005    10005           
  Branches                                         10005    10005           
============================================================================
  Hits                                              9032     9032           
  Misses                                             892      892           
  Partials                                            81       81           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@alonh5 alonh5 force-pushed the 06-16-add_lookup_final_boundary_constraints branch from 2d0b7f2 to d6581be Compare June 23, 2024 09:23
@alonh5 alonh5 force-pushed the 06-18-add_final_lookup_constraint branch from 69f679c to e5d2a89 Compare June 23, 2024 09:23
@alonh5 alonh5 force-pushed the 06-16-add_lookup_final_boundary_constraints branch from d6581be to 8320e79 Compare June 23, 2024 10:20
@alonh5 alonh5 force-pushed the 06-18-add_final_lookup_constraint branch from e5d2a89 to 9061e0b Compare June 23, 2024 10:20
@alonh5 alonh5 force-pushed the 06-16-add_lookup_final_boundary_constraints branch from 8320e79 to 73c3fc5 Compare June 23, 2024 10:58
@alonh5 alonh5 force-pushed the 06-18-add_final_lookup_constraint branch from 9061e0b to d9ff10b Compare June 23, 2024 10:58
@alonh5 alonh5 force-pushed the 06-16-add_lookup_final_boundary_constraints branch from 73c3fc5 to 2590d46 Compare June 23, 2024 11:03
@alonh5 alonh5 force-pushed the 06-18-add_final_lookup_constraint branch from d9ff10b to 4f1c250 Compare June 23, 2024 11:03
@alonh5 alonh5 force-pushed the 06-16-add_lookup_final_boundary_constraints branch from 2590d46 to 4a6e186 Compare June 23, 2024 13:02
@alonh5 alonh5 force-pushed the 06-18-add_final_lookup_constraint branch from 4f1c250 to 580ab28 Compare June 23, 2024 13:02
@alonh5 alonh5 force-pushed the 06-16-add_lookup_final_boundary_constraints branch from 4a6e186 to fbfc89f Compare June 23, 2024 13:20
@alonh5 alonh5 force-pushed the 06-18-add_final_lookup_constraint branch from 580ab28 to ca9eb4b Compare June 23, 2024 13:20
@alonh5 alonh5 force-pushed the 06-16-add_lookup_final_boundary_constraints branch from fbfc89f to 3578d66 Compare June 23, 2024 13:35
@alonh5 alonh5 force-pushed the 06-18-add_final_lookup_constraint branch from ca9eb4b to a7f7fdf Compare June 23, 2024 13:35
@alonh5 alonh5 force-pushed the 06-16-add_lookup_final_boundary_constraints branch from 2d1a9de to 513b230 Compare June 27, 2024 10:56
@alonh5 alonh5 force-pushed the 06-18-add_final_lookup_constraint branch from 9f3520e to dc1db6d Compare June 27, 2024 10:56
@alonh5 alonh5 force-pushed the 06-16-add_lookup_final_boundary_constraints branch from 513b230 to d1d82e6 Compare June 27, 2024 11:42
@alonh5 alonh5 force-pushed the 06-18-add_final_lookup_constraint branch from dc1db6d to e3340b7 Compare June 27, 2024 11:42
@alonh5 alonh5 force-pushed the 06-16-add_lookup_final_boundary_constraints branch from d1d82e6 to 670cfcc Compare June 30, 2024 08:32
@alonh5 alonh5 force-pushed the 06-18-add_final_lookup_constraint branch from e3340b7 to 7ac9063 Compare June 30, 2024 08:32
@alonh5 alonh5 force-pushed the 06-16-add_lookup_final_boundary_constraints branch from 670cfcc to 7615aa4 Compare July 1, 2024 10:47
@alonh5 alonh5 force-pushed the 06-18-add_final_lookup_constraint branch from 7ac9063 to 8405dea Compare July 1, 2024 10:48
@alonh5 alonh5 force-pushed the 06-16-add_lookup_final_boundary_constraints branch from 7615aa4 to 4a0804a Compare July 1, 2024 11:09
@alonh5 alonh5 force-pushed the 06-18-add_final_lookup_constraint branch from 8405dea to d76e1de Compare July 1, 2024 11:09
Copy link
Collaborator

@shaharsamocha7 shaharsamocha7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed all commit messages.
Reviewable status: 0 of 2 files reviewed, 3 unresolved discussions (waiting on @alonh5 and @spapinistarkware)


crates/prover/src/examples/wide_fibonacci/constraint_eval.rs line 199 at r2 (raw file):

                        &[
                            lookup_values[LOOKUP_VALUE_N_MINUS_2_ID],
                            lookup_values[LOOKUP_VALUE_N_MINUS_1_ID],

Those should be fetched at the beginning of the function instead of reading it for each numerator calculation

Code quote:

                            lookup_values[LOOKUP_VALUE_N_MINUS_2_ID],
                            lookup_values[LOOKUP_VALUE_N_MINUS_1_ID],

crates/prover/src/examples/wide_fibonacci/constraint_eval.rs line 211 at r2 (raw file):

                        alpha,
                        z,
                    ));

This can be a shared utility function for both the step constraint and the boundary constraint

Code quote:

                * ((value
                    * shifted_secure_combination(
                        &[
                            lookup_values[LOOKUP_VALUE_N_MINUS_2_ID],
                            lookup_values[LOOKUP_VALUE_N_MINUS_1_ID],
                        ],
                        alpha,
                        z,
                    ))
                    - shifted_secure_combination(
                        &[
                            lookup_values[LOOKUP_VALUE_0_ID],
                            lookup_values[LOOKUP_VALUE_1_ID],
                        ],
                        alpha,
                        z,
                    ));

crates/prover/src/examples/wide_fibonacci/constraint_eval.rs line 327 at r2 (raw file):

            zero_domain,
            &mut accum,
        );

It would be more efficient to evaluate the numerators together
and the denominators together (i.e. in the same for loop)

That way the memory access pattern is more efficient

Code quote:

        self.evaluate_trace_boundary_constraints(
            trace_evals,
            trace_eval_domain,
            zero_domain,
            &mut accum,
            lookup_values,
        );
        self.evaluate_lookup_step_constraints(
            trace_evals,
            trace_eval_domain,
            zero_domain,
            &mut accum,
            interaction_elements,
        );
        self.evaluate_lookup_boundary_constraints(
            trace_evals,
            trace_eval_domain,
            zero_domain,
            &mut accum,
            interaction_elements,
            lookup_values,
        );
        self.evaluate_trace_step_constraints(
            trace_evals,
            trace_eval_domain,
            zero_domain,
            &mut accum,
        );

@alonh5 alonh5 force-pushed the 06-16-add_lookup_final_boundary_constraints branch from 4a0804a to e7e8777 Compare July 2, 2024 08:59
@alonh5 alonh5 force-pushed the 06-18-add_final_lookup_constraint branch from d76e1de to 0abcc54 Compare July 2, 2024 12:44
Copy link
Contributor Author

@alonh5 alonh5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 2 files reviewed, 3 unresolved discussions (waiting on @shaharsamocha7 and @spapinistarkware)


crates/prover/src/examples/wide_fibonacci/constraint_eval.rs line 199 at r2 (raw file):

Previously, shaharsamocha7 wrote…

Those should be fetched at the beginning of the function instead of reading it for each numerator calculation

Done.


crates/prover/src/examples/wide_fibonacci/constraint_eval.rs line 211 at r2 (raw file):

Previously, shaharsamocha7 wrote…

This can be a shared utility function for both the step constraint and the boundary constraint

I tried it and it didn't really save lines of code, so I'll leave it as is for now.


crates/prover/src/examples/wide_fibonacci/constraint_eval.rs line 327 at r2 (raw file):

Previously, shaharsamocha7 wrote…

It would be more efficient to evaluate the numerators together
and the denominators together (i.e. in the same for loop)

That way the memory access pattern is more efficient

Added a TODO.

@alonh5 alonh5 force-pushed the 06-16-add_lookup_final_boundary_constraints branch from e7e8777 to f9a19f5 Compare July 2, 2024 12:52
@alonh5 alonh5 force-pushed the 06-18-add_final_lookup_constraint branch from 0abcc54 to 0eca520 Compare July 2, 2024 12:52
Copy link
Collaborator

@shaharsamocha7 shaharsamocha7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: 1 of 2 files reviewed, all discussions resolved (waiting on @spapinistarkware)

Copy link
Contributor

@spapinistarkware spapinistarkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 2 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @alonh5)

Copy link
Collaborator

@shaharsamocha7 shaharsamocha7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @alonh5)

@alonh5 alonh5 force-pushed the 06-16-add_lookup_final_boundary_constraints branch from f9a19f5 to 8b8d2b9 Compare July 8, 2024 07:31
@alonh5 alonh5 force-pushed the 06-18-add_final_lookup_constraint branch from 0eca520 to 7d781c7 Compare July 8, 2024 07:31
@alonh5 alonh5 force-pushed the 06-16-add_lookup_final_boundary_constraints branch from 8b8d2b9 to 5d43adf Compare July 8, 2024 08:06
@alonh5 alonh5 force-pushed the 06-18-add_final_lookup_constraint branch from 7d781c7 to 446122b Compare July 8, 2024 08:07
Copy link
Contributor Author

alonh5 commented Jul 8, 2024

Merge activity

  • Jul 8, 4:33 AM EDT: @alonh5 started a stack merge that includes this pull request via Graphite.
  • Jul 8, 4:35 AM EDT: Graphite rebased this pull request as part of a merge.
  • Jul 8, 4:38 AM EDT: @alonh5 merged this pull request with Graphite.

@alonh5 alonh5 changed the base branch from 06-16-add_lookup_final_boundary_constraints to dev July 8, 2024 08:33
@alonh5 alonh5 force-pushed the 06-18-add_final_lookup_constraint branch from 446122b to 68aae20 Compare July 8, 2024 08:34
@alonh5 alonh5 merged commit 6761408 into dev Jul 8, 2024
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants