feat: Merging nested slices in if statements based upon witness conditions#3979
Closed
feat: Merging nested slices in if statements based upon witness conditions#3979
Conversation
… heavy cleanup still needed
…y modify the predicate index for the non-dummy val
…et element type size array correct
…nd flattening pass
Contributor
Changes to circuit sizes
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
Contributor
|
After an internal meeting we agreed to shelve nested slices for the moment and eventually write a check to disable them either in the frontend or some time after monomorphizaiton. Since we'll be removing nested slices code eventually (although potentially only temporarily), I'm closing this PR. |
This was referenced Jan 11, 2024
Closed
AztecBot
pushed a commit
that referenced
this pull request
Jan 12, 2024
subrepo: subdir: "noir" merged: "945587396" upstream: origin: "https://github.com/noir-lang/noir" branch: "aztec-packages" commit: "d7c4c669c" git-subrepo: version: "0.4.6" origin: "???" commit: "???"
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jan 16, 2024
# Description ## Problem\* Resolves #4017 ## Summary\* After this PR #3979 and an internal discussion we have decided to temporarily block nested slices. This PR adds a check in the frontend and in the SSA against nested slices. The check in the frontend makes sure any struct fields with a nested slice (but without generics) are not blocked as well as any type declarations with nested slices. In order to account for generics in structs we also have a checked array codegen that makes sure we do not have a nested slice. ## Additional Context The actual nested slice code in the ACIR gen is somewhat intertwined so I felt it would be best for a separate PR which will be a followup to this one. ## Documentation\* Check one: - [] No documentation needed. - [X] Documentation included in this PR. - [ ] **[Exceptional Case]** Documentation to be submitted in a separate PR. # PR Checklist\* - [X] I have tested the changes locally. - [X] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings.
This was referenced Feb 1, 2024
github-merge-queue bot
pushed a commit
that referenced
this pull request
Feb 8, 2024
# Description ## Problem\* Resolves #4202 and #2446 (comment) ## Summary\* This PR brings back the `capacity_tracker` that was used by the fill internal slices pass and for merging nested slices (#3979). We now track the capacity of slices as we insert instructions. The capacity tracker has also been simplified as it no longer needs to handle nested slice. The current strategy checks for previously saved store instructions and backtracks the instructions to see what is the capacity of a slice when it comes time to merge two slice values. This required an additional `outer_block_stores` map as we `store_values` only track stores within the current branch that is being inlined, and a `get_slice_length` method that ultimately did the recursive backtracking to determine the slice length. With the capacity tracker we already have the slice length once it comes time to perform a slice merger allowing us to remove `outer_block_stores` and `get_slice_length`. Overall, the capacity tracker enables us to have more accurate tracking of slice capacities and gives us a more general strategy for tracking a slice capacity per instruction. ## Additional Context ## Documentation\* Check one: - [X] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[Exceptional Case]** Documentation to be submitted in a separate PR. # PR Checklist\* - [X] I have tested the changes locally. - [X] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings. --------- Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 #3188
Summary*
This PR enables nested slices to be used with if statements based upon witness conditions. It does this by moving out the slice capacity tracker from the
fill_internal_slicespass into its own instance that is updated by calling thecollect_slice_informationfunction. We are able to tracked specific instructions from flattening that we then need to appropriately fetch a slice's len during merging of slice values. This enabled us to get rid of usingstore_values,outer_store_values, and theget_slice_lengthfunctions in theValueMergerduring flattening. Instead we track the slice length as we go through flattening and then fetch it directly from the slice capacity map.I had some trouble getting the merging of nested slices to work with an optimized strategy that tracked the specific max nested slice size that is used. I think this could be done in a followup if we decide to enable nested slices for the public. I have some ideas of how to optimize and will put this into an issue.
Although inefficient, this PR does show a PoC that nested slices can be fully supported in ACIR.
Additional Context
Documentation*
Check one:
PR Checklist*
cargo fmton default settings.