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

Cleanup dense poly #151

Merged
merged 5 commits into from
Jan 25, 2024
Merged

Cleanup dense poly #151

merged 5 commits into from
Jan 25, 2024

Conversation

mmagician
Copy link
Contributor

Slowly preparing for generalizing the PCS, which would require switching to MultilinearExtension from ark-poly and deprecating the custom DensePolynomial used now.

This PR should be useful regardless of whether the above happens or not:

  1. Removes merge_dual in favor of calling merge on the concatenated slices
  2. Removes unused extend
  3. msm-based functionality (flag_msm & sm_msm) are not methods on DensePolynomial but rather stand-alone functions. Moves them to the msm module.

@mmagician
Copy link
Contributor Author

Dev on ark-poly in that direction: arkworks-rs/algebra#763

Copy link
Collaborator

@sragss sragss left a comment

Choose a reason for hiding this comment

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

One comment on allocation. Otherwise LGTM.

@@ -122,7 +122,7 @@ where
fn batch(&self) -> Self::BatchedPolynomials {
use rayon::prelude::*;
let (batched_dim_read, (batched_final, batched_E, batched_flag)) = rayon::join(
|| DensePolynomial::merge_dual(self.dim.as_ref(), self.read_cts.as_ref()),
|| DensePolynomial::merge(&[self.dim.as_slice(), self.read_cts.as_slice()].concat()),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we drop the concat here?

I'm concerned that we're going to allocate a vector of length self.dim.len() + self.read_cts.len() twice. Once after the .concat() call and once in DensePolynomial::merge. Recall that these are likely to be massive (2^28 -> 2^32).

@mmagician mmagician requested a review from sragss January 25, 2024 19:01
@sragss
Copy link
Collaborator

sragss commented Jan 25, 2024

LGTM

@sragss sragss merged commit 72e9d36 into a16z:jolt Jan 25, 2024
@mmagician mmagician deleted the cleanup-dense-poly branch January 25, 2024 19:46
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