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
@vezenovm Mainly asking a review from you in case you know why the regressions or happenning, or why there's a const S2 = 0 that's unused.
Looking at brillig-gen, I see that convert_ssa_value will check if the value is a numeric constant, and if so check if we already have an allocation for that value. That's based on ValueId but I wonder if it could be based on F for numeric constants, then multiple values with the same constant would end up with the same allocation... (I guess we'd need to track that separately from the dictionary that tracks by ValueId). But I don't know if this is what would revert the performance regression here.
Mainly asking a review from you in case you know why the regressions or happenning, or why there's a const S2 = 0 that's unused.
My suspicion is that we perform constant allocation analysis before generating Brillig (see brillig_gen/constant_allocation.rs). We see that the zero is used according to constant analysis so we initialize the constant according to the ConstantAllocation struct we build before generating the Brillig blocks. However, we actually do not ever use the zero as we simply increment it and use the incremented value. That way to determine constants for allocation was part of what motivated making this optimization an SSA pass originally.
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 #8462
Summary
If this optimization is done as an SSA optimization then there's no way the SSA interpreter can run on the code with indexes having shifted.
Additional Context
For this program:
The old brillig was:
The new brillig is:
I understand that now we need a new constant for the offset (
S4now, previouslyS2) though I don't understand where theCONST S2 = 0comes from 🤔Documentation
Check one:
PR Checklist
cargo fmton default settings.