Skip to content

Commit

Permalink
Merge pull request #766 from powdr-labs/more_context_logging
Browse files Browse the repository at this point in the history
More context for logging.
  • Loading branch information
Leo authored Nov 15, 2023
2 parents cf7cae1 + 29e3f1c commit 78ad276
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 11 deletions.
2 changes: 1 addition & 1 deletion executor/src/witgen/rows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ impl<T: FieldElement> Row<'_, T> {
/// Builds a string representing the current row
pub fn render(&self, title: &str, include_unknown: bool, cols: &HashSet<PolyID>) -> String {
format!(
"{}:\n{}",
"{}:\n{}\n---------------------",
title,
self.render_values(include_unknown, Some(cols))
)
Expand Down
38 changes: 28 additions & 10 deletions executor/src/witgen/vm_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,10 @@ impl<'a, T: FieldElement> VmProcessor<'a, T> {
row_index: DegreeType,
mutable_state: &mut MutableState<'a, '_, T, Q>,
) -> Constraints<&'a AlgebraicReference, T> {
log::trace!("Row: {}", row_index + self.row_offset);
log::trace!(
"===== Starting to process row: {}",
row_index + self.row_offset
);

log::trace!(" Going over all identities until no more progress is made");
// First, go over identities that don't reference the next row,
Expand Down Expand Up @@ -319,7 +322,10 @@ impl<'a, T: FieldElement> VmProcessor<'a, T> {
log::trace!(
"{}",
self.row(row_index).render(
&format!("===== Row {}", row_index as DegreeType + self.row_offset),
&format!(
"===== Summary for row {}",
row_index as DegreeType + self.row_offset
),
true,
&self.witnesses
)
Expand Down Expand Up @@ -575,13 +581,19 @@ impl<'a, T: FieldElement> VmProcessor<'a, T> {
log::debug!("Some identities where not satisfiable after the following values were uniquely determined (known nonzero first, then zero, unknown omitted):");
log::debug!(
"{}",
self.row(row_index)
.render("Current Row", false, &self.witnesses)
self.row(row_index).render(
&format!("Current row ({row_index})"),
false,
&self.witnesses
)
);
log::debug!(
"{}",
self.row(row_index + 1)
.render("Next Row", false, &self.witnesses)
self.row(row_index + 1).render(
&format!("Next row ({})", row_index + 1),
false,
&self.witnesses
)
);
log::debug!("Set RUST_LOG=trace to understand why these values were chosen.");
log::debug!(
Expand All @@ -607,13 +619,19 @@ impl<'a, T: FieldElement> VmProcessor<'a, T> {
log::debug!("Some columns could not be determined, but setting them to zero does not satisfy the constraints. This typically means that the system is underconstrained!");
log::debug!(
"{}",
self.row(row_index)
.render("Current Row", true, &self.witnesses)
self.row(row_index).render(
&format!("Current row ({row_index})"),
true,
&self.witnesses
)
);
log::debug!(
"{}",
self.row(row_index)
.render("Next Row", true, &self.witnesses)
self.row(row_index + 1).render(
&format!("Next row ({})", row_index + 1),
true,
&self.witnesses
)
);
log::debug!("\nSet RUST_LOG=trace to understand why these values were (not) chosen.");
log::debug!(
Expand Down

0 comments on commit 78ad276

Please sign in to comment.