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(math): optimize radix2 domain #521

Merged
merged 10 commits into from
Aug 19, 2024
Merged

Conversation

chokobole
Copy link
Contributor

Description

This PR optimizes CosetLDEBatch() and IFFTBatch() in a high view.

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

Copy link
Contributor

@fakedev9999 fakedev9999 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-radix2-domain branch from 829cb6b to 62c364e Compare August 14, 2024 11:28
@chokobole chokobole force-pushed the perf/optimize-radix2-domain branch 2 times, most recently from 7b8d9db to a8d68ab Compare August 19, 2024 03:16
Copy link
Contributor

@fakedev9999 fakedev9999 left a comment

Choose a reason for hiding this comment

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

LGTM

@batzor
Copy link
Contributor

batzor commented Aug 19, 2024

In ef58cee, I think you meant refac(math): change CosetFFTBatch() to private -> refac(math): change CosetLDEBatch() to public

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

@chokobole
Copy link
Contributor Author

In ef58cee, I think you meant refac(math): change CosetFFTBatch() to private -> refac(math): change CosetLDEBatch() to public

No, the methods were originally all public, and I changed CosetFFTBatch() to private because it's only used internally. So the change was intentional and correct.

@batzor
Copy link
Contributor

batzor commented Aug 19, 2024

LGTM

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

This refactor moves the computation of the `mid` variable to where it is
actually needed. This reduces the chance of mistakes when updating the `mid`
value.
- parallelize swapping rows.
- parallelize the multiplication between the matrix and the element.
This removes a call to `Zero()` that loops over the entire matrix.
Optimized to address several issues:
1. `conservativeResizeLike()` cannot be called with `Eigen::MatrixBase`,
   which is required by the next commit.
2. `conservativeResizeLike()` involves redundant large matrix creation.
3. `conservativeResizeLike()` is not parallelized.
To reduce RAM usage when calling these methods from the Rust side, inputs
should not be copied. This is achieved by using `Eigen::Map<>`. The argument
type is changed from `RowMajorMatrix<F>&` to
`Eigen::MatrixBase<RowMajorMatrix<F>>&` to support this.

See https://eigen.tuxfamily.org/dox/group__TutorialMapClass.html.
@chokobole chokobole force-pushed the perf/optimize-radix2-domain branch from a8d68ab to bfbecf8 Compare August 19, 2024 05:09
@chokobole chokobole merged commit 64a3ab4 into main Aug 19, 2024
7 checks passed
@chokobole chokobole deleted the perf/optimize-radix2-domain branch August 19, 2024 05:52
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