Skip to content

Commit

Permalink
Merge branch 'main' into feat/offline-memory
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanpwang committed Jan 4, 2025
2 parents 3faaaf0 + 3735d97 commit bf90510
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions benchmarks/benches/regex_execute.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use criterion::{criterion_group, criterion_main, Criterion};
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use openvm_benchmarks::utils::build_bench_program;
use openvm_circuit::arch::{instructions::exe::VmExe, VmExecutor};
use openvm_keccak256_circuit::Keccak256Rv32Config;
Expand Down Expand Up @@ -33,7 +33,7 @@ fn benchmark_function(c: &mut Criterion) {
group.bench_function("execute", |b| {
b.iter(|| {
executor
.execute(exe.clone(), StdIn::from_bytes(&fe_bytes))
.execute(exe.clone(), black_box(StdIn::from_bytes(&fe_bytes)))
.unwrap();
})
});
Expand Down
2 changes: 2 additions & 0 deletions benchmarks/examples/regex_execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ fn main() {

let data = include_str!("../programs/regex/regex_email.txt");

let timer = std::time::Instant::now();
executor
.execute(exe.clone(), StdIn::from_bytes(data.as_bytes()))
.unwrap();
println!("execute_time: {:?}", timer.elapsed());
}
10 changes: 5 additions & 5 deletions crates/prof/src/aggregate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,12 @@ impl AggregateMetrics {
}
if !group_name.contains("keygen") {
// Proving time in keygen group is dummy and not part of total.
total_proof_time.val += stats.sum.val;
*total_proof_time.diff.as_mut().unwrap() += stats.sum.diff.unwrap_or(0.0);
total_par_proof_time.val += stats.max.val;
*total_par_proof_time.diff.as_mut().unwrap() += stats.max.diff.unwrap_or(0.0);
total_proof_time.val += sum.val;
*total_proof_time.diff.as_mut().unwrap() += sum.diff.unwrap_or(0.0);
total_par_proof_time.val += max.val;
*total_par_proof_time.diff.as_mut().unwrap() += max.diff.unwrap_or(0.0);
}
rows.push((group_name, stats.sum, stats.max));
rows.push((group_name, sum, max));
}
writeln!(
writer,
Expand Down
4 changes: 3 additions & 1 deletion crates/vm/src/metrics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub mod cycle_tracker;

#[derive(Clone, Debug, Default)]
pub struct VmMetrics {
pub cycle_count: usize,
pub chip_heights: Vec<(String, usize)>,
/// Maps (dsl_ir, opcode) to number of times opcode was executed
pub counts: BTreeMap<(Option<String>, String), usize>,
Expand Down Expand Up @@ -42,7 +43,7 @@ where
opcode: VmOpcode,
dsl_instr: Option<String>,
) {
counter!("total_cycles").increment(1u64);
self.metrics.cycle_count += 1;

if self.system_config().profiling {
let executor = self.chip_complex.inventory.get_executor(opcode).unwrap();
Expand All @@ -60,6 +61,7 @@ where
}

pub fn finalize_metrics(&mut self) {
counter!("total_cycles").absolute(self.metrics.cycle_count as u64);
counter!("main_cells_used")
.absolute(self.current_trace_cells().into_iter().sum::<usize>() as u64);

Expand Down

0 comments on commit bf90510

Please sign in to comment.