-
Notifications
You must be signed in to change notification settings - Fork 200
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
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
Changes to circuit sizes
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
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. |
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: "???"
# 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.
# 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>
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_slices
pass into its own instance that is updated by calling thecollect_slice_information
function. 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_length
functions in theValueMerger
during 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 fmt
on default settings.