-
Notifications
You must be signed in to change notification settings - Fork 79
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 wide fib lookup step constraint. #646
Conversation
f1cf98b
to
95c0db7
Compare
887ea74
to
90c09b3
Compare
95c0db7
to
32c879a
Compare
90c09b3
to
22a4892
Compare
32c879a
to
77a2633
Compare
22a4892
to
87a8ce5
Compare
77a2633
to
ec3289d
Compare
87a8ce5
to
e2a05b2
Compare
ec3289d
to
9bc5a9c
Compare
e2a05b2
to
a258294
Compare
a258294
to
6d3ec5c
Compare
6b45a40
to
80031ba
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #646 +/- ##
==========================================
+ Coverage 89.95% 90.03% +0.07%
==========================================
Files 75 75
Lines 9657 9730 +73
Branches 9657 9730 +73
==========================================
+ Hits 8687 8760 +73
Misses 889 889
Partials 81 81 ☔ View full report in Codecov by Sentry. |
d615ec9
to
6c72919
Compare
f631952
to
c6d22b6
Compare
6c72919
to
fe6bf5b
Compare
c6d22b6
to
59f6ca2
Compare
fe6bf5b
to
4d92879
Compare
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.
Reviewable status: 0 of 7 files reviewed, 1 unresolved discussion (waiting on @shaharsamocha7 and @spapinistarkware)
crates/prover/src/core/utils.rs
line 76 at r4 (raw file):
Previously, spapinistarkware (Shahar Papini) wrote…
- Do we need these in the long term? If not, add a TODO to remove. If yes, they are currently not efficient, and seem to only do things in the CPU, and not in a backend. Also, should the oeprate on Vec, and no on Evaluation or something?
Done.
59f6ca2
to
a9b0e6f
Compare
4d92879
to
481218e
Compare
a9b0e6f
to
eb83ad6
Compare
481218e
to
4dfe8ff
Compare
4dfe8ff
to
3495fde
Compare
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.
Reviewed 3 of 7 files at r2, 2 of 3 files at r5, 2 of 2 files at r6, all commit messages.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @alonh5 and @spapinistarkware)
crates/prover/src/core/utils.rs
line 71 at r6 (raw file):
prev_index = (prev_index + half_size - 1) % half_size; } else { prev_index = ((prev_index + 1) % half_size) + half_size;
Does it work for constraint degree > 2?
I think that you need the extension degree as well
Suggestion:
prev_index = ((prev_index + extension_degree / 2) % half_size) + half_size;
crates/prover/src/examples/wide_fibonacci/component.rs
line 159 at r6 (raw file):
.map(|eval| { let coset = CanonicCoset::new(trace[0].domain.log_size()); CpuCircleEvaluation::new_canonical_ordered(coset, eval)
What is this change? Adding bit reverse?
Code quote:
let coset = CanonicCoset::new(trace[0].domain.log_size());
CpuCircleEvaluation::new_canonical_ordered(coset, eval)
crates/prover/src/examples/wide_fibonacci/constraint_eval.rs
line 137 at r6 (raw file):
} fn evaluate_lookup_step_constraints(
Let's add a TODO to try to simplify this function (moving parts to utility functions)
not for this pr
Code quote:
fn evaluate_lookup_step_constraints(
crates/prover/src/examples/wide_fibonacci/mod.rs
line 153 at r6 (raw file):
.into_iter() .map(|eval| CpuCircleEvaluation::new_canonical_ordered(trace_domain, eval)) .collect_vec();
This applies bit reverse on the entire trace.
It would be better to just bit reverse the lookup column?
Code quote:
let trace = trace_values
.into_iter()
.map(|eval| CpuCircleEvaluation::new_canonical_ordered(trace_domain, eval))
.collect_vec();
crates/prover/src/examples/wide_fibonacci/trace_gen.rs
line 50 at r6 (raw file):
circle_domain_order_to_coset_order(column) }) .collect_vec();
Add a TODO, the better thing to do is to bit reverse only the expressions that relevant for the lookup
instead of bit reversing the entire trace which can be expensive
Code quote:
let natural_ordered_trace = input_trace
.iter_mut()
.map(|column| {
bit_reverse(column);
circle_domain_order_to_coset_order(column)
})
.collect_vec();
3495fde
to
ae26ec4
Compare
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.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @shaharsamocha7 and @spapinistarkware)
crates/prover/src/core/utils.rs
line 71 at r6 (raw file):
Previously, shaharsamocha7 wrote…
Does it work for constraint degree > 2?
I think that you need the extension degree as well
Yes I wrote it in the documentation, but i generalized it now.
crates/prover/src/examples/wide_fibonacci/component.rs
line 159 at r6 (raw file):
Previously, shaharsamocha7 wrote…
What is this change? Adding bit reverse?
It reorders it in circle domain order and also bit reverses. This is needed for constraints between rows to be consistent.
crates/prover/src/examples/wide_fibonacci/constraint_eval.rs
line 137 at r6 (raw file):
Previously, shaharsamocha7 wrote…
Let's add a TODO to try to simplify this function (moving parts to utility functions)
not for this pr
Done.
crates/prover/src/examples/wide_fibonacci/mod.rs
line 153 at r6 (raw file):
Previously, shaharsamocha7 wrote…
This applies bit reverse on the entire trace.
It would be better to just bit reverse the lookup column?
I need to turn the trace order into circle domain and bit reverse for the same reason above.
crates/prover/src/examples/wide_fibonacci/trace_gen.rs
line 50 at r6 (raw file):
Previously, shaharsamocha7 wrote…
Add a TODO, the better thing to do is to bit reverse only the expressions that relevant for the lookup
instead of bit reversing the entire trace which can be expensive
There's already a TODO to remove the cloning of the whole trace for this calculation. Only the relevant columns should be passed here after that change so this will stay the same. I edited to TODO to be clearer.
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.
Reviewed 3 of 3 files at r7, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @alonh5 and @spapinistarkware)
crates/prover/src/examples/wide_fibonacci/mod.rs
line 153 at r6 (raw file):
Previously, alonh5 (Alon Haramati) wrote…
I need to turn the trace order into circle domain and bit reverse for the same reason above.
ok but we can also apply the todo here in order to reverse only the columns that are relevant for the lookup, right?
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.
Reviewed 3 of 7 files at r2, 1 of 3 files at r5, 1 of 2 files at r6, 3 of 3 files at r7, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @alonh5)
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.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @shaharsamocha7)
crates/prover/src/examples/wide_fibonacci/mod.rs
line 153 at r6 (raw file):
Previously, shaharsamocha7 wrote…
ok but we can also apply the todo here in order to reverse only the columns that are relevant for the lookup, right?
First of all this is a test just making sure you noticed. Secondly in the actual trace I don't think we can only change the order of some of the columns because that would mess up the constraints in the same row.
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.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @alonh5)
This change is