Skip to content

WIP refactor #799 #952

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

Merged

Conversation

hero78119
Copy link
Collaborator

@hero78119 hero78119 commented May 19, 2025

Change scope

  • unify Expression with ceno
  • unify sumcheck with ceno
  • WIP GKR witness generation, take bit benchmark as example

@hero78119 hero78119 force-pushed the ming/refactor-prover branch from c79e994 to 58b74de Compare May 21, 2025 09:23
github-merge-queue bot pushed a commit that referenced this pull request May 29, 2025
Extracted from #952.

Observe a bottleneck on previous interpolation which contribute to most
of time due to `vector.extend` operation and bunch of allocations.
This PR rewrite univariate extrapolation
1. as the point to be interpolate are fixed set, we can pre-compute all
stuff require field inverse
2. in-place change to avoid allocation 

### benchmark
In Ceno opcode main sumcheck part we batch different degree > 1 into one
batch so this function will be used.
It shows a slightly improvement (~3%) on Fibonacci 2^24 e2e

| Benchmark | Median Time (s) | Median Change (%) |

|----------------------------------|------------------|--------------------|
| fibonacci_max_steps_1048576 | 2.3978 | +0.9805% (No significant change
) |
| fibonacci_max_steps_2097152 | 4.2579 | +1.7587% (Change within noise)
|
| fibonacci_max_steps_4194304 | 7.7561 | -3.5338% |
hero78119 and others added 7 commits May 29, 2025 15:06
…-tech#956)

Extracted from scroll-tech#952.

Observe a bottleneck on previous interpolation which contribute to most
of time due to `vector.extend` operation and bunch of allocations.
This PR rewrite univariate extrapolation
1. as the point to be interpolate are fixed set, we can pre-compute all
stuff require field inverse
2. in-place change to avoid allocation

In Ceno opcode main sumcheck part we batch different degree > 1 into one
batch so this function will be used.
It shows a slightly improvement (~3%) on Fibonacci 2^24 e2e

| Benchmark | Median Time (s) | Median Change (%) |

|----------------------------------|------------------|--------------------|
| fibonacci_max_steps_1048576 | 2.3978 | +0.9805% (No significant change
) |
| fibonacci_max_steps_2097152 | 4.2579 | +1.7587% (Change within noise)
|
| fibonacci_max_steps_4194304 | 7.7561 | -3.5338% |
benchmark shows there are quite of time spending on glibc free (drop)
when object end of its scopes.

Follow openvm using
[jemalloc](https://github.com/openvm-org/openvm/blob/c771a213f5e7f0732e0ddbafb273e15d99c5049d/crates/vm/Cargo.toml#L56)
as global allocators.
and set jemalloc parameter follows
https://github.com/openvm-org/openvm/blob/c771a213f5e7f0732e0ddbafb273e15d99c5049d/.github/workflows/benchmark-call.yml#L218
> I do not use jemalloc "background_thread: true" as I thought thread in
background might occupied other schedule which affect cpu intensive
program

### change scope
- enable jemalloc by default when compiling ceno_cli
- support `cargo make cli` to install ceno_cli
- introduce "jemalloc" features

### benchmark

benchmark on AMD EPYC 32 cores with command
`JEMALLOC_SYS_WITH_MALLOC_CONF="retain:true,metadata_thp:always,thp:always,dirty_decay_ms:-1,muzzy_decay_ms:-1,abort_conf:true"
cargo bench --bench fibonacci --features jemalloc --package ceno_zkvm --
--baseline opt-baseline`
 

| Benchmark | Average Time | Improvement | Throughput (instructions/sec)
|

|-----------------|--------------|-------------|---------------------------|
| fibonacci 2^20 | 2.0020 s | -14.74% | 523.76k |
| fibonacci 2^21 | 3.5903 s | -18.89% | 584.34k |
| fibonacci 2^22 | 6.6531 s | -24.69% | 630.28k |

---------

Co-authored-by: Zhang Zhuo <[email protected]>
@hero78119 hero78119 force-pushed the ming/refactor-prover branch from 6d096b9 to 8e0d7f3 Compare May 30, 2025 07:58
@spherel spherel self-requested a review June 3, 2025 09:47
Copy link
Member

@spherel spherel left a comment

Choose a reason for hiding this comment

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

LGTM!

@hero78119 hero78119 merged commit 009a61f into scroll-tech:tianyi/refactor-prover Jun 3, 2025
1 of 4 checks passed
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