Skip to content

Commit d1cba5f

Browse files
authored
Merge branch 'master' into feat/gkr/add-instance
2 parents 61302f4 + 85d2dbc commit d1cba5f

File tree

110 files changed

+13686
-731
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+13686
-731
lines changed

.github/workflows/pr.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333

3434
test:
3535
needs: staticcheck
36-
runs-on: ubuntu-latest-128
36+
runs-on: gha-runner-scale-set-ubuntu-24-amd64-xxl
3737
permissions:
3838
pull-requests: write
3939
steps:
@@ -65,9 +65,9 @@ jobs:
6565
run: |
6666
set -euo pipefail
6767
go test -json -v -p 4 -short -timeout=30m ./... 2>&1 | gotestfmt -hide=all | tee /tmp/gotest.log
68-
go test -json -v -p 4 -tags=release_checks,solccheck . 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log
69-
go test -json -v -p 4 -tags=prover_checks ./test/... 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log
70-
go test -json -v -p 4 -tags=prover_checks ./examples/... 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log
68+
go test -json -v -p 4 -timeout=30m -tags=release_checks,solccheck . 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log
69+
go test -json -v -p 4 -timeout=30m -tags=prover_checks ./test/... 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log
70+
go test -json -v -p 4 -timeout=30m -tags=prover_checks ./examples/... 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log
7171
go test -json -v -run=NONE -fuzz=FuzzIntcomp -fuzztime=30s ./internal/backend/ioutils 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log
7272
7373

.github/workflows/push.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
strategy:
3939
matrix:
4040
go-version: [1.23.x]
41-
os: [ubuntu-latest-128, windows-latest, macos-latest]
41+
os: [gha-runner-scale-set-ubuntu-24-amd64-xxl, windows-latest, macos-latest]
4242
runs-on: ${{ matrix.os }}
4343
needs:
4444
- staticcheck
@@ -54,7 +54,7 @@ jobs:
5454
go install golang.org/x/tools/cmd/goimports@latest && go install github.com/klauspost/asmfmt/cmd/asmfmt@latest
5555
go install github.com/ethereum/go-ethereum/cmd/[email protected]
5656
- name: install solc deps
57-
if: startsWith(matrix.os, 'ubuntu') == true
57+
if: startsWith(matrix.os, 'gha-runner-scale-set-ubuntu') == true
5858
run: |
5959
go install github.com/consensys/[email protected]
6060
sudo add-apt-repository ppa:ethereum/ethereum
@@ -63,11 +63,11 @@ jobs:
6363
6464
- name: Test (windows / mac)
6565
# on macOS CI / Windows CI we avoid running the std/ tests (they are run on ubuntu CI)
66-
if: startsWith(matrix.os, 'ubuntu') == false
66+
if: startsWith(matrix.os, 'gha-runner-scale-set-ubuntu') == false
6767
run: |
6868
go test -tags=release_checks -v -timeout=60m .
6969
- name: Test (ubuntu - race and solc)
70-
if: startsWith(matrix.os, 'ubuntu') == true
70+
if: startsWith(matrix.os, 'gha-runner-scale-set-ubuntu') == true
7171
run: |
7272
go test -v -p 4 -short -timeout=30m ./...
7373
go test -v -p 4 -timeout=120m -tags=release_checks ./std/math/emulated/...

README.md

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -171,20 +171,11 @@ The following schemes and curves support experimental use of Ingonyama's ICICLE
171171
instantiated with the following curve(s)
172172

173173
- [x] BN254
174+
- [x] BLS12-377
175+
- [x] BLS12-381
176+
- [x] BW6-761
174177

175-
To use GPUs, add the `icicle` buildtag to your build/run commands, e.g. `go run -tags=icicle main.go`.
176-
177-
You can then toggle on or off icicle acceleration by providing the `WithIcicleAcceleration` backend ProverOption:
178-
179-
```go
180-
// toggle on
181-
proofIci, err := groth16.Prove(ccs, pk, secretWitness, backend.WithIcicleAcceleration())
182-
183-
// toggle off
184-
proof, err := groth16.Prove(ccs, pk, secretWitness)
185-
```
186-
187-
For more information about prerequisites see the [ICICLE repo](https://github.com/ingonyama-zk/icicle-gnark).
178+
For usage instructions see [accelerated backend documentation](backend/accelerated/icicle/doc.go) and [ICICLE repo](https://github.com/ingonyama-zk/icicle-gnark).
188179

189180
## Citing
190181

backend/accelerated/icicle/doc.go

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
// Package icicle implements backends using ICICLE library.
2+
//
3+
// This backend depends on the MIT-licensed [ICICLE] library. We currently
4+
// support Groth16 proving system on the following curves:
5+
// - BLS12-377
6+
// - BLS12-381
7+
// - BN254
8+
// - BW6-761
9+
//
10+
// # Setup
11+
//
12+
// Before using the GPU-acceleration for ICICLE backend, you must install the
13+
// CUDA toolkit and have a compatible NVIDIA GPU. See [CUDA instructions] for
14+
// more details. We have tested with CUDA 13 on Linux (Ubuntu 24.04), but other
15+
// versions should work as well.
16+
//
17+
// Additionally, for building ICICLE backend, you need to have a working clang
18+
// toolchain.
19+
//
20+
// To initialize the ICICLE backend, follow the instructions in the [ICICLE]
21+
// repository. Namely, first you should install the ICICLE library:
22+
//
23+
// git clone https://github.com/ingonyama-zk/icicle-gnark
24+
// cd icicle-gnark/wrappers/golang
25+
// sudo ./build.sh -curve=all
26+
//
27+
// After that, the libraries are installed in `/usr/local/lib` and backend in
28+
// `/usr/local/lib/backend`.
29+
//
30+
// Now set the environment variables:
31+
//
32+
// export CGO_LDFLAGS="-L/usr/local/lib -licicle_device -lstdc++ -lm -Wl,-rpath=/usr/local/lib"
33+
// export ICICLE_BACKEND_INSTALL_DIR="/usr/local/lib/backend/"
34+
//
35+
// # Usage
36+
//
37+
// To use the ICICLE backend in your code, you should use the `icicle_groth16`
38+
// package and use it for proving:
39+
//
40+
// import icicle_groth "github.com/consensys/gnark/backend/accelerated/icicle/groth16"
41+
// ...
42+
// pk := icicle_groth.NewProvingKey(curve)
43+
// n, err = pk.ReadFrom(r)
44+
// ...
45+
// proof, err := icicle_groth.Prove(ccs, pk, witness)
46+
//
47+
// Finally, to build the application, use the `icicle` build tag to ensure the ICICLE integration is built:
48+
//
49+
// go build -tags=icicle main.go
50+
//
51+
// # Proving key
52+
//
53+
// Keep in mind that the definitions of ICICLE and native gnark proving keys are
54+
// different, so you cannot directly use the native gnark proving key with the
55+
// ICICLE backend. However, the serialization is compatible, so you can use the
56+
// `ReadFrom` and `WriteTo` methods to read/write the proving keys in binary
57+
// format and use the same proving key for both backends.
58+
//
59+
// # Non-free backends
60+
//
61+
// gnark by default depends on the MIT-licensed ICICLE backend library. However, ICICLE
62+
// can be used with non-free backends (newer CUDA and Metal), but this is not tested
63+
// and we do not provide support for this.
64+
//
65+
// # Future compatibility
66+
//
67+
// Keep in mind that the accelerated backends are not automatically tested in
68+
// the CI, so we cannot guarantee that future changes in gnark will not break
69+
// the ICICLE integration. We also may change interfaces in the sub-packages to
70+
// align with the external dependency changes.
71+
//
72+
// [ICICLE]: https://github.com/ingonyama-zk/icicle-gnark
73+
// [CUDA instructions]: https://developer.nvidia.com/cuda-downloads?target_os=Linux
74+
package icicle

backend/accelerated/icicle/groth16/bls12-377/doc.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)