chore: replace array operation on 0-len arrays with side effect assertion#9050
chore: replace array operation on 0-len arrays with side effect assertion#9050
Conversation
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: 12e7b91 | Previous: 3172cf8 | Ratio |
|---|---|---|---|
test_report_AztecProtocol_aztec-packages_noir-projects_noir-protocol-circuits_crates_blob |
202 s |
168 s |
1.20 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
TomAFrench
left a comment
There was a problem hiding this comment.
From looking at the intepreter logic, it returns Value::uninitialized on any read when the predicate is inactive whereas this PR only handles zero length arrays.
Maybe in Instruction::simplify we can check if the array argument of ArrayGet/Set's length is 0, and if so replace it with an assert false there? Then again I think that wouldn't work either since the result would be a different type. Per Tom's comment, the SSA interpreter is just meant to match the SSA so when we fix this we could apply it to the interpreter as well. E.g. return |
|
Indeed, that's why I said that this PR relates to #8874 instead of resolving it, because it did not resolve it. I just updated the interpreter in order to have a similar behaviour than what acir-gen is doing. |
|
related #9195 |
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: 2ebafd8 | Previous: 92f56e7 | Ratio |
|---|---|---|---|
semaphore-depth-10 |
0.025 s |
0.019 s |
1.32 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
|
@TomAFrench need a re-review here |
Description
Problem*
Related to #8874
Summary*
Array operations on 0-length arrays are replaced by an assertion on the 'side-effects-enabled'
Additional Context
I tried to do it with a ssa pass, but it seemed overkill for an uncommon case (it cannot use the 'simple optimisation' pass) . I end up doing this transformation directly in acir-gen.
Documentation*
Check one:
PR Checklist*
cargo fmton default settings.