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

perf: gkr improvements #328

Merged
merged 6 commits into from
Feb 10, 2023
Merged

perf: gkr improvements #328

merged 6 commits into from
Feb 10, 2023

Conversation

gbotrel
Copy link
Collaborator

@gbotrel gbotrel commented Feb 3, 2023

On my M1 laptop for bn254 gkr+mimc benchmarks (didn't test on the hpc machine, can you do it @Tabaie ? )

benchmark                 old ns/op       new ns/op       delta
BenchmarkGkrMimc19-10     14436017333     10378219291     -28.11%
BenchmarkGkrMimc17-10     3835612209      2801590584      -26.96%

benchmark                 old allocs     new allocs     delta
BenchmarkGkrMimc19-10     2822836        4238771        +50.16%
BenchmarkGkrMimc17-10     1852294        2145689        +15.84%

benchmark                 old bytes      new bytes      delta
BenchmarkGkrMimc19-10     4448614064     2635133856     -40.77%
BenchmarkGkrMimc17-10     1152920304     696349192      -39.60%

@gbotrel gbotrel added the perf label Feb 3, 2023
@gbotrel gbotrel added this to the v0.10.0 milestone Feb 3, 2023
@gbotrel gbotrel requested a review from Tabaie February 3, 2023 19:01
@@ -113,7 +113,7 @@ func TestSumcheckFromSingleInputTwoIdentityGatesGateTwoInstances(t *testing.T) {
pool := polynomial.NewPool(256, 1<<11)
workers := utils.NewWorkerPool()
o.pool = &pool
o.workers = &workers
o.workers = workers
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a must? In the gnark API, I was creating a pool of workers for the GKR solver first and then passing the same one to the prover instead of taking it down and setting it up again, hence the pointer.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

utils.NewWorkerPool returns a pointer 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

(that being said, the pool is lightweight and it's OK to have 2 pools that are properly stopped using the "Stop" method between Solver and Prover; memory wise with stack / heap usage of the go routine of the pool that may actually work better (to be seen :))

@Tabaie Tabaie merged commit 045e689 into perf/gkr Feb 10, 2023
@gbotrel gbotrel deleted the perf/gkrpool branch August 21, 2023 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants