Skip to content

Commit

Permalink
Log JIT statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
georgwiese committed Dec 20, 2024
1 parent a097ce2 commit ed2c178
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion executor/src/witgen/machines/block_machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ pub struct BlockMachine<'a, T: FieldElement> {
function_cache: FunctionCache<'a, T>,
name: String,
multiplicity_counter: MultiplicityCounter,
/// Counts the number of blocks created using the JIT.
block_count_jit: usize,
/// Counts the number of blocks created using the runtime solver.
block_count_runtime: usize,
}

impl<'a, T: FieldElement> BlockMachine<'a, T> {
Expand Down Expand Up @@ -143,6 +147,8 @@ impl<'a, T: FieldElement> BlockMachine<'a, T> {
latch_row,
layout,
),
block_count_jit: 0,
block_count_runtime: 0,
})
}
}
Expand Down Expand Up @@ -208,6 +214,13 @@ impl<'a, T: FieldElement> Machine<'a, T> for BlockMachine<'a, T> {
.map(|(id, values)| (self.fixed_data.column_name(&id).to_string(), values))
.collect();
}
} else {
let total_block_count = self.block_count_jit + self.block_count_runtime;
log::debug!(
"{}: {} / {total_block_count} blocks computed via JIT.",
self.name,
self.block_count_jit
);
}
self.degree = compute_size_and_log(
&self.name,
Expand Down Expand Up @@ -389,7 +402,10 @@ impl<'a, T: FieldElement> BlockMachine<'a, T> {
.compile_cached(identity_id, &known_inputs)
.is_some()
{
return self.process_lookup_via_jit(mutable_state, identity_id, outer_query);
let updates = self.process_lookup_via_jit(mutable_state, identity_id, outer_query)?;
assert!(updates.is_complete());
self.block_count_jit += 1;
return Ok(updates);
}

// TODO this assumes we are always using the same lookup for this machine.
Expand Down Expand Up @@ -417,6 +433,9 @@ impl<'a, T: FieldElement> BlockMachine<'a, T> {

match process_result {
ProcessResult::Success(updated_data, updates) => {
assert!(updates.is_complete());
self.block_count_runtime += 1;

log::trace!(
"End processing block machine '{}' (successfully)",
self.name()
Expand Down

0 comments on commit ed2c178

Please sign in to comment.