-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): Add test for global vars entry points regression (#7209)
- Loading branch information
Showing
7 changed files
with
3,913 additions
and
3 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
6 changes: 6 additions & 0 deletions
6
test_programs/execution_success/global_var_regression_entry_points/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,6 @@ | ||
[package] | ||
name = "global_var_regression_entry_points" | ||
type = "bin" | ||
authors = [""] | ||
|
||
[dependencies] |
2 changes: 2 additions & 0 deletions
2
test_programs/execution_success/global_var_regression_entry_points/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,2 @@ | ||
x = 0 | ||
y = 1 |
3,842 changes: 3,842 additions & 0 deletions
3,842
test_programs/execution_success/global_var_regression_entry_points/src/consts.nr
Large diffs are not rendered by default.
Oops, something went wrong.
60 changes: 60 additions & 0 deletions
60
test_programs/execution_success/global_var_regression_entry_points/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,60 @@ | ||
mod consts; | ||
use consts::EXPONENTIATE; | ||
|
||
fn main(x: Field, y: pub Field) { | ||
/// Safety: testing context | ||
unsafe { | ||
assert(entry_point_only_const_global(x) == 2); | ||
check_acc_entry_point(x, y); | ||
assert(entry_point_only_const_global(x) == 2); | ||
entry_point_inner_func_globals(x as Field, y); | ||
// NOTE: We want a lot of these calls to display clearly | ||
// that execution time has not been tainted by accidentally initializing globals | ||
// for entry points which do not use them. | ||
assert(entry_point_no_globals(x, y) == 1); | ||
assert(entry_point_no_globals(x, y) == 1); | ||
assert(entry_point_only_const_global(x) == 2); | ||
assert(entry_point_only_const_global(x) == 2); | ||
assert(entry_point_only_const_global(x) == 2); | ||
assert(entry_point_only_const_global(x) == 2); | ||
assert(entry_point_only_const_global(x) == 2); | ||
assert(entry_point_no_globals(x, y) == 1); | ||
assert(entry_point_no_globals(x, y) == 1); | ||
assert(entry_point_no_globals(x, y) == 1); | ||
} | ||
} | ||
|
||
unconstrained fn check_acc_entry_point(x: Field, y: Field) { | ||
let mut acc: Field = 0; | ||
for i in 0..2 { | ||
for j in 0..2 { | ||
acc += EXPONENTIATE[i][j]; | ||
} | ||
} | ||
assert(!acc.lt(x)); | ||
assert(x != y); | ||
|
||
assert(inner(x + 1) == 2); | ||
} | ||
|
||
fn inner(x: Field) -> Field { | ||
x + 1 | ||
} | ||
|
||
unconstrained fn entry_point_only_const_global(x: Field) -> Field { | ||
inner(x + 1) | ||
} | ||
|
||
unconstrained fn entry_point_no_globals(x: Field, y: Field) -> Field { | ||
x + y | ||
} | ||
|
||
unconstrained fn entry_point_inner_func_globals(x: Field, y: Field) { | ||
one_more_wrapper(x, y); | ||
} | ||
|
||
unconstrained fn one_more_wrapper(x: Field, y: Field) { | ||
check_acc_entry_point(x, y); | ||
check_acc_entry_point(x, y); | ||
check_acc_entry_point(x, y); | ||
} |
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
784a562
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.
Possible performance regression was detected for benchmark 'Execution Time'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold
1.20
.sha256_regression
0.078
s0.051
s1.53
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench