From 3ded00ea2caab52f60a223a19e0e466e5d74959a Mon Sep 17 00:00:00 2001 From: Georg Wiese Date: Wed, 1 Nov 2023 10:01:53 +0000 Subject: [PATCH] Rename Processor -> BlockProcessor --- .../{processor.rs => block_processor.rs} | 18 +++++++++--------- executor/src/witgen/generator.rs | 8 ++++---- executor/src/witgen/machines/block_machine.rs | 4 ++-- executor/src/witgen/mod.rs | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) rename executor/src/witgen/{processor.rs => block_processor.rs} (96%) diff --git a/executor/src/witgen/processor.rs b/executor/src/witgen/block_processor.rs similarity index 96% rename from executor/src/witgen/processor.rs rename to executor/src/witgen/block_processor.rs index dc1143abda..bc0bcb63c8 100644 --- a/executor/src/witgen/processor.rs +++ b/executor/src/witgen/block_processor.rs @@ -44,7 +44,7 @@ impl<'a, T: FieldElement> OuterQuery<'a, T> { /// - `'a`: The duration of the entire witness generation (e.g. references to identities) /// - `'b`: The duration of this machine's call (e.g. the mutable references of the other machines) /// - `'c`: The duration of this Processor's lifetime (e.g. the reference to the identity processor) -pub struct Processor<'a, 'b, 'c, T: FieldElement, Q: QueryCallback, CalldataAvailable> { +pub struct BlockProcessor<'a, 'b, 'c, T: FieldElement, Q: QueryCallback, CalldataAvailable> { /// The global index of the first row of [Processor::data]. row_offset: u64, /// The rows that are being processed. @@ -67,7 +67,7 @@ pub struct Processor<'a, 'b, 'c, T: FieldElement, Q: QueryCallback, CalldataA } impl<'a, 'b, 'c, T: FieldElement, Q: QueryCallback> - Processor<'a, 'b, 'c, T, Q, WithoutCalldata> + BlockProcessor<'a, 'b, 'c, T, Q, WithoutCalldata> { pub fn new( row_offset: u64, @@ -101,8 +101,8 @@ impl<'a, 'b, 'c, T: FieldElement, Q: QueryCallback> pub fn with_outer_query( self, outer_query: OuterQuery<'a, T>, - ) -> Processor<'a, 'b, 'c, T, Q, WithCalldata> { - Processor { + ) -> BlockProcessor<'a, 'b, 'c, T, Q, WithCalldata> { + BlockProcessor { outer_query: Some(outer_query), _marker: PhantomData, row_offset: self.row_offset, @@ -121,7 +121,7 @@ impl<'a, 'b, 'c, T: FieldElement, Q: QueryCallback> } } -impl<'a, 'b, T: FieldElement, Q: QueryCallback> Processor<'a, 'b, '_, T, Q, WithCalldata> { +impl<'a, 'b, T: FieldElement, Q: QueryCallback> BlockProcessor<'a, 'b, '_, T, Q, WithCalldata> { /// Destroys itself, returns the data and updated left-hand side of the outer query (if available). pub fn finish(self) -> (FinalizableData<'a, T>, Left<'a, T>) { (self.data, self.outer_query.unwrap().left) @@ -129,7 +129,7 @@ impl<'a, 'b, T: FieldElement, Q: QueryCallback> Processor<'a, 'b, '_, T, Q, W } impl<'a, 'b, T: FieldElement, Q: QueryCallback, CalldataAvailable> - Processor<'a, 'b, '_, T, Q, CalldataAvailable> + BlockProcessor<'a, 'b, '_, T, Q, CalldataAvailable> { /// Evaluate all identities on all *non-wrapping* row pairs, assuming zero for unknown values. /// If any identity was unsatisfied, returns an error. @@ -338,7 +338,7 @@ mod tests { }, }; - use super::{Processor, WithoutCalldata}; + use super::{BlockProcessor, WithoutCalldata}; fn name_to_poly_id(fixed_data: &FixedData) -> BTreeMap { let mut name_to_poly_id = BTreeMap::new(); @@ -355,7 +355,7 @@ mod tests { fn do_with_processor, R>( src: &str, mut query_callback: Q, - f: impl Fn(&mut Processor, BTreeMap) -> R, + f: impl Fn(&mut BlockProcessor, BTreeMap) -> R, ) -> R { let analyzed = analyze_string(src); let (constants, degree) = generate(&analyzed); @@ -392,7 +392,7 @@ mod tests { let identities = analyzed.identities.iter().collect::>(); let witness_cols = fixed_data.witness_cols.keys().collect(); - let mut processor = Processor::new( + let mut processor = BlockProcessor::new( row_offset, data, &mut mutable_state, diff --git a/executor/src/witgen/generator.rs b/executor/src/witgen/generator.rs index fdaaa8812d..5b94a00ad2 100644 --- a/executor/src/witgen/generator.rs +++ b/executor/src/witgen/generator.rs @@ -9,10 +9,10 @@ use crate::witgen::data_structures::finalizable_data::FinalizableData; use crate::witgen::rows::CellValue; use super::affine_expression::AffineExpression; +use super::block_processor::BlockProcessor; use super::data_structures::column_map::WitnessColumnMap; use super::global_constraints::GlobalConstraints; use super::machines::Machine; -use super::processor::Processor; use super::rows::{Row, RowFactory}; use super::sequence_iterator::{DefaultSequenceIterator, ProcessingSequenceIterator}; @@ -93,10 +93,10 @@ impl<'a, T: FieldElement> Generator<'a, T> { &self, mutable_state: &mut MutableState<'a, '_, T, Q>, ) -> Row<'a, T> { - // Use `Processor` + `DefaultSequenceIterator` using a "block size" of 0. Because `Processor` + // Use `BlockProcessor` + `DefaultSequenceIterator` using a "block size" of 0. Because `BlockProcessor` // expects `data` to include the row before and after the block, this means we'll run the // solver on exactly one row pair. - // Note that using `Processor` instead of `VmProcessor` is more convenient here because + // Note that using `BlockProcessor` instead of `VmProcessor` is more convenient here because // it does not assert that the row is "complete" afterwards (i.e., that all identities // are satisfied assuming 0 for unknown values). let row_factory = RowFactory::new(self.fixed_data, self.global_range_constraints.clone()); @@ -108,7 +108,7 @@ impl<'a, T: FieldElement> Generator<'a, T> { ] .into_iter(), ); - let mut processor = Processor::new( + let mut processor = BlockProcessor::new( self.fixed_data.degree - 1, data, mutable_state, diff --git a/executor/src/witgen/machines/block_machine.rs b/executor/src/witgen/machines/block_machine.rs index bcd47c7aca..18f8c020c6 100644 --- a/executor/src/witgen/machines/block_machine.rs +++ b/executor/src/witgen/machines/block_machine.rs @@ -3,10 +3,10 @@ use std::collections::{HashMap, HashSet}; use super::{EvalResult, FixedData}; use crate::witgen::affine_expression::AffineExpression; +use crate::witgen::block_processor::{BlockProcessor, OuterQuery}; use crate::witgen::data_structures::finalizable_data::FinalizableData; use crate::witgen::global_constraints::GlobalConstraints; use crate::witgen::identity_processor::IdentityProcessor; -use crate::witgen::processor::{OuterQuery, Processor}; use crate::witgen::rows::{CellValue, RowFactory, RowPair, UnknownStrategy}; use crate::witgen::sequence_iterator::{ProcessingSequenceCache, ProcessingSequenceIterator}; use crate::witgen::util::try_to_simple_poly; @@ -373,7 +373,7 @@ impl<'a, T: FieldElement> BlockMachine<'a, T> { (0..(self.block_size + 2)) .map(|i| self.row_factory.fresh_row(i as DegreeType + row_offset)), ); - let mut processor = Processor::new( + let mut processor = BlockProcessor::new( row_offset, block, mutable_state, diff --git a/executor/src/witgen/mod.rs b/executor/src/witgen/mod.rs index 69401b6218..0d343e08c3 100644 --- a/executor/src/witgen/mod.rs +++ b/executor/src/witgen/mod.rs @@ -19,6 +19,7 @@ use self::machines::{FixedLookup, Machine}; use pil_analyzer::pil_analyzer::inline_intermediate_polynomials; mod affine_expression; +mod block_processor; mod data_structures; mod eval_result; mod expression_evaluator; @@ -27,7 +28,6 @@ mod generator; mod global_constraints; mod identity_processor; mod machines; -mod processor; mod query_processor; mod range_constraints; mod rows;