Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for benchmarks #822

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions ceno_emul/src/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,14 @@ pub struct Platform {

impl Display for Platform {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
let prog_data: Option<Range<Addr>> = match (self.prog_data.first(), self.prog_data.last()) {
(Some(first), Some(last)) => Some(*first..*last),
_ => None,
let prog_data = match (self.prog_data.first(), self.prog_data.last()) {
(Some(first), Some(last)) => format!("{:#x?}", *first..*last),
_ => "-".to_string(),
};
write!(
f,
"Platform {{ rom: {:?}, prog_data: {:?}, stack: {:?}, heap: {:?}, public_io: {:?}, hints: {:?}, unsafe_ecall_nop: {} }}",
self.rom,
prog_data,
self.stack,
self.heap,
self.public_io,
self.hints,
self.unsafe_ecall_nop
"Platform {{ rom: {:#x?}, prog_data: {prog_data}, stack: {:#x?}, heap: {:x?}, public_io: {:#x?}, hints: {:#x?}, unsafe_ecall_nop: {} }}",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hex is easier to read here (because we use round numbers, only when expressed in powers of 2), and it's also how we specify these numbers in our linker script etc.

self.rom, self.stack, self.heap, self.public_io, self.hints, self.unsafe_ecall_nop
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion ceno_zkvm/src/bin/e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ fn main() {
);
tracing::info!("Running on platform {:?} {}", args.platform, platform);
tracing::info!(
"Stack: {} bytes. Heap: {} bytes.",
"Stack: {:#x?} bytes. Heap: {:#x?} bytes.",
args.stack_size,
args.heap_size
);
Expand Down
15 changes: 13 additions & 2 deletions ceno_zkvm/src/e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pub struct EmulationResult {
pi: PublicValues<u32>,
}

// TODO(Matthias): handle hints properly.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something to fix soon. But I don't know enough at the moment.

It's definitely broken in master, though.

fn emulate_program(
program: Arc<Program>,
max_steps: usize,
Expand Down Expand Up @@ -574,8 +575,18 @@ fn debug_memory_ranges(vm: &VMState, mem_final: &[MemFinalRecord]) {
format_segments(vm.platform(), handled_addrs.iter().copied())
);

for addr in &accessed_addrs {
assert!(handled_addrs.contains(addr), "unhandled addr: {:?}", addr);
let unhandled: BTreeSet<_> = accessed_addrs
.iter()
.filter(|addr| !handled_addrs.contains(addr))
.collect();

// TODO(Matthias): this should be an assert, but it's currently broken, because our caller doesn't handle hints.
hero78119 marked this conversation as resolved.
Show resolved Hide resolved
if !unhandled.is_empty() {
tracing::warn!(
"unhandled addr: {:?} to {:?}",
unhandled.first(),
unhandled.last()
);
}
}

Expand Down