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: optimize proof generation #509

Merged
merged 11 commits into from
Aug 9, 2024
Merged

Conversation

chokobole
Copy link
Contributor

@chokobole chokobole commented Aug 7, 2024

Description

This PR optimizes parallel loops. (Including refactoring + bugfix)

@TomTaehoonKim
Copy link
Contributor

c69c990: parallel loops -> loops?

@chokobole
Copy link
Contributor Author

chokobole commented Aug 8, 2024

c69c990: parallel loops -> loops?

I said "merge parallel loops" because F::GetSuccessivePowers() uses parallel loops independently. I'll add more details in commit body.

Copy link
Contributor

@GideokKim GideokKim left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@ashjeong ashjeong left a comment

Choose a reason for hiding this comment

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

79c9de0
Please change the commit body. I’m not confident my change accurately depicts the changes. Please check that it does!

Removes code duplicates and optimizes potential parallelization.
If the input of BatchNormalize() is large enough, vector creation is parallelized. Else, the
operation is run serially, reducing the number of allocations.

4669aec
Change first line of body to “merge parallel loops since F::GetSuccessivePowers() uses parallel loops independently.” ("use" -> "uses")

715db8b
Please change the commit body as such:

Reduces the number of thread joins and heap allocations.

Additionally fixes bugs in GetSelectorsOnCoset() replacing
chunk_size with len.

fb2ea95
Commit title-> “prevent possible overflow error”

0018824
Commit title-> “fix ScalarMul result of multiplying by zero”

tachyon/math/polynomials/univariate/naive_batch_fft.h Outdated Show resolved Hide resolved
Copy link
Contributor

@TomTaehoonKim TomTaehoonKim left a comment

Choose a reason for hiding this comment

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

LGTM

@chokobole chokobole force-pushed the perf/optimize-parallel-loop branch 2 times, most recently from 379563f to c34c360 Compare August 8, 2024 09:36
Copy link
Contributor

@ashjeong ashjeong left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@dongchangYoo dongchangYoo left a comment

Choose a reason for hiding this comment

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

LGTM

- use `std::move()` where possible
- release intermediate vector immediately
- reserve `evals` size
Removes code duplication and optimizes potential parallelization.
Previously, when running serially, allocations occurred but were not used.
Additionally, when running with parallelization, the allocation was not
parallelized. Now, if the input to `BatchNormalize()` is large enough, vector
creation is parallelized properly and proper allocation usage is ensured.
- merge parallel loops since `F::GetSuccessivePowers()` uses parallel
  loops independently.
- use `std::move()` where possible
This is needed to construct `BigInt` with `Eigen::Index` from macOS.
Reduces the number of thread joins and heap allocations.

Additionally, fixes bugs in `GetSelectorsOnCoset()` replacing
`chunk_size` with `len`.
Copy link
Contributor

@batzor batzor left a comment

Choose a reason for hiding this comment

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

LGTM

@chokobole chokobole merged commit e3dc4dd into main Aug 9, 2024
7 checks passed
@chokobole chokobole deleted the perf/optimize-parallel-loop branch August 9, 2024 03:53
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.

6 participants