fix(ssa): Do not remove array operations that can be OOB during DIE #9232
Conversation
Changes to Brillig bytecode sizes
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
Changes to number of Brillig opcodes executed
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
Changes to circuit sizes
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Opcode count'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.10.
| Benchmark suite | Current: efbe355 | Previous: 39a8379 | Ratio |
|---|---|---|---|
private-kernel-reset |
83598 opcodes |
68865 opcodes |
1.21 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
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.
| Benchmark suite | Current: 4a1d68d | Previous: 3c18e33 | Ratio |
|---|---|---|---|
sha512-100-bytes |
0.115 s |
0.056 s |
2.05 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Test Suite Duration'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.
| Benchmark suite | Current: 4a1d68d | Previous: 3c18e33 | Ratio |
|---|---|---|---|
test_report_AztecProtocol_aztec-packages_noir-projects_aztec-nr |
132 s |
5 s |
26.40 |
test_report_AztecProtocol_aztec-packages_noir-projects_noir-contracts |
151 s |
42 s |
3.60 |
test_report_AztecProtocol_aztec-packages_noir-projects_noir-protocol-circuits_crates_blob |
200 s |
3 s |
66.67 |
test_report_AztecProtocol_aztec-packages_noir-projects_noir-protocol-circuits_crates_private-kernel-lib |
263 s |
1 s |
263 |
test_report_AztecProtocol_aztec-packages_noir-projects_noir-protocol-circuits_crates_reset-kernel-lib |
33 s |
2 s |
16.50 |
test_report_AztecProtocol_aztec-packages_noir-projects_noir-protocol-circuits_crates_rollup-lib |
666 s |
3 s |
222 |
test_report_AztecProtocol_aztec-packages_noir-projects_noir-protocol-circuits_crates_types |
126 s |
1 s |
126 |
test_report_zkpassport_noir-ecdsa_ |
112 s |
3 s |
37.33 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
|
I took a look at the cause of the regressions in this PR and it seems to be down to us now having a lot of instructions would have been removed by die which are sitting under a constant zero predicate. It's a bit annoying to deal with these in die (as we'd need to do lookahead to determine the predicate). Chucking a |
Which ones do you see are sitting under a constant zero? Some of the circuit regressions look to be unavoidable without extra handling in DIE. We may have to bring back some form of the OOB checks inserted during DIE that were removed in #7995. For example this program taken from pub struct Data {
fields: [Field; 1],
counter: u32,
}
fn main(array: [Data; 1], x: bool) {
let index = if x { 0 } else { 1 };
if index != 0 {
assert(array[index - 1].counter < 3);
}
}Produces this SSA: Previously we would remove |
|
More details in #9275, tl;dr is that this is a no_predicates issue. |
|
I'm looking at bring back removing unused array get groups during DIE. |
This is showing to be promising. |
Co-authored-by: Maxim Vezenov <mvezenov@gmail.com>
|
huh, sorry I seem to have broken this. |
59fcd88
into
tf/optimize-array-access-checks
Description
Problem*
Resolves #9223
Summary*
Builds off of #9200
This replaces #9220 which branches off master. The motivation to have these changes branch off one another is that we have several test failures triggerd by #9200 (the original parent PR). We can more easily get a passing CI but having any fixes built off one another.
Additional Context
Documentation*
Check one:
PR Checklist*
cargo fmton default settings.