Skip to content

Commit 62a4474

Browse files
committed
add prints
1 parent ec93c83 commit 62a4474

2 files changed

Lines changed: 96 additions & 0 deletions

File tree

prover/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,9 @@ pub fn prove_with_options(
517517
// Page tables are derived from the prover's MemoryState (all accessed pages).
518518
let mut traces = Traces::from_elf_and_logs(&program, &result.logs, max_rows)?;
519519

520+
eprintln!("Instructions executed: {}", result.logs.len());
521+
traces.print_row_report();
522+
520523
drop(result);
521524

522525
#[cfg(feature = "disk-spill")]

prover/src/tables/trace_builder.rs

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,6 +1740,99 @@ pub struct Traces {
17401740
pub keccak: TraceTable<GoldilocksField, GoldilocksExtension>,
17411741
}
17421742

1743+
impl Traces {
1744+
/// Print a per-table row count report (including chunked tables).
1745+
/// Also prints total rows for each table type.
1746+
pub fn print_row_report(&self) {
1747+
fn sum_rows(tables: &[TraceTable<GoldilocksField, GoldilocksExtension>]) -> usize {
1748+
tables.iter().map(|t| t.num_rows()).sum()
1749+
}
1750+
1751+
eprintln!("=== Trace row report ===");
1752+
eprintln!(
1753+
"CPU chunks={:>4} total_rows={:>12}",
1754+
self.cpus.len(),
1755+
sum_rows(&self.cpus)
1756+
);
1757+
eprintln!(
1758+
"MEMW chunks={:>4} total_rows={:>12}",
1759+
self.memws.len(),
1760+
sum_rows(&self.memws)
1761+
);
1762+
eprintln!(
1763+
"MEMW_A chunks={:>4} total_rows={:>12}",
1764+
self.memw_aligneds.len(),
1765+
sum_rows(&self.memw_aligneds)
1766+
);
1767+
eprintln!(
1768+
"LOAD chunks={:>4} total_rows={:>12}",
1769+
self.loads.len(),
1770+
sum_rows(&self.loads)
1771+
);
1772+
eprintln!(
1773+
"LT chunks={:>4} total_rows={:>12}",
1774+
self.lts.len(),
1775+
sum_rows(&self.lts)
1776+
);
1777+
eprintln!(
1778+
"MUL chunks={:>4} total_rows={:>12}",
1779+
self.muls.len(),
1780+
sum_rows(&self.muls)
1781+
);
1782+
eprintln!(
1783+
"DVRM chunks={:>4} total_rows={:>12}",
1784+
self.dvrms.len(),
1785+
sum_rows(&self.dvrms)
1786+
);
1787+
eprintln!(
1788+
"SHIFT chunks={:>4} total_rows={:>12}",
1789+
self.shifts.len(),
1790+
sum_rows(&self.shifts)
1791+
);
1792+
eprintln!(
1793+
"BRANCH chunks={:>4} total_rows={:>12}",
1794+
self.branches.len(),
1795+
sum_rows(&self.branches)
1796+
);
1797+
eprintln!(
1798+
"BITWISE chunks={:>4} total_rows={:>12}",
1799+
1,
1800+
self.bitwise.num_rows()
1801+
);
1802+
eprintln!(
1803+
"DECODE chunks={:>4} total_rows={:>12}",
1804+
1,
1805+
self.decode.num_rows()
1806+
);
1807+
eprintln!(
1808+
"REGISTER chunks={:>4} total_rows={:>12}",
1809+
1,
1810+
self.register.num_rows()
1811+
);
1812+
eprintln!(
1813+
"HALT chunks={:>4} total_rows={:>12}",
1814+
1,
1815+
self.halt.num_rows()
1816+
);
1817+
eprintln!(
1818+
"COMMIT chunks={:>4} total_rows={:>12}",
1819+
1,
1820+
self.commit.num_rows()
1821+
);
1822+
eprintln!(
1823+
"KECCAK chunks={:>4} total_rows={:>12}",
1824+
1,
1825+
self.keccak.num_rows()
1826+
);
1827+
eprintln!(
1828+
"PAGE chunks={:>4} total_rows={:>12}",
1829+
self.pages.len(),
1830+
sum_rows(&self.pages)
1831+
);
1832+
eprintln!("========================");
1833+
}
1834+
}
1835+
17431836
/// Chunk raw ops and generate one trace table per chunk.
17441837
fn chunk_and_generate<T>(
17451838
ops: &[T],

0 commit comments

Comments
 (0)