Skip to content

Commit

Permalink
Rename Processor -> BlockProcessor
Browse files Browse the repository at this point in the history
  • Loading branch information
georgwiese committed Nov 1, 2023
1 parent 88c578a commit 3ded00e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>, CalldataAvailable> {
pub struct BlockProcessor<'a, 'b, 'c, T: FieldElement, Q: QueryCallback<T>, CalldataAvailable> {
/// The global index of the first row of [Processor::data].
row_offset: u64,
/// The rows that are being processed.
Expand All @@ -67,7 +67,7 @@ pub struct Processor<'a, 'b, 'c, T: FieldElement, Q: QueryCallback<T>, CalldataA
}

impl<'a, 'b, 'c, T: FieldElement, Q: QueryCallback<T>>
Processor<'a, 'b, 'c, T, Q, WithoutCalldata>
BlockProcessor<'a, 'b, 'c, T, Q, WithoutCalldata>
{
pub fn new(
row_offset: u64,
Expand Down Expand Up @@ -101,8 +101,8 @@ impl<'a, 'b, 'c, T: FieldElement, Q: QueryCallback<T>>
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,
Expand All @@ -121,15 +121,15 @@ impl<'a, 'b, 'c, T: FieldElement, Q: QueryCallback<T>>
}
}

impl<'a, 'b, T: FieldElement, Q: QueryCallback<T>> Processor<'a, 'b, '_, T, Q, WithCalldata> {
impl<'a, 'b, T: FieldElement, Q: QueryCallback<T>> 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)
}
}

impl<'a, 'b, T: FieldElement, Q: QueryCallback<T>, 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.
Expand Down Expand Up @@ -338,7 +338,7 @@ mod tests {
},
};

use super::{Processor, WithoutCalldata};
use super::{BlockProcessor, WithoutCalldata};

fn name_to_poly_id<T: FieldElement>(fixed_data: &FixedData<T>) -> BTreeMap<String, PolyID> {
let mut name_to_poly_id = BTreeMap::new();
Expand All @@ -355,7 +355,7 @@ mod tests {
fn do_with_processor<T: FieldElement, Q: QueryCallback<T>, R>(
src: &str,
mut query_callback: Q,
f: impl Fn(&mut Processor<T, Q, WithoutCalldata>, BTreeMap<String, PolyID>) -> R,
f: impl Fn(&mut BlockProcessor<T, Q, WithoutCalldata>, BTreeMap<String, PolyID>) -> R,
) -> R {
let analyzed = analyze_string(src);
let (constants, degree) = generate(&analyzed);
Expand Down Expand Up @@ -392,7 +392,7 @@ mod tests {
let identities = analyzed.identities.iter().collect::<Vec<_>>();
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,
Expand Down
8 changes: 4 additions & 4 deletions executor/src/witgen/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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());
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions executor/src/witgen/machines/block_machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion executor/src/witgen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -27,7 +28,6 @@ mod generator;
mod global_constraints;
mod identity_processor;
mod machines;
mod processor;
mod query_processor;
mod range_constraints;
mod rows;
Expand Down

0 comments on commit 3ded00e

Please sign in to comment.