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

quadratic_sorting and is_prime benchmarks #813

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

mcalancea
Copy link
Collaborator

@mcalancea mcalancea commented Jan 7, 2025

This PR adds benches/ files exercising the quadratic_sorting and is_prime examples (the latter added in this PR). The benches target the E2EProving segment.

I've temporarily commented out a couple of things to make things work. They need to be addressed:

  • Use of debug_memory_ranges in src/e2e.rs.
  • Use of println! in guests. The reason is that the contents of these prints are stored into a memory range which is not included in writable memory when using the default heap sizes.

Additionally, I've renamed bubble_sorting to quadratic_sorting which I think matches the guest code better.

Later Edit:

  • Confirmed with Aurel that debug_memory_ranges can be removed entirely.

@matthiasgoergens
Copy link
Collaborator

matthiasgoergens commented Jan 7, 2025

Thanks!

We can completely remove the debug prints in the guests for now. Just make sure to have an assert or so inside the guest to make sure we got the right answers?

I'm also having trouble with debug_memory_ranges and hints in my sproll-evm benchmark branch. I guess we should use git blame to do some code archaeology to see what the historic context to the design decisions in this context was.

Copy link
Collaborator

@matthiasgoergens matthiasgoergens left a comment

Choose a reason for hiding this comment

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

Let's see if GitHub works now..

ceno_zkvm/Cargo.toml Show resolved Hide resolved
ceno_zkvm/benches/is_prime.rs Outdated Show resolved Hide resolved
ceno_zkvm/benches/is_prime.rs Outdated Show resolved Hide resolved
let heap_size = 2097152;
let pub_io_size = 16;
let program = Program::load_elf(ceno_examples::is_prime, u32::MAX).unwrap();
let platform = setup_platform(Preset::Ceno, &program, stack_size, heap_size, pub_io_size);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Slight tangent: the hole setup_platform business is a bit silly.

Our Ceno platform should have maximum limits (eg we can only use RAM up to something like u32::MAX - (1<<12) or so), but the concrete limits should be automatically inferred from how much memory is actually being used in the execution.

ceno_zkvm/benches/is_prime.rs Outdated Show resolved Hide resolved
github-merge-queue bot pushed a commit that referenced this pull request Jan 9, 2025
In preparation for #813

Also stop hard-coding the examples in the examples-builder.
@mcalancea mcalancea marked this pull request as ready for review January 9, 2025 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants