diff --git a/executor/src/witgen/processor.rs b/executor/src/witgen/processor.rs index 24279f096..74fe04280 100644 --- a/executor/src/witgen/processor.rs +++ b/executor/src/witgen/processor.rs @@ -4,7 +4,6 @@ use powdr_ast::analyzed::PolynomialType; use powdr_ast::analyzed::{AlgebraicExpression as Expression, AlgebraicReference, PolyID}; use powdr_number::{DegreeType, FieldElement}; -use rayon::iter::{ParallelBridge, ParallelIterator}; use crate::witgen::affine_expression::AlgebraicVariable; use crate::witgen::data_structures::mutable_state::MutableState; @@ -221,7 +220,7 @@ impl<'a, 'c, T: FieldElement, Q: QueryCallback> Processor<'a, 'c, T, Q> { } pub fn process_queries(&mut self, row_index: usize) -> Result> { - let query_processor = QueryProcessor::new( + let mut query_processor = QueryProcessor::new( self.fixed_data, self.mutable_state.query_callback(), self.size, @@ -239,33 +238,15 @@ impl<'a, 'c, T: FieldElement, Q: QueryCallback> Processor<'a, 'c, T, Q> { ); let mut updates = EvalValue::complete(vec![]); - self.parts - .prover_functions - .iter() - .enumerate() - // Run all prover functions in parallel - .par_bridge() - .filter_map(|(i, fun)| { - if !self.processed_prover_functions.has_run(row_index, i) { - query_processor - .process_prover_function(&row_pair, fun) - .map(|result| Some((result, i))) - .transpose() - } else { - // Skip already processed functions - None - } - }) - // Fail if any of the prover functions failed - .collect::, EvalError>>()? - // Combine results - .into_iter() - .for_each(|(r, i)| { + for (i, fun) in self.parts.prover_functions.iter().enumerate() { + if !self.processed_prover_functions.has_run(row_index, i) { + let r = query_processor.process_prover_function(&row_pair, fun)?; if r.is_complete() { updates.combine(r); self.processed_prover_functions.mark_as_run(row_index, i); } - }); + } + } for poly_id in &self.prover_query_witnesses { if let Some(r) = query_processor.process_query(&row_pair, poly_id) { diff --git a/executor/src/witgen/query_processor.rs b/executor/src/witgen/query_processor.rs index 7847502bd..1e0d383fe 100644 --- a/executor/src/witgen/query_processor.rs +++ b/executor/src/witgen/query_processor.rs @@ -33,9 +33,9 @@ impl<'a, 'b, T: FieldElement, QueryCallback: super::QueryCallback> } } - pub fn process_prover_function( - &self, - rows: &RowPair<'_, 'a, T>, + pub fn process_prover_function<'c>( + &'c mut self, + rows: &'c RowPair<'c, 'a, T>, fun: &'a Expression, ) -> EvalResult<'a, T> { let arguments = vec![Arc::new(Value::Integer(BigInt::from(u64::from( @@ -77,7 +77,7 @@ impl<'a, 'b, T: FieldElement, QueryCallback: super::QueryCallback> /// Panics if the column does not have a query attached. /// @returns None if the value for that column is already known. pub fn process_query( - &self, + &mut self, rows: &RowPair<'_, 'a, T>, poly_id: &PolyID, ) -> Option> { @@ -91,7 +91,7 @@ impl<'a, 'b, T: FieldElement, QueryCallback: super::QueryCallback> } fn process_witness_query( - &self, + &mut self, query: &'a Expression, poly: &'a AlgebraicReference, rows: &RowPair<'_, 'a, T>, @@ -129,7 +129,7 @@ impl<'a, 'b, T: FieldElement, QueryCallback: super::QueryCallback> } fn interpolate_query( - &self, + &mut self, query: &'a Expression, rows: &RowPair<'_, 'a, T>, ) -> Result {