-
Notifications
You must be signed in to change notification settings - Fork 487
feat: add BLS12-377, BLS12-381 and BW6-761 GPU acceleration support for Groth16 #1625
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
Merged
Merged
Changes from 11 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
6243be5
refactor: move icicle acceleration out
ivokub 42ada05
refactor: remove option for switching acceleration
ivokub 57bb7da
fix: bw6 g2 projective to jac
ivokub 4f1ee58
fix: warm up device before proving
ivokub 9817c67
feat: opts and documentation
ivokub 7a62942
docs: reserve enum and docs
ivokub 9f40614
docs: add example
ivokub cbf2637
docs: example
ivokub 638932a
fix: load recursively
ivokub 6871daa
chore: log level
ivokub 1bd5d1a
docs: output
ivokub d7f7c43
docs: typo fix
ivokub 9b790a4
test: use bw curve
ivokub e3472b9
docs: typofix
ivokub 15a2b39
docs: fix method doc
ivokub 5659f5a
test: refactor marshal test
ivokub 0834221
Update examples/accelerated_gpu/doc.go
ivokub f8322ae
Update backend/accelerated/icicle/doc.go
ivokub c2f41a4
fix: target solidity options everywhere
ivokub 327612c
feat: use code generation
ivokub 8b3c2f0
chore: go generate
ivokub 5e3da8e
docs: add CUDA reference
ivokub 5643848
docs: fix git clone path
ivokub c3319d8
docs: add reference to clang
ivokub File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| // Package icicle implements backends using ICICLE library. | ||
| // | ||
| // This backend depends on the MIT-licensed [ICICLE] library. We currently | ||
| // support Groth16 proving system on the following curves: | ||
| // - BLS12-377 | ||
| // - BLS12-381 | ||
| // - BN254 | ||
| // - BW6-761 | ||
| // | ||
| // # Setup | ||
| // | ||
| // To initialize the ICICILE backend, follow the instructions in the [ICICLE] | ||
| // repository. Namely, first you should install the ICICLE library: | ||
| // | ||
| // git clone github.com/ingonyama-zk/icicle-gnark | ||
ivokub marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // cd icicle-gnark/wrappers/golang | ||
| // sudo ./build.sh -curve=all | ||
| // | ||
| // After that, the libraries are installed in `/usr/local/lib“ and backend in | ||
ivokub marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // `/usr/local/lib/backend`. | ||
| // | ||
| // Now set the environment variables: | ||
| // | ||
| // export CGO_LDFLAGS="-L/usr/local/lib -licicle_device -lstdc++ -lm -Wl,-rpath=/usr/local/lib" | ||
| // export ICICLE_BACKEND_INSTALL_DIR="/usr/local/lib/backend/" | ||
| // | ||
| // # Usage | ||
| // | ||
| // To use the ICICLE backend in your code, you should use the `icicle_groth16` | ||
| // package and use it for proving: | ||
| // | ||
| // import icicle_groth "github.com/consensys/gnark/backend/accelerated/icicle/groth16" | ||
| // ... | ||
| // pk := icicle_groth.NewProvingKey(curve) | ||
| // n, err = pk.ReadFrom(r) | ||
| // ... | ||
| // proof, err := icicle_groth.Prove(ccs, pk, witness) | ||
| // | ||
| // Finally, to build the application, use the `icicle` build tag to ensure the ICICLE integration is built: | ||
| // | ||
| // go build -tags=icicle main.go | ||
| // | ||
| // # Proving key | ||
| // | ||
| // Keep in mind that the definitions of ICICLE and native gnark proving keys are | ||
| // different, so you cannot directly use the native gnark proving key with the | ||
| // ICICLE backend. However, the serialization is compatible, so you can use the | ||
| // `ReadFrom` and `WriteTo` methods to read/write the proving keys in binary | ||
| // format and use the same proving key for both backends. | ||
| // | ||
| // # Non-free backends | ||
| // | ||
| // gnark by default depends on the MIT-licensed ICICLE backend library. However, ICICLE | ||
| // can be used with non-free backends (newer CUDA and Metal), but this is not tested | ||
| // and we do not provide support for this. | ||
| // | ||
| // # Future compatibility | ||
| // | ||
| // Keep in mind that the accelerated backends are not automatically tested in | ||
| // the CI, so we cannot guarantee that future changes in gnark will not break | ||
| // the ICICLE integration. We also may change interfaces in the sub-packages to | ||
| // align with the external dependency changes. | ||
| // | ||
| // [ICICLE]: https://github.com/ingonyama-zk/icicle-gnark | ||
| package icicle | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| // Package icicle_bls12377 implements ICICLE acceleration for BLS12-377 Groth16 backend. | ||
| package bls12377 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.