You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
No documentation needed.
Documentation included in this PR.
[For Experimental Features] Documentation to be submitted in a separate PR.
PR Checklist*
I have tested the changes locally.
I have formatted the changes with Prettier and/or cargo fmt on default settings.
vezenovm
changed the title
check references passed to a call in the rc tracker
fix(ssa): check references passed to a call in the rc tracker
Jan 23, 2025
vezenovm
changed the title
fix(ssa): check references passed to a call in the rc tracker
fix(ssa): Check references containing arrays passed to a call in the rc tracker
Jan 23, 2025
vezenovm
changed the title
fix(ssa): Check references containing arrays passed to a call in the rc tracker
fix(ssa): Check arrays used as a terminator argument in the RC tracker
Jan 23, 2025
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.
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 flattened flag) should be used?
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 flattened flag) should be used?
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.
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 fmton default settings.