Skip to content

Feat: compute powers of alpha on the fly #19

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 3 commits into from
Jun 16, 2025

Conversation

kunxian-xia
Copy link
Contributor

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

Performance

Summary: we have about 20% improvement. And the performance gain is due to two parts:

  1. avoid computing eq(rt, sub_rt) in several places.
  2. compute $\alpha$'s powers on the fly.

The cycle count after this PR:

INFO     ┝━ i [info]: ┌╴initial sum
INFO     ┝━ i [info]: └╴162 cycles
INFO     ┝━ i [info]: ┌╴check expected evaluation
INFO     ┝━ i [info]: └╴171 cycles
INFO     ┝━ i [info]: ┌╴derive next layer's expected sum
INFO     ┝━ i [info]: └╴287 cycles
INFO     ┝━ i [info]: ┌╴check expected evaluation
INFO     ┝━ i [info]: └╴186 cycles
INFO     ┝━ i [info]: ┌╴derive next layer's expected sum
INFO     ┝━ i [info]: └╴295 cycles
INFO     ┝━ i [info]: ┌╴check expected evaluation
INFO     ┝━ i [info]: └╴201 cycles
INFO     ┝━ i [info]: ┌╴derive next layer's expected sum
INFO     ┝━ i [info]: └╴303 cycles
INFO     ┝━ i [info]: ┌╴check expected evaluation
INFO     ┝━ i [info]: └╴216 cycles
INFO     ┝━ i [info]: ┌╴derive next layer's expected sum
INFO     ┕━ i [info]: └╴305 cycles

The cycle count before this PR:

INFO     ┝━ i [info]: ┌╴initial sum
INFO     ┝━ i [info]: └╴183 cycles
INFO     ┝━ i [info]: ┌╴check expected evaluation
INFO     ┝━ i [info]: └╴216 cycles
INFO     ┝━ i [info]: ┌╴derive next layer's expected sum
INFO     ┝━ i [info]: └╴360 cycles
INFO     ┝━ i [info]: ┌╴check expected evaluation
INFO     ┝━ i [info]: └╴254 cycles
INFO     ┝━ i [info]: ┌╴derive next layer's expected sum
INFO     ┝━ i [info]: └╴368 cycles
INFO     ┝━ i [info]: ┌╴check expected evaluation
INFO     ┝━ i [info]: └╴292 cycles
INFO     ┝━ i [info]: ┌╴derive next layer's expected sum
INFO     ┝━ i [info]: └╴376 cycles
INFO     ┝━ i [info]: ┌╴check expected evaluation
INFO     ┝━ i [info]: └╴330 cycles
INFO     ┝━ i [info]: ┌╴derive next layer's expected sum
INFO     ┕━ i [info]: └╴378 cycles

let spec_index = i_vec[0];
let eq_e = eq_eval(builder, &out_rt, &sub_rt);
Copy link
Contributor Author

@kunxian-xia kunxian-xia Jun 16, 2025

Choose a reason for hiding this comment

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

Move this outside the loop.

@kunxian-xia kunxian-xia merged commit bcd8441 into feat/improve_sumcheck Jun 16, 2025
@kunxian-xia kunxian-xia deleted the feat/alpha_pows_on_the_fly branch June 16, 2025 15:28
@kunxian-xia kunxian-xia linked an issue Jun 17, 2025 that may be closed by this pull request
@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.

avoid gen_alpha_pows
1 participant