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

feat: support other fields #135

Merged
merged 2 commits into from Jun 16, 2022
Merged

feat: support other fields #135

merged 2 commits into from Jun 16, 2022

Conversation

vmx
Copy link
Contributor

@vmx vmx commented Mar 7, 2022

It is now possible to use Neptune with Pasta curves on the GPU. In
order to make that possible, two new compile-time features are introduced.
bls to use BLS12-381 and pasta to use the Pasta curves (Pallas and
Vesta).

BREAKING CHANGE: The API now requires to pass in the field that
should be used. It does no longer default to BLS12-381.

If the GPU is used (enabled by the cuda and/or opencl features), you
now also need to specify the supported fields, bls and/or pasta.

Comment on lines +26 to +29
impl<
#[cfg(not(any(feature = "cuda", feature = "opencl")))] F: PrimeField,
#[cfg(any(feature = "cuda", feature = "opencl"))] F: PrimeField + GpuField,
A: Arity<F>,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cryptonemo that's what I mentioned in our meeting. It's between crazy and nice.

@vmx vmx marked this pull request as draft March 8, 2022 13:54
@vmx
Copy link
Contributor Author

vmx commented Mar 8, 2022

I've converted it to a draft PR as the CUDA side of things needs more work. There's no need for a review atm.

@vmx vmx changed the base branch from master to field-in-fun-name March 9, 2022 19:01
@vmx vmx force-pushed the fr-as-trait branch 2 times, most recently from 0adcaeb to 3b91f48 Compare March 10, 2022 11:49
@vmx vmx changed the title feat: use generic field everywhere feat: support other fields Mar 10, 2022
@vmx vmx marked this pull request as ready for review March 10, 2022 12:40
@vmx
Copy link
Contributor Author

vmx commented Mar 10, 2022

CI is happy now, it's ready for review. This PR depends on zcash/pasta_curves#31.

Cargo.toml Outdated
criterion = "0.3"
rand = "0.8.0"
sha2 = "0.9"
tempdir = "0.3"
rand_xorshift = "0.3.0"
serde_json = "1.0.53"
pasta_curves = "0.2.1"
pasta_curves = { git = "https://github.com/vmx/pasta_curves", branch = "ec-gpu" }
Copy link
Contributor

Choose a reason for hiding this comment

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

Needs updating before merge

Cargo.toml Outdated
criterion = "0.3"
rand = "0.8.0"
sha2 = "0.9"
tempdir = "0.3"
rand_xorshift = "0.3.0"
serde_json = "1.0.53"
pasta_curves = "0.2.1"
pasta_curves = { git = "https://github.com/vmx/pasta_curves", branch = "ec-gpu" }
Copy link
Contributor

Choose a reason for hiding this comment

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

Needs updating before merge

Copy link
Collaborator

@porcuquine porcuquine left a comment

Choose a reason for hiding this comment

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

Looks good, except for one naming issue (plus needs dependency update before merging).

gbench/src/main.rs Show resolved Hide resolved
@vmx vmx force-pushed the field-in-fun-name branch 2 times, most recently from 071aafc to 726f745 Compare March 11, 2022 13:45
Base automatically changed from field-in-fun-name to master March 11, 2022 14:27
Cargo.toml Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
blstrs = "0.4.0"
blstrs = { version = "0.4.0", features = ["gpu"] }
#pasta_curves = "0.3.0"
pasta_curves = { git = "https://github.com/vmx/pasta_curves", branch = "ec-gpu", features = ["gpu"] }
Copy link
Contributor

Choose a reason for hiding this comment

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

Update before merging

@DrPeterVanNostrand
Copy link
Contributor

Looks good!

@vmx
Copy link
Contributor Author

vmx commented Mar 11, 2022

I've rebased and addressed all review comments from @DrPeterVanNostrand in a separate commit.

@DrPeterVanNostrand
Copy link
Contributor

@vmx ECC merged the blocking pasta_curves PR, so I think this is good to go once the dependencies are updated.

@vmx
Copy link
Contributor Author

vmx commented Mar 29, 2022

I've just rebased and squashed it into a single commit, no other code changes. This is ready to be merged. Remember that this is a breaking change.

@vmx
Copy link
Contributor Author

vmx commented Mar 29, 2022

@porcuquine you'll see a fil_pasta_curves dependency. This is just a temporary fork and we hope to have an upstream release at one point. The idea for this PR is to get it merged and then we use Neptune's master branch for rust-fil-proofs. We won't need a release for now. The hope is that there is a proper upstream release before we need a Neptune release. => we don't need a Neptune release, I'll let you know once we do.

@porcuquine
Copy link
Collaborator

@vmx How about we make a feature branch you can use as a stable Git dependency, so we can avoid having a Git dependency onmaster?

@vmx
Copy link
Contributor Author

vmx commented Mar 30, 2022

I find having it on master easier (you can also just use the specific commit), but whatever works. @DrPeterVanNostrand @cryptonemo what do you think? We can also just use this branch.

@DrPeterVanNostrand
Copy link
Contributor

I'm fine with using this branch temporarily.

@porcuquine
Copy link
Collaborator

It's easier for the one consumer who needs it, but could be awkward if someone else needs something different — or if we need another release in-between, for whatever reason.

@vmx vmx changed the base branch from master to updated-deps June 16, 2022 12:41
@vmx
Copy link
Contributor Author

vmx commented Jun 16, 2022

@porcuquine given that there's an upcoming breaking change release, it would be cool if this PR could be included. In now uses released versions of the dependencies, no other changes were made since the last review. I've rebased it on top of #150 and also changed the base branch to that for this PR, so that review is easier. Once that PR is merged, I'll again rebase it on master.

Base automatically changed from updated-deps to master June 16, 2022 16:39
It is now possible to use Neptune with Pasta curves on the GPU. In
order to make that possible, two new compile-time features are introduced.
`bls` to use BLS12-381 and `pasta` to use the Pasta curves (Pallas and
Vesta).

BREAKING CHANGE: The API now requires to pass in the field that
should be used. It does no longer default to BLS12-381.

If the GPU is used (enabled by the `cuda` and/or `opencl` features), you
now also need to specify the supported fields, `bls` and/or `pasta`.
So far tests were run in a single job for different configurations. Split
those tests into separate jobs for more parllelism and hence shorter overall
runtime.
@porcuquine porcuquine merged commit 2968eb8 into master Jun 16, 2022
@porcuquine porcuquine deleted the fr-as-trait branch June 16, 2022 17:35
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.

None yet

4 participants