-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new test programs for wasm benchmarking (#8389)
This PR creates new test programs: bench_2_to_17, which is just a program constructed out of poseidon hashes with around 2^17 - epsilon gates, fold_2_to_17, which is a program that has 2 2^17-eps sized circuits that would get folded together, and single_verify_proof, which is a plonk recursive verifier which now has 2^18+eps gates. It also reworks some of the interfaces in main.ts. In particular, it gets the foldAndVerifyProgram flow working with fold_basic (and SMALL_TEST execution trace structure). I used the fold_2_to_17 test program to benchmark memory usage of ClientIVC in WASM, which came out to be 700MiB. Note that this was only possible by turning off the structure, because it would fail otherwise from too many poseidon gates. Running ClientIVC on the fold_basic test program using TraceStructure::SMALL_TEST (which ends up with dyadic size of 2^18) gives 1166.56MiB in WASM. Note that the builder memory is not an actual full 2^18 gate circuit because the circuits only had 22, 4539, 16432 gates, so it should actually be close to 1250MiB or so if we had full 2^18 gate circuits.
- Loading branch information
1 parent
7065962
commit 0b46e96
Showing
19 changed files
with
148 additions
and
37 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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
7 changes: 7 additions & 0 deletions
7
noir/noir-repo/test_programs/execution_success/bench_2_to_17/Nargo.toml
This file contains 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,7 @@ | ||
[package] | ||
name = "bench_2_to_17" | ||
type = "bin" | ||
authors = [""] | ||
compiler_version = ">=0.33.0" | ||
|
||
[dependencies] |
1 change: 1 addition & 0 deletions
1
noir/noir-repo/test_programs/execution_success/bench_2_to_17/Prover.toml
This file contains 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 @@ | ||
x = "3" |
8 changes: 8 additions & 0 deletions
8
noir/noir-repo/test_programs/execution_success/bench_2_to_17/src/main.nr
This file contains 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,8 @@ | ||
use std::hash::poseidon2; | ||
|
||
global len = 2450 * 2; | ||
fn main(x: Field) { | ||
let ped_input = [x; len]; | ||
let mut val = poseidon2::Poseidon2::hash(ped_input, len); | ||
assert(val != 0); | ||
} |
7 changes: 7 additions & 0 deletions
7
noir/noir-repo/test_programs/execution_success/fold_2_to_17/Nargo.toml
This file contains 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,7 @@ | ||
[package] | ||
name = "fold_2_to_17" | ||
type = "bin" | ||
authors = [""] | ||
compiler_version = ">=0.25.0" | ||
|
||
[dependencies] |
1 change: 1 addition & 0 deletions
1
noir/noir-repo/test_programs/execution_success/fold_2_to_17/Prover.toml
This file contains 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 @@ | ||
x = "2" |
16 changes: 16 additions & 0 deletions
16
noir/noir-repo/test_programs/execution_success/fold_2_to_17/src/main.nr
This file contains 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,16 @@ | ||
use std::hash::poseidon2; | ||
|
||
global len = 2450 * 2 - 240; // for just under 2^17 gates | ||
fn main(x: Field) { | ||
let ped_input = [x; len]; | ||
let mut val = poseidon2::Poseidon2::hash(ped_input, len); | ||
let z = foo(x); | ||
assert(val == z); | ||
} | ||
|
||
#[fold] | ||
fn foo(x: Field) -> Field { | ||
let ped_input = [x; len]; | ||
let mut val = poseidon2::Poseidon2::hash(ped_input, len); | ||
val | ||
} |
7 changes: 7 additions & 0 deletions
7
noir/noir-repo/test_programs/execution_success/single_verify_proof/Nargo.toml
This file contains 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,7 @@ | ||
[package] | ||
name = "single_verify_proof" | ||
type = "bin" | ||
authors = [""] | ||
compiler_version = ">=0.24.0" | ||
|
||
[dependencies] |
Oops, something went wrong.