Skip to content

Commit

Permalink
Merge branch 'icicle-v3-upgrade' into master-v3-merge
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyfelder committed Nov 19, 2024
2 parents 506361e + 429d02d commit 1abf497
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions backend/groth16/bn254/icicle/provingkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ type ProvingKey struct {
*deviceInfo
}

func Setup(r1cs *cs.R1CS, pk *ProvingKey, vk *groth16_bn254.VerifyingKey) error {
func WarmUpDevice() {
icicle_runtime.LoadBackendFromEnvOrDefault()
device := icicle_runtime.CreateDevice("CUDA", 0)
icicle_runtime.SetDevice(&device)
icicle_runtime.RunOnDevice(&device, func(args ...any) {
icicle_runtime.WarmUpDevice()
})
}

func Setup(r1cs *cs.R1CS, pk *ProvingKey, vk *groth16_bn254.VerifyingKey) error {
WarmUpDevice()
return groth16_bn254.Setup(r1cs, &pk.ProvingKey, vk)
}

Expand Down
1 change: 1 addition & 0 deletions backend/groth16/groth16.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ func NewProvingKey(curveID ecc.ID) ProvingKey {
case ecc.BN254:
pk = &groth16_bn254.ProvingKey{}
if icicle_bn254.HasIcicle {
icicle_bn254.WarmUpDevice()
pk = &icicle_bn254.ProvingKey{}
}
case ecc.BLS12_377:
Expand Down

0 comments on commit 1abf497

Please sign in to comment.