-
Notifications
You must be signed in to change notification settings - Fork 250
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
fix(ssa): Check arrays used as a terminator argument in the RC tracker #7165
fix(ssa): Check arrays used as a terminator argument in the RC tracker #7165
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 👇
|
f1342c9
to
ec002e2
Compare
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.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Compilation Time'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20
.
Benchmark suite | Current: 55b75cf | Previous: 2d415ca | Ratio |
---|---|---|---|
rollup-block-root-single-tx |
110 s |
89.7 s |
1.23 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
dd04047
to
b8b5935
Compare
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.
Awesome, thanks!
Changes to circuit sizes
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
Looking at the increase in the opcodes executed, one difference between this and mine is that I only did the special treatment during the preprocessing, but when the functions were fully inlined it was removed. Do you reckon something like that for the final pass (maybe piggybacking on the |
Ah yes good call out. I think we can do that as a follow-up optimization as we want will want to have some better tests around under what circumstances we do not check the terminator (e.g. are we actually fully inlined?). For now, let's just get this fix in. |
I tried commenting out preprocessing and the terminator marking separately and together and they did not make a difference in the output of this:
|
It's probably down to the change in the change in rules in which functions to preprocess. |
Description
Problem*
Resolves failures in AztecProtocol/aztec-packages#11294 from the preprocessing pass. #7163 is a bit too conservative with marking that we should keep the inc rcs on any parameters. Doing so happens to also fix the test case, but marking arrays passed to terminators is the more accurate fix for how the RC tracker should be looking at mutated arrays.
Summary*
We want to make sure we do not remove inc rcs on arrays that are potentially mutated elsewhere. To do so, we check whether an array was passed to a store instruction or a call. We used to only run DIE (which removes these RCs) at the end of the SSA optimizations where we were aggressively inlining.
Now that we are starting to process functions in isolation we triggered a bug as outlined here AztecProtocol/aztec-packages#11294 (comment). We need to account for whether an array is used in a terminator argument such as a return as that returned array may be mutated later.
Additional Context
Will need to add a new test making sure we do not remove an inc rc on an array type used in a terminator argument.
Documentation*
Check one:
PR Checklist*
cargo fmt
on default settings.