Skip to content

Commit bd6d995

Browse files
committed
Review comments.
1 parent 2c52c3a commit bd6d995

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

executor/src/witgen/jit/processor.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -337,12 +337,13 @@ impl<'a, T: FieldElement> Processor<'a, T> {
337337
// that are inside the block.
338338
let unknown_variables = self
339339
.unsolved_polynomial_identities_in_block(witgen)
340-
.flat_map(|(id, row_offset)| {
341-
let Identity::Polynomial(PolynomialIdentity { expression, .. }) = id else {
342-
unreachable!()
343-
};
340+
.flat_map(|(expression, row_offset)| {
344341
unknown_relevant_variables(expression, witgen, row_offset).filter(|var| match var {
345342
Variable::WitnessCell(cell) | Variable::IntermediateCell(cell) => {
343+
// We only want to guess cells in the block. This does not work
344+
// for irregularly-shaped blocks. If we knew the extent of each column,
345+
// we could use the respective check here, but that is currently only
346+
// determined after witgen solving.
346347
cell.row_offset >= 0 && cell.row_offset < self.block_size as i32
347348
}
348349
Variable::FixedCell(_) => unreachable!(),
@@ -463,29 +464,29 @@ impl<'a, T: FieldElement> Processor<'a, T> {
463464
}
464465
}
465466

466-
/// Returns all pairs of polynomial identity and row where the identity is not solved
467-
/// in `self.block_size` contiguous rows. A polynomial identity is considered solved if
468-
/// it evaluates to a known value.
467+
/// Returns all pairs of polynomial identity (represented by its algebraic expression)
468+
/// and row where the identity is not solved in `self.block_size` contiguous rows.
469+
/// A polynomial identity is considered solved if it evaluates to a known value.
469470
/// If a polynomial identity is solved for `self.block_size` contiguous rows, it is not
470471
/// returned, not even on the rows where it is not solved.
471472
fn unsolved_polynomial_identities_in_block<'b, FixedEval: FixedEvaluator<T>>(
472473
&'b self,
473474
witgen: &'b WitgenInference<'a, T, FixedEval>,
474-
) -> impl Iterator<Item = (&'a Identity<T>, i32)> + 'b {
475+
) -> impl Iterator<Item = (&'a AlgebraicExpression<T>, i32)> + 'b {
475476
// Group all identity-row-pairs by their identities.
476477
self.identities
477478
.iter()
478479
.filter_map(|(id, row_offset)| {
479480
if let Identity::Polynomial(PolynomialIdentity { expression, .. }) = id {
480481
// Group by identity id.
481-
Some(((id.id(), id), (expression, *row_offset)))
482+
Some((id.id(), (expression, *row_offset)))
482483
} else {
483484
None
484485
}
485486
})
486487
.into_group_map()
487-
.into_iter()
488-
.flat_map(move |((_, &identity), pairs)| {
488+
.into_values()
489+
.flat_map(move |pairs| {
489490
// For each identity, check if it is fully solved
490491
// for at least "self.blocks_size" rows.
491492
let is_solved = pairs
@@ -512,7 +513,6 @@ impl<'a, T: FieldElement> Processor<'a, T> {
512513
pairs
513514
}
514515
.into_iter()
515-
.map(move |(_, row_offset)| (identity, row_offset))
516516
})
517517
}
518518

0 commit comments

Comments
 (0)