-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test slice_dynamic_index
fails with inliner = -Inf and brillig
#6444
Comments
Reduced the program to bring out the problem to this: fn main(x: Field) {
// The parameters to this function must come directly from witness values (inputs to main).
regression_dynamic_slice_index(x - 1, x - 4);
}
fn regression_dynamic_slice_index(x: Field, y: Field) {
let mut slice = &[];
for i in 0..5 {
slice = slice.push_back(i as Field);
}
assert(slice.len() == 5);
dynamic_slice_index_set_if(slice, x, y);
dynamic_slice_index_set_else(slice, x, y);
}
fn dynamic_slice_index_set_if(mut slice: [Field], x: Field, y: Field) {
slice[y] = 0;
assert(slice[y] == 0);
assert(slice[x] == 4);
}
fn dynamic_slice_index_set_else(mut slice: [Field], x: Field, y: Field) {
assert(slice[x] == 4);
assert(slice[y] == 1);
if x as u32 > 10 {
slice[x] = slice[x] - 2;
slice[x - 1] = slice[x];
} else {
slice[x] = 0;
}
assert(slice[4] == 0);
} It looks like the second function expects that ❯ cargo run -q -p nargo_cli -- --program-dir . execute --force --force-brillig --inliner-aggressiveness -9223372036854775808
error: Failed to solve program: 'Failed to solve brillig function'
┌─ /Users/aakoshh/Work/aztec/noir/test_programs/execution_success/slice_dynamic_index/src/main.nr:25:12
│
25 │ assert(slice[y] == 1);
│ -------------
│
= Call stack:
1. /Users/aakoshh/Work/aztec/noir/test_programs/execution_success/slice_dynamic_index/src/main.nr:3:5
2. /Users/aakoshh/Work/aztec/noir/test_programs/execution_success/slice_dynamic_index/src/main.nr:14:5
3. /Users/aakoshh/Work/aztec/noir/test_programs/execution_success/slice_dynamic_index/src/main.nr:25:12
Failed to solve program: 'Failed to solve brillig function' If we run it with |
The SSA for the failing case with inliner = After Array Set Optimizations:
The problem is similar to #6349 In the comments Alvaro noted that:
Similarly here we have:
My interpretation is that the shared slice |
Aim
Trying to run
test_programs
with different--inliner-aggressiveness
in #6429Expected Behavior
Tests under
execution_success
should work.Bug
To Reproduce
cd test_programs/execution_success/slice_dynamic_index
nargo execute --force --force-brillig --inliner-aggressiveness -9223372036854775808
Workaround
None
Workaround Description
No response
Additional Context
No response
Project Impact
None
Blocker Context
No response
Nargo Version
nargo version = 0.36.0 noirc version = 0.36.0+2f0cb3e80f3d93a1dee77fffacc397811e300257 (git version hash: 2f0cb3e, is dirty: false)
NoirJS Version
No response
Proving Backend Tooling & Version
No response
Would you like to submit a PR for this Issue?
None
Support Needs
No response
The text was updated successfully, but these errors were encountered: