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

improve batching sumcheck concurrency to dominate by max num var polynomial #895

Merged

Conversation

hero78119
Copy link
Collaborator

@hero78119 hero78119 commented Apr 3, 2025

Previously (devirgo) sumcheck concurrency when batching with different number of variables, are dominated by the smallest num_vars. The reason is because for the num_var < log_2(threads) we can NOT divide it's evaluation into #thread region.

This PR addressed the issue by introducing a extra meta information for each polynomial, so we are able to differentiate those small poly and calculate its multiplicity correctly

Design rationale

For some extreme small polynomial (num_var << log(threads)), we define a new PolyType::Phase2Only to differentiate them. These type of small polynomial will be handle by main_worker only during phase 1 sumcheck. And when moving to phase2 sumcheck, those small poly will expand the size to match with all. This cost is negligible giving phase2 only need to run on #thread evaluations.

benchmark

There is no different with before/after change, since we dont have batch sumcheck with different num_vars in critical path, which meet expected

e2e Fibonacci 2^20

fibonacci_max_steps_1048576/prove_fibonacci/fibonacci_max_steps_1048576
                        time:   [2.8894 s 2.9028 s 2.9180 s]
                        change: [+0.1414% +0.8059% +1.5474%] (p = 0.05 < 0.05)
                        Change within noise threshold.

e2e Fibonacci 2^21

fibonacci_max_steps_2097152/prove_fibonacci/fibonacci_max_steps_2097152
                        time:   [5.1785 s 5.2061 s 5.2291 s]
                        change: [+0.7256% +1.3249% +1.9085%] (p = 0.00 < 0.05)
                        Change within noise threshold.

e2e Fibonacci 2^22

fibonacci_max_steps_4194304/prove_fibonacci/fibonacci_max_steps_4194304
                        time:   [10.308 s 10.330 s 10.353 s]
                        change: [+0.9437% +1.2216% +1.4899%] (p = 0.00 < 0.05)
                        Change within noise threshold.

@hero78119 hero78119 marked this pull request as draft April 3, 2025 06:49
@hero78119 hero78119 changed the title improve batching sumcheck parallism dominated by max num var improve batching sumcheck concurrency to dominate by max num var Apr 3, 2025
@hero78119 hero78119 changed the title improve batching sumcheck concurrency to dominate by max num var improve batching sumcheck concurrency to dominate by max num var polynomial Apr 3, 2025
@hero78119 hero78119 marked this pull request as ready for review April 4, 2025 06:52
@hero78119 hero78119 requested a review from spherel April 4, 2025 06:58
github-merge-queue bot pushed a commit that referenced this pull request Apr 9, 2025
Extract from PR #895 

Remove forked transcript to simplify design. 

### benchmark
To assure no impact for e2e
Fibonacci 2^20
```
fibonacci_max_steps_1048576/prove_fibonacci/fibonacci_max_steps_1048576
                        time:   [2.8696 s 2.8901 s 2.9127 s]
                        change: [-1.0773% -0.1480% +0.8449%] (p = 0.79 > 0.05)
                        No change in performance detected.

```

Fibonacci 2^21
```
fibonacci_max_steps_2097152/prove_fibonacci/fibonacci_max_steps_2097152
                        time:   [5.2648 s 5.2801 s 5.2959 s]
                        change: [+0.4221% +0.9989% +1.5705%] (p = 0.00 < 0.05)
                        Change within noise threshold.
```
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 added this pull request to the merge queue Apr 12, 2025
Merged via the queue into scroll-tech:master with commit a4def62 Apr 12, 2025
4 checks passed
@hero78119 hero78119 deleted the feat/optimize_sumcheck_concurrency branch April 12, 2025 01:26
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