Skip to content

Commit

Permalink
Merge branch 'master' into chore/groth16-mpc
Browse files Browse the repository at this point in the history
  • Loading branch information
Tabaie authored Dec 18, 2024
2 parents c146e7d + f3d9199 commit 23d87ac
Show file tree
Hide file tree
Showing 45 changed files with 3,954 additions and 5,320 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ func main() {

### GPU Support

#### Icicle Library
#### ICICLE Library

The following schemes and curves support experimental use of Ingonyama's Icicle GPU library for low level zk-SNARK primitives such as MSM, NTT, and polynomial operations:
The following schemes and curves support experimental use of Ingonyama's ICICLE GPU library for low level zk-SNARK primitives such as MSM, NTT, and polynomial operations:

- [x] [Groth16](https://eprint.iacr.org/2016/260)

Expand All @@ -184,7 +184,7 @@ You can then toggle on or off icicle acceleration by providing the `WithIcicleAc
proof, err := groth16.Prove(ccs, pk, secretWitness)
```

For more information about prerequisites see the [Icicle repo](https://github.com/ingonyama-zk/icicle).
For more information about prerequisites see the [ICICLE repo](https://github.com/ingonyama-zk/icicle). **NB! ICICLE CUDA kernels are covered by a special license for now. Follow the instructions to download and set up the kernels.**

## Citing

Expand Down
31 changes: 31 additions & 0 deletions backend/groth16/bn254/icicle/device.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//go:build icicle

package icicle

import (
"fmt"
"sync"

"github.com/consensys/gnark/logger"
icicle_runtime "github.com/ingonyama-zk/icicle/v3/wrappers/golang/runtime"
)

var onceWarmUpDevice sync.Once

func warmUpDevice() {
onceWarmUpDevice.Do(func() {
log := logger.Logger()
err := icicle_runtime.LoadBackendFromEnvOrDefault()
if err != icicle_runtime.Success {
panic(fmt.Sprintf("ICICLE backend loading error: %s", err.AsString()))
}
device := icicle_runtime.CreateDevice("CUDA", 0)
log.Debug().Int32("id", device.Id).Str("type", device.GetDeviceType()).Msg("ICICLE device created")
icicle_runtime.RunOnDevice(&device, func(args ...any) {
err := icicle_runtime.WarmUpDevice()
if err != icicle_runtime.Success {
panic(fmt.Sprintf("ICICLE device warmup error: %s", err.AsString()))
}
})
})
}
2 changes: 1 addition & 1 deletion backend/groth16/bn254/icicle/doc.go
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// Package icicle_bn254 implements ICICLE acceleration for BN254 Groth16 backend.
package icicle_bn254
package icicle
Loading

0 comments on commit 23d87ac

Please sign in to comment.