Skip to content

Commit

Permalink
Handle memory running out of rows
Browse files Browse the repository at this point in the history
  • Loading branch information
georgwiese committed Aug 13, 2024
1 parent ec305d7 commit 4826ee4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions executor/src/witgen/machines/double_sorted_witness_machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ use std::iter::once;
use itertools::Itertools;

use super::Machine;
use crate::constant_evaluator::MIN_DEGREE_LOG;
use crate::constant_evaluator::{MAX_DEGREE_LOG, MIN_DEGREE_LOG};
use crate::witgen::rows::RowPair;
use crate::witgen::util::try_to_simple_poly;
use crate::witgen::{EvalResult, FixedData, MutableState, QueryCallback};
use crate::witgen::{EvalError, EvalResult, FixedData, MutableState, QueryCallback};
use crate::witgen::{EvalValue, IncompleteCause};
use crate::Identity;
use powdr_number::{DegreeType, FieldElement};
Expand Down Expand Up @@ -272,6 +272,7 @@ impl<'a, T: FieldElement> Machine<'a, T> for DoubleSortedWitnesses<'a, T> {

if self.fixed.is_variable_size(&self.witness_cols) {
let current_size = addr.len();
assert!(current_size <= 1 << *MAX_DEGREE_LOG);
let new_size = current_size.next_power_of_two() as DegreeType;
let new_size = new_size.max(1 << MIN_DEGREE_LOG);
log::info!(
Expand Down Expand Up @@ -477,6 +478,10 @@ impl<'a, T: FieldElement> DoubleSortedWitnesses<'a, T> {
assignments = assignments.report_side_effect();
}

if self.trace.len() >= (self.degree as usize) {
return Err(EvalError::RowsExhausted(self.name.clone()));
}

Ok(assignments)
}
}

0 comments on commit 4826ee4

Please sign in to comment.