-
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
Poseidon with logup #712
Poseidon with logup #712
Conversation
21ff211
to
1ad23f7
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #712 +/- ##
==========================================
+ Coverage 92.80% 93.25% +0.45%
==========================================
Files 89 89
Lines 11725 11795 +70
Branches 11725 11795 +70
==========================================
+ Hits 10881 11000 +119
+ Misses 744 694 -50
- Partials 100 101 +1 ☔ View full report in Codecov by Sentry. |
68f340e
to
764aadd
Compare
1ad23f7
to
26d7f53
Compare
764aadd
to
56e7a66
Compare
26d7f53
to
cac4ec9
Compare
56e7a66
to
f7c8f7a
Compare
cac4ec9
to
c1084d8
Compare
f7c8f7a
to
37b50ef
Compare
c1084d8
to
112979a
Compare
37b50ef
to
02fa82a
Compare
112979a
to
0dd7c6d
Compare
02fa82a
to
3b5d1cd
Compare
0dd7c6d
to
a812a8f
Compare
5506349
to
cd56fad
Compare
a812a8f
to
9bae9fa
Compare
e62fdb8
to
5e4f90b
Compare
9bae9fa
to
b40bca7
Compare
5e4f90b
to
613e32c
Compare
b40bca7
to
247a5f1
Compare
613e32c
to
e21b020
Compare
247a5f1
to
05ef795
Compare
e21b020
to
216cbf5
Compare
05ef795
to
9ae92ce
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 4 of 4 files at r4.
Reviewable status: 2 of 4 files reviewed, 9 unresolved discussions (waiting on @spapinistarkware)
crates/prover/src/constraint_framework/logup.rs
line 30 at r4 (raw file):
pub prev_mask: E::EF, pub is_first: E::F, }
Please document. Specifically what is queue and BATCH_SIZE.
Code quote:
pub struct LogupAtRow<const BATCH_SIZE: usize, E: EvalAtRow> {
pub interaction: usize,
pub queue: [(E::EF, E::EF); BATCH_SIZE],
pub queue_size: usize,
pub claimed_sum: SecureField,
pub prev_mask: E::EF,
pub is_first: E::F,
}
crates/prover/src/constraint_framework/logup.rs
line 52 at r4 (raw file):
values, E::EF::zero() + lookup_elements.alpha, E::EF::zero() + lookup_elements.z,
Add From<SecureField>
to EF
?
Suggestion:
lookup_elements.alpha.into(),
lookup_elements.z.into(),
crates/prover/src/constraint_framework/logup.rs
line 57 at r4 (raw file):
} pub fn push_frac(&mut self, eval: &mut E, p: E::EF, q: E::EF) {
Suggestion:
pub fn push_frac(&mut self, eval: &mut E, numerator: E::EF, denom: E::EF) {
crates/prover/src/constraint_framework/logup.rs
line 96 at r4 (raw file):
std::array::from_fn(|_| eval.next_interaction_mask(self.interaction, [0, -1])); let cur = E::combine_ef(cumulative_mask_values.map(|[cur, _prev]| cur)); let up = E::combine_ef(cumulative_mask_values.map(|[_cur, prev]| prev));
Suggestion:
let cur = E::combine_ef(cumulative_mask_values.map(|[cur, _up]| cur));
let up = E::combine_ef(cumulative_mask_values.map(|[_cur, up]| up));
crates/prover/src/examples/poseidon/mod.rs
line 118 at r4 (raw file):
logup: LogupAtRow::new(1, SecureField::zero(), BaseField::zero()), }; counter.eval.next_interaction_mask(2, [0]);
Doesn't one of the columns have an offset -1 also? How does this work?
Code quote:
counter.eval.next_interaction_mask(2, [0]);
crates/prover/src/examples/poseidon/mod.rs
line 131 at r4 (raw file):
} fn trace_log_degree_bounds(&self) -> TreeVec<ColumnVec<u32>> {
Can you move these two implementations below to InfoEvaluator
?
crates/prover/src/examples/poseidon/mod.rs
line 255 at r4 (raw file):
struct PoseidonEval<E: EvalAtRow> { eval: E, logup: LogupAtRow<2, E>,
Does LogupAtRow have to be separate from EvalAtRow? Can it be internal?
Code quote:
LogupAtRow
crates/prover/src/examples/poseidon/mod.rs
line 308 at r4 (raw file):
// Provide state lookup. self.logup .push_lookup(&mut self.eval, -E::EF::one(), &state, self.lookup_elements);
Why is this -1 while the initial state's numerator is 1? Wouldn't the -1 be in the callers column?
Code quote:
-E::EF::one()
crates/prover/src/examples/poseidon/mod.rs
line 362 at r4 (raw file):
.iter_mut() .zip(state) .for_each(|(res, si)| res.data[vec_index] = si);
Accident?
Code quote:
si
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: 2 of 4 files reviewed, 9 unresolved discussions (waiting on @spapinistarkware)
crates/prover/src/constraint_framework/logup.rs
line 96 at r4 (raw file):
std::array::from_fn(|_| eval.next_interaction_mask(self.interaction, [0, -1])); let cur = E::combine_ef(cumulative_mask_values.map(|[cur, _prev]| cur)); let up = E::combine_ef(cumulative_mask_values.map(|[_cur, prev]| prev));
Or actually maybe lets use row_prev and col_prev?
9ae92ce
to
86eb8cb
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: 1 of 7 files reviewed, 7 unresolved discussions (waiting on @alonh5)
crates/prover/src/constraint_framework/logup.rs
line 30 at r4 (raw file):
Previously, alonh5 (Alon Haramati) wrote…
Please document. Specifically what is queue and BATCH_SIZE.
Done.
crates/prover/src/constraint_framework/logup.rs
line 57 at r4 (raw file):
} pub fn push_frac(&mut self, eval: &mut E, p: E::EF, q: E::EF) {
Done.
crates/prover/src/examples/poseidon/mod.rs
line 118 at r4 (raw file):
Previously, alonh5 (Alon Haramati) wrote…
Doesn't one of the columns have an offset -1 also? How does this work?
It's is_first
crates/prover/src/examples/poseidon/mod.rs
line 131 at r4 (raw file):
Previously, alonh5 (Alon Haramati) wrote…
Can you move these two implementations below to
InfoEvaluator
?
I don't understand. Also, note that in 2 PRs, these will be auto implemented for any framework component.
crates/prover/src/examples/poseidon/mod.rs
line 255 at r4 (raw file):
Previously, alonh5 (Alon Haramati) wrote…
Does LogupAtRow have to be separate from EvalAtRow? Can it be internal?
2 different things. EvalAtRow is a trait that we imoplemented with either point, domain, info or assert ops. LogupAtRow is a specific struct that does the constraints of logup. It also is generic over EvalAtRow, like the component constriants.
crates/prover/src/examples/poseidon/mod.rs
line 308 at r4 (raw file):
Previously, alonh5 (Alon Haramati) wrote…
Why is this -1 while the initial state's numerator is 1? Wouldn't the -1 be in the callers column?
I decided to reverse this, since the callers will be called a lot more times than the callees (which have multiplicity). So, I thought it makes sense to not have negations in the common case. Also, the multiplicity could incorporate the negatives themeselves, so in most cases, no negations at all.
crates/prover/src/examples/poseidon/mod.rs
line 362 at r4 (raw file):
Previously, alonh5 (Alon Haramati) wrote…
Accident?
I wanted to distinguish this from state, since it's just a single elements of the state (state_i)
86eb8cb
to
051d90a
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 6 files at r6, 3 of 3 files at r7, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @spapinistarkware)
crates/prover/src/constraint_framework/logup.rs
line 75 at r7 (raw file):
} // Compute sum_i pi/qi over batch, as a fraction, p/q.
Fix to match name change.
Code quote:
// Compute sum_i pi/qi over batch, as a fraction, p/q.
crates/prover/src/constraint_framework/logup.rs
line 87 at r7 (raw file):
self.queue_size = 1; // Add a constraint that p / q = diff.
Here also.
Code quote:
// Add a constraint that p / q = diff.
crates/prover/src/constraint_framework/logup.rs
line 89 at r7 (raw file):
// Add a constraint that p / q = diff. let cur_cumsum = E::combine_ef(std::array::from_fn(|_| { eval.next_interaction_mask(1, [0])[0]
Suggestion:
self.interaction
crates/prover/src/constraint_framework/logup.rs
line 107 at r7 (raw file):
std::array::from_fn(|_| eval.next_interaction_mask(self.interaction, [0, -1])); let cur_cumsum = E::combine_ef(cumsum_mask.map(|[cur_row, _prev_row]| cur_row)); let prev_row_cumsum = E::combine_ef(cumsum_mask.map(|[_cur_row, prev_row]| prev_row));
I thought row_prev could refer to the previous value in the row (left) and col_prev to the previous value in the column (up).
Alternatively you can say prev_row is the previous row value (up) and prev_col the previous columns value (left).
Now it's a mix of both and is more confusing IMO.
Code quote:
let cur_cumsum = E::combine_ef(cumsum_mask.map(|[cur_row, _prev_row]| cur_row));
let prev_row_cumsum = E::combine_ef(cumsum_mask.map(|[_cur_row, prev_row]| prev_row));
crates/prover/src/examples/poseidon/mod.rs
line 362 at r4 (raw file):
Previously, spapinistarkware (Shahar Papini) wrote…
I wanted to distinguish this from state, since it's just a single elements of the state (state_i)
So how about state_i
?
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, 5 unresolved discussions (waiting on @spapinistarkware)
051d90a
to
19c7760
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 2 of 2 files at r8, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @spapinistarkware)
crates/prover/src/constraint_framework/logup.rs
line 87 at r8 (raw file):
self.queue_size = 1; // Add a constraint that p / q = diff.
Suggestion:
num / denom = diff
19c7760
to
2150ceb
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 1 of 1 files at r9, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @spapinistarkware)
Merge activity
|
This change is