-
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds GPU acceleration support for Groth16 proving using the ICICLE library across three additional curves: BLS12-377, BLS12-381, and BW6-761. The implementation refactors the package structure to provide a cleaner separation between native and accelerated backends, while maintaining backward compatibility.
- Refactors ICICLE acceleration to use dedicated package paths instead of automatic switching
- Adds GPU acceleration support for BLS12-377, BLS12-381, and BW6-761 curves
- Deprecates automatic ICICLE switching in favor of explicit usage of accelerated backends
Reviewed Changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 17 comments.
Show a summary per file
| File | Description |
|---|---|
| examples/accelerated_gpu/* | New examples demonstrating GPU acceleration usage |
| backend/accelerated/icicle/* | New package structure for ICICLE-accelerated backends |
| backend/groth16/groth16.go | Removes automatic ICICLE switching logic |
| backend/backend.go | Deprecates WithIcicleAcceleration option |
| backend/groth16/bn254/icicle/* | Refactored BN254 ICICLE implementation |
| README.md | Updated documentation for new acceleration approach |
Comments suppressed due to low confidence (4)
backend/accelerated/icicle/groth16/bls12-377/marshal_test.go:1
- Incorrect curve used for compilation. Should use
ecc.BLS12_377.ScalarField()instead ofecc.BLS12_381.ScalarField()for BLS12-377 test.
//go:build icicle
backend/accelerated/icicle/groth16/bls12-377/marshal_test.go:1
- Incorrect curve ID used. Should use
ecc.BLS12_377instead ofecc.BLS12_381for BLS12-377 test.
//go:build icicle
backend/accelerated/icicle/groth16/bls12-377/marshal_test.go:1
- Incorrect curve scalar field used. Should use
ecc.BLS12_377.ScalarField()instead ofecc.BLS12_381.ScalarField()for BLS12-377 test.
//go:build icicle
backend/accelerated/icicle/groth16/bls12-377/marshal_test.go:1
- Incorrect curve used for compilation. Should use
ecc.BLS12_377.ScalarField()instead ofecc.BLS12_381.ScalarField()for BLS12-377 test.
//go:build icicle
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Converting to draft - Cursor has found valid issues but takes time to fix. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 26 out of 26 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Description
The ICICILE backend already has the support for the curves, but we never exposed them before. I added the support without code generation for now, which can be done in the future.
I also refactored the package paths not to contaminate the "native" accelerators with different external accelerators. This now allows to provide some accelerator-specific options. I kept the existing options for backwards compatibility, but it now returns runtime error with helpful message on how to upgrade the implementation.
Tested on AWS g6e.2xlarge and works for all curves.
I also clarified documentation and added examples.
Type of change
How has this been tested?
How has this been benchmarked?
Very brief benchmarks show 20-40x speedup over the native prover on CPU (only prover runtime excluding solver runtime).
Checklist:
golangci-lintdoes not output errors locallyNote
Adds ICICLE-accelerated Groth16 backend for BLS12-377/381/BW6-761 with a new API and config, refactors BN254 integration, deprecates the old switch option, and updates docs, examples, and tests.
bls12-377,bls12-381, andbw6-761withProveand device-backedProvingKey.backend/accelerated/icicle/groth16wrapper exposingProve,Setup,DummySetup, andNewProvingKey, plus one-time device warmup.WithDeviceID,WithBackend,WithBackendLibrary,WithProverOptions) inbackend/accelerated/icicle/opts.go.backend/accelerated/icicle/groth16/bn254and remove legacy in-place ICICLE hooks from nativegroth16.backend.WithIcicleAccelerationnow returns a runtime error (deprecated); users must call the ICICLE backend explicitly.groth16no longer conditionally switches to ICICLE.README.mdGPU section; add detailed ICICLE setup/usage doc (backend/accelerated/icicle/doc.go).examples/accelerated_gpudemonstrating end-to-end accelerated proving.BLS12-377,BLS12-381,BN254, andBW6-761.Written by Cursor Bugbot for commit f8322ae. This will update automatically on new commits. Configure here.