Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lightsing committed Aug 19, 2024
1 parent af11a43 commit d57b5c1
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions integration/tests/unit_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,10 @@ fn estimate_circuit_rows() {
let repeated = read_env_var("PROF_REPEAT", 20);

let (_, block_trace) = load_chunk_for_test();
let witness_block = block_traces_to_witness_block(block_trace).unwrap();

let mut block_traces = (0..repeated)
.map(|_| block_trace.clone())
.collect::<Vec<_>>();

log::info!("estimating used rows");

Expand All @@ -143,9 +146,11 @@ fn estimate_circuit_rows() {
let now = std::time::Instant::now();

for _ in 0..repeated {
let witness_block = std::hint::black_box(&witness_block);
let row_usage = <prover::zkevm::circuit::SuperCircuit as TargetCircuit>::Inner::min_num_rows_block_subcircuits(&witness_block);
std::mem::forget(std::hint::black_box(row_usage)); // avoid optimization
let block_trace = std::hint::black_box(&mut block_traces).pop().unwrap();
let witness_block = block_traces_to_witness_block(std::hint::black_box(block_trace)).unwrap();
let row_usage = <prover::zkevm::circuit::SuperCircuit as TargetCircuit>::Inner::min_num_rows_block_subcircuits(std::hint::black_box(&witness_block));
std::mem::forget(std::hint::black_box(witness_block));
std::mem::forget(std::hint::black_box(row_usage));
}

let ccc_elapsed = now.elapsed();
Expand All @@ -156,16 +161,17 @@ fn estimate_circuit_rows() {
report.flamegraph(file).unwrap();
};

log::info!(
"ccc_elapsed: {:.2}ms",
ccc_elapsed.as_millis() as f64 / repeated as f64
);

let witness_block = block_traces_to_witness_block(block_trace).unwrap();
let row_usage = <prover::zkevm::circuit::SuperCircuit as TargetCircuit>::Inner::min_num_rows_block_subcircuits(&witness_block);
let r = row_usage
.iter()
.max_by_key(|x| x.row_num_real)
.unwrap()
.clone();
log::info!("final rows: {} {}", r.row_num_real, r.name);

log::info!(
"ccc_elapsed: {:.2}ms",
ccc_elapsed.as_millis() as f64 / repeated as f64
);
}

0 comments on commit d57b5c1

Please sign in to comment.