Skip to content

Commit

Permalink
tmp: many verbose log
Browse files Browse the repository at this point in the history
  • Loading branch information
lispc committed Oct 5, 2024
1 parent 4c14c55 commit 442104c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
11 changes: 10 additions & 1 deletion crates/core/machine/src/cpu/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ impl<F: PrimeField32> MachineAir<F> for CpuChip {
input: &ExecutionRecord,
_: &mut ExecutionRecord,
) -> RowMajorMatrix<F> {
use sp1_stark::MachineRecord;
tracing::error!("zz generate_trace shape {:?}, {:?}", input.shape, input.stats());
let mut values = zeroed_f_vec(input.cpu_events.len() * NUM_CPU_COLS);

let chunk_size = std::cmp::max(input.cpu_events.len() / num_cpus::get(), 1);
Expand Down Expand Up @@ -549,7 +551,14 @@ impl CpuChip {
let n_real_rows = values.len() / NUM_CPU_COLS;
let padded_nb_rows = if let Some(shape) = shape {
let name = MachineAir::<F>::name(self);
1 << shape.inner.get(&name).expect(&format!("fail to get shape of {}", name))
let log_degree = shape.inner.get(&name);
match log_degree {
Some(log_degree) => 1 << log_degree,
None => {
tracing::error!("shape {:?}", shape);
panic!("fail to get shape of {}", name);
}
}
} else if n_real_rows < 16 {
16
} else {
Expand Down
5 changes: 5 additions & 0 deletions crates/core/machine/src/utils/prove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,9 @@ where
// Fix the shape of the records.
if let Some(shape_config) = shape_config {
for record in records.iter_mut() {
tracing::error!("zz fix shape1 from {:?}", record.shape);
shape_config.fix_shape(record).unwrap();
tracing::error!("zz fix shape1 to {:?}", record.shape);
}
}
// Generate the traces.
Expand Down Expand Up @@ -507,7 +509,9 @@ where
// Fix the shape of the records.
if let Some(shape_config) = shape_config {
for record in records.iter_mut() {
tracing::error!("zz fix shape2 from {:?} ", record.shape);
shape_config.fix_shape(record).unwrap();
tracing::error!("zz fix shape2 from {:?}", record.shape);
}
}

Expand Down Expand Up @@ -657,6 +661,7 @@ where
#[cfg(feature = "debug")]
{
let all_records = all_records_rx.iter().flatten().collect::<Vec<_>>();
tracing::error!("zz all records len {}", all_records.len());
let mut challenger = prover.machine().config().challenger();
prover.machine().debug_constraints(&pk.to_host(), all_records, &mut challenger);
}
Expand Down
3 changes: 2 additions & 1 deletion crates/stark/src/lookup/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use p3_matrix::Matrix;
use super::InteractionKind;
use crate::{
air::{InteractionScope, MachineAir},
MachineChip, StarkGenericConfig, StarkMachine, StarkProvingKey, Val,
MachineChip, MachineRecord, StarkGenericConfig, StarkMachine, StarkProvingKey, Val,
};

/// The data for an interaction.
Expand Down Expand Up @@ -69,6 +69,7 @@ pub fn debug_interactions<SC: StarkGenericConfig, A: MachineAir<Val<SC>>>(
let mut key_to_vec_data = BTreeMap::new();
let mut key_to_count = BTreeMap::new();

tracing::error!("zz debug_interactions {} shape {:?}", chip.name(), record.stats());
let trace = chip.generate_trace(record, &mut A::Record::default());
let mut pre_traces = pkey.traces.clone();
let mut preprocessed_trace =
Expand Down

0 comments on commit 442104c

Please sign in to comment.