Skip to content

Commit

Permalink
fix: metal prover compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbinth committed Feb 6, 2024
1 parent df15de8 commit 1d54c22
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
10 changes: 8 additions & 2 deletions processor/src/trace/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ impl TraceLenSummary {
}
}

/// Returns length of the main trace
/// Returns length of the main trace.
pub fn main_trace_len(&self) -> usize {
self.main_trace_len
}

/// Returns length of the range table
/// Returns length of the range checker trace.
pub fn range_trace_len(&self) -> usize {
self.range_trace_len
}
Expand All @@ -127,6 +127,12 @@ impl TraceLenSummary {
pub fn padded_trace_len(&self) -> usize {
(self.trace_len() + NUM_RAND_ROWS).next_power_of_two()
}

/// Returns the percent (0 - 100) of the steps that were added to the trace to pad it to the
/// next power of tow.
pub fn padding_percentage(&self) -> usize {
(self.padded_trace_len() - self.trace_len()) * 100 / self.padded_trace_len()
}
}

/// Contains trace lengths of all chilplets: hash, bitwise, memory and kernel ROM trace
Expand Down
5 changes: 2 additions & 3 deletions prover/src/gpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use super::{
ExecutionProver, ExecutionTrace, Felt, FieldElement, Level, ProcessorAir, PublicInputs,
WinterProofOptions,
};
use air::trace::main_trace::MainTrace;
use elsa::FrozenVec;
use ministark_gpu::{
plan::{gen_rpo_merkle_tree, GpuRpo256RowMajor},
Expand Down Expand Up @@ -63,7 +62,7 @@ where
fn new_trace_lde<E: FieldElement<BaseField = Felt>>(
&self,
trace_info: &TraceInfo,
main_trace: &MainTrace,
main_trace: &ColMatrix<Felt>,
domain: &StarkDomain<Felt>,
) -> (Self::TraceLde<E>, TracePolyTable<E>) {
MetalRpoTraceLde::new(trace_info, main_trace, domain)
Expand Down Expand Up @@ -201,7 +200,7 @@ impl<E: FieldElement<BaseField = Felt>> MetalRpoTraceLde<E> {
/// segment and the new [DefaultTraceLde].
pub fn new(
trace_info: &TraceInfo,
main_trace: &MainTrace,
main_trace: &ColMatrix<Felt>,
domain: &StarkDomain<Felt>,
) -> (Self, TracePolyTable<E>) {
// extend the main execution trace and build a Merkle tree from the extended trace
Expand Down
7 changes: 1 addition & 6 deletions prover/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,12 @@ where
let trace =
processor::execute(program, stack_inputs.clone(), host, *options.execution_options())?;
#[cfg(feature = "std")]
let padding_percentage = (trace.trace_len_summary().padded_trace_len()
- trace.trace_len_summary().trace_len())
* 100
/ trace.trace_len_summary().padded_trace_len();
#[cfg(feature = "std")]
event!(
Level::INFO,
"Generated execution trace of {} columns and {} steps ({}% padded) in {} ms",
trace.layout().main_trace_width(),
trace.trace_len_summary().padded_trace_len(),
padding_percentage,
trace.trace_len_summary().padding_percentage(),
now.elapsed().as_millis()
);

Expand Down

0 comments on commit 1d54c22

Please sign in to comment.