Skip to content

Commit

Permalink
patch
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-camuto committed Jan 6, 2024
1 parent 955bec6 commit 5345966
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ pub(crate) fn calibrate(
.load_graph_from_file_exclusively(&chunk)
.map_err(|e| format!("failed to load circuit inputs: {}", e))?;

circuit
let forward_res = circuit
.calibrate(&data, max_logrows, lookup_safety_margin)
.map_err(|e| format!("failed to calibrate: {}", e))?;

Expand Down
3 changes: 2 additions & 1 deletion src/graph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use crate::circuit::modules::ModulePlanner;
use crate::circuit::table::{Table, RESERVED_BLINDING_ROWS_PAD};
use crate::circuit::{CheckMode, InputType};
use crate::fieldutils::felt_to_f64;
use crate::pfsys::PrettyElements;
use crate::tensor::{Tensor, ValTensor};
use crate::RunArgs;
use halo2_proofs::{
Expand Down Expand Up @@ -1124,7 +1125,7 @@ impl GraphCircuit {
lookup_safety_margin: i128,
) -> Result<GraphWitness, Box<dyn std::error::Error>> {
let res = self.forward(&mut input.to_vec(), None, None)?;
self.calc_min_logrows(&res, max_logrows)?;
self.calc_min_logrows(&res, max_logrows, lookup_safety_margin)?;
Ok(res)
}

Expand Down
11 changes: 8 additions & 3 deletions src/graph/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -775,15 +775,20 @@ impl Model {
for (i, _) in model.clone().outputs.iter().enumerate() {
model.set_output_fact(i, InferenceFact::default())?;
}
// Note: do not optimize the model, as the layout will depend on underlying hardware
let mut model = model.into_typed()?.into_decluttered()?;

let mut symbol_values = SymbolValues::default();
for (symbol, value) in run_args.variables.iter() {
let symbol = model.symbol_table.sym(symbol);
symbol_values = symbol_values.with(&symbol, *value as i64);
info!("set {} to {}", symbol, value);
}
model = model.concretize_dims(&symbol_values)?;

// Note: do not optimize the model, as the layout will depend on underlying hardware
let model = model
.into_typed()?
.into_decluttered()?
.concretize_dims(&symbol_values)?;

Ok((model, symbol_values))
}

Expand Down

0 comments on commit 5345966

Please sign in to comment.