From d793c30c1508c1dabdc52f6c1b5b728f8c71c50c Mon Sep 17 00:00:00 2001 From: Georg Wiese Date: Fri, 10 Jan 2025 00:07:01 -0300 Subject: [PATCH] Undo adding link --- executor/src/witgen/block_processor.rs | 6 +-- executor/src/witgen/machines/block_machine.rs | 5 +-- .../src/witgen/machines/dynamic_machine.rs | 2 +- .../witgen/machines/second_stage_machine.rs | 2 +- executor/src/witgen/sequence_iterator.rs | 43 +++++-------------- 5 files changed, 16 insertions(+), 42 deletions(-) diff --git a/executor/src/witgen/block_processor.rs b/executor/src/witgen/block_processor.rs index c0f7e9f49..529441fa7 100644 --- a/executor/src/witgen/block_processor.rs +++ b/executor/src/witgen/block_processor.rs @@ -78,7 +78,7 @@ impl<'a, 'c, T: FieldElement, Q: QueryCallback> BlockProcessor<'a, 'c, T, Q> while let Some(SequenceStep { row_delta, action }) = sequence_iterator.next() { let row_index = (1 + row_delta) as usize; let progress = match action { - Action::PolynomialIdentity(identity_index) => { + Action::InternalIdentity(identity_index) => { if is_identity_complete[row_index][identity_index] { // The identity has been completed already, there is no point in processing it again. false @@ -92,8 +92,6 @@ impl<'a, 'c, T: FieldElement, Q: QueryCallback> BlockProcessor<'a, 'c, T, Q> res.progress } } - // TODO(link) - Action::Link(_) => todo!(), Action::OuterQuery => { let (progress, new_outer_assignments) = self.processor.process_outer_query(row_index)?; @@ -218,7 +216,7 @@ mod tests { unused_query_callback(), |mut processor, poly_ids, degree, num_identities| { let mut sequence_iterator = ProcessingSequenceIterator::Default( - DefaultSequenceIterator::new(degree as usize - 2, num_identities, 0, None), + DefaultSequenceIterator::new(degree as usize - 2, num_identities, None), ); let outer_updates = processor.solve(&mut sequence_iterator).unwrap(); assert!(outer_updates.is_complete()); diff --git a/executor/src/witgen/machines/block_machine.rs b/executor/src/witgen/machines/block_machine.rs index 56fdf952c..0caae0a25 100644 --- a/executor/src/witgen/machines/block_machine.rs +++ b/executor/src/witgen/machines/block_machine.rs @@ -133,8 +133,6 @@ impl<'a, T: FieldElement> BlockMachine<'a, T> { block_size, latch_row, parts.identities.len(), - // TODO(link) - 0, ), function_cache: FunctionCache::new( fixed_data, @@ -266,8 +264,7 @@ impl<'a, T: FieldElement> Machine<'a, T> for BlockMachine<'a, T> { // Run BlockProcessor (to potentially propagate selector values) let mut processor = BlockProcessor::from_processor(processor, &self.parts.identities); let mut sequence_iterator = ProcessingSequenceIterator::Default( - // TODO(link) - DefaultSequenceIterator::new(self.block_size, self.parts.identities.len(), 0, None), + DefaultSequenceIterator::new(self.block_size, self.parts.identities.len(), None), ); processor.solve(&mut sequence_iterator).unwrap(); let mut dummy_block = processor.finish().block; diff --git a/executor/src/witgen/machines/dynamic_machine.rs b/executor/src/witgen/machines/dynamic_machine.rs index 2a8c50875..1c5b338ea 100644 --- a/executor/src/witgen/machines/dynamic_machine.rs +++ b/executor/src/witgen/machines/dynamic_machine.rs @@ -198,7 +198,7 @@ impl<'a, T: FieldElement> DynamicMachine<'a, T> { self.degree, ); let mut sequence_iterator = ProcessingSequenceIterator::Default( - DefaultSequenceIterator::new(0, next_parts.identities.len(), 0, None), + DefaultSequenceIterator::new(0, next_parts.identities.len(), None), ); processor.solve(&mut sequence_iterator).unwrap(); diff --git a/executor/src/witgen/machines/second_stage_machine.rs b/executor/src/witgen/machines/second_stage_machine.rs index eeeb14856..e4c19e1bc 100644 --- a/executor/src/witgen/machines/second_stage_machine.rs +++ b/executor/src/witgen/machines/second_stage_machine.rs @@ -150,7 +150,7 @@ impl<'a, T: FieldElement> SecondStageMachine<'a, T> { self.degree, ); let mut sequence_iterator = ProcessingSequenceIterator::Default( - DefaultSequenceIterator::new(0, next_parts.identities.len(), 0, None), + DefaultSequenceIterator::new(0, next_parts.identities.len(), None), ); processor.solve(&mut sequence_iterator).unwrap(); diff --git a/executor/src/witgen/sequence_iterator.rs b/executor/src/witgen/sequence_iterator.rs index 0e33d6389..8132a2245 100644 --- a/executor/src/witgen/sequence_iterator.rs +++ b/executor/src/witgen/sequence_iterator.rs @@ -15,7 +15,6 @@ pub struct SequenceStep { /// In each row, iterates over all identities until no further progress is made. pub struct DefaultSequenceIterator { identities_count: usize, - link_count: usize, row_deltas: Vec, outer_query_row: Option, @@ -33,16 +32,10 @@ pub struct DefaultSequenceIterator { } impl DefaultSequenceIterator { - pub fn new( - block_size: usize, - identities_count: usize, - link_count: usize, - outer_query_row: Option, - ) -> Self { + pub fn new(block_size: usize, identities_count: usize, outer_query_row: Option) -> Self { let max_row = block_size as i64 - 1; DefaultSequenceIterator { identities_count, - link_count, row_deltas: (-1..=max_row) .chain((-1..max_row).rev()) .chain(0..=max_row) @@ -77,10 +70,10 @@ impl DefaultSequenceIterator { let last_action_index = if is_on_row_with_outer_query { // In the last row, we want to do one more action, processing the outer query. - (self.identities_count + self.link_count) as i32 + 1 + self.identities_count as i32 + 1 } else { // Otherwise, we want to process all identities + 1 action processing the prover queries - (self.identities_count + self.link_count) as i32 + self.identities_count as i32 }; self.cur_action_index < last_action_index @@ -124,9 +117,7 @@ impl DefaultSequenceIterator { let row_delta = self.row_deltas[self.cur_row_delta_index]; let is_on_row_with_outer_query = self.outer_query_row == Some(row_delta); - let cur_action_index = if is_on_row_with_outer_query - || self.cur_action_index < self.identities_count as i32 + 1 - { + let cur_action_index = if is_on_row_with_outer_query { self.cur_action_index as usize } else { // Skip the outer query action @@ -135,26 +126,22 @@ impl DefaultSequenceIterator { SequenceStep { row_delta: self.row_deltas[self.cur_row_delta_index], - action: if cur_action_index < self.identities_count { - Action::PolynomialIdentity(cur_action_index) - } else if cur_action_index == self.identities_count { - Action::ProverQueries - } else if cur_action_index == self.identities_count + 1 { + action: if cur_action_index == 0 { Action::OuterQuery + } else if cur_action_index == 1 { + Action::ProverQueries } else { - Action::Link(cur_action_index - self.identities_count - 2) + Action::InternalIdentity(cur_action_index - 2) }, } } } -#[allow(dead_code)] #[derive(Clone, Copy, Debug)] pub enum Action { - PolynomialIdentity(usize), - ProverQueries, OuterQuery, - Link(usize), + ProverQueries, + InternalIdentity(usize), } #[derive(PartialOrd, Ord, PartialEq, Eq, Debug)] @@ -251,22 +238,15 @@ pub struct ProcessingSequenceCache { block_size: usize, outer_query_row: usize, identities_count: usize, - link_count: usize, cache: BTreeMap, } impl ProcessingSequenceCache { - pub fn new( - block_size: usize, - outer_query_row: usize, - identities_count: usize, - link_count: usize, - ) -> Self { + pub fn new(block_size: usize, outer_query_row: usize, identities_count: usize) -> Self { ProcessingSequenceCache { block_size, outer_query_row, identities_count, - link_count, cache: Default::default(), } } @@ -304,7 +284,6 @@ impl ProcessingSequenceCache { DefaultSequenceIterator::new( self.block_size, self.identities_count, - self.link_count, Some(self.outer_query_row as i64), ) }