Skip to content

Feat: combine multiple loops into one in sumcheck verifier #22

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
merged 2 commits into from
Jun 19, 2025

Conversation

kunxian-xia
Copy link
Contributor

@kunxian-xia kunxian-xia commented Jun 19, 2025

Rationale

We merge three loops into one:

  1. observe_then_sample: observe the prover messages and then sample $n$ challenges; (load prover message)
  2. part 1 of check_and_generate_subclaim: compute $p_i(r)$ and store it in a new array; (load prover message)
  3. part 2 of check_and_generate_subclaim: assert that $p_i(r) = p_{i+1}(0) + p_{i+1}(1)$; (load prover mesage)

Note that the above three loops need to load prover message array by three times. And each load takes at least 7 cycles.
It's easy to see that we can merge them into one loop.

Performance

num_variables max_degree cycles
4 3 632 -> 498
5 3 774 -> 615

Cycle distribution

INFO     ┝━ i [info]: ┌╴sumcheck verify
INFO     ┝━ i [info]: │ ┌╴IOPVerifierState::verify_round_and_update_state
INFO     ┝━ i [info]: │ │ ┌╴observe_then_sample
INFO     ┝━ i [info]: │ │ └╴45 cycles
INFO     ┝━ i [info]: │ │ ┌╴extrapolate_uni_poly
INFO     ┝━ i [info]: │ │ └╴52 cycles
INFO     ┝━ i [info]: │ │ ┌╴observe_then_sample
INFO     ┝━ i [info]: │ │ └╴44 cycles
INFO     ┝━ i [info]: │ │ ┌╴extrapolate_uni_poly
INFO     ┝━ i [info]: │ │ └╴52 cycles
INFO     ┝━ i [info]: │ │ ┌╴observe_then_sample
INFO     ┝━ i [info]: │ │ └╴44 cycles
INFO     ┝━ i [info]: │ │ ┌╴extrapolate_uni_poly
INFO     ┝━ i [info]: │ │ └╴52 cycles
INFO     ┝━ i [info]: │ │ ┌╴observe_then_sample
INFO     ┝━ i [info]: │ │ └╴44 cycles
INFO     ┝━ i [info]: │ │ ┌╴extrapolate_uni_poly
INFO     ┝━ i [info]: │ │ └╴52 cycles
INFO     ┝━ i [info]: │ └╴473 cycles
INFO     ┕━ i [info]: └╴498 cycles

@kunxian-xia kunxian-xia requested a review from darth-cy June 19, 2025 08:23
@kunxian-xia kunxian-xia merged commit d316293 into feat/improve_sumcheck Jun 19, 2025
@kunxian-xia kunxian-xia deleted the feat/sumcheck_combine branch June 19, 2025 10:26
@kunxian-xia kunxian-xia mentioned this pull request Jun 19, 2025
6 tasks
kunxian-xia added a commit that referenced this pull request Jun 19, 2025
* Test sample vm instruction programs

* Articulate idx workflow

* Articulate idx workflow

* Change dependencies

* Complete builder constraint based multi observe

* Keep new builder fn

* Establish entry point

* Use opcode

* Switch remote dependency

* Remove array enumeration

* Remove debug flags

* Fix consistency test

* add cycle count unit test for sumcheck verifier

* enable new sample_ext implementation

* improve

* cycle profiling

* update ceno dependency

* remove unused interpolate_uni_poly and add tower verifier unit test

* set num product specs to 2

* dot product whenone vector's size is known (#17)

* replace join by extend (#18)

* Feat: compute powers of `alpha` on the fly (#19)

* compute alpha's powers on the fly

* chore

* cleanup

* Feat: compute `is_smaller_than` incrementally (#20)

* compute is_smaller_than incrementally

* is_smaller_than for logup spec

* multiply by eq_e later

* Finish replacing iterative smaller_than

* Remove import

* remove next_layer_skip array

* update point and eval only for last layer

---------

Co-authored-by: Ray Gao <[email protected]>

* fix merge error

* track cycles in sumcheck verifier

* Feat: combine multiple loops into one in sumcheck verifier (#22)

* combine two phases into one to reduce memory rw cost

* save 3 cycles by using 0+0 trick

* div instead of *x.inverse() (#23)

* remove low-level cycle trackers

* turn on tracing for e2e test

---------

Co-authored-by: Ray Gao <[email protected]>
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.

1 participant