-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Complex slice inputs for dynamic slice builtins (#3617)
# Description ## Problem\* Resolves #3364 ## Summary\* This PR heavily changes the way slice intrinsics are implemented in ACIR gen. Following the `fill_internal_slices` pass nested slices now have dummy data automatically attached to them to enable known sizes to be used when fetching from an array with nested slices. Most of the slice intrinsics were written for non-complex inputs and also did not account for the addition of already included dummy data. With dummy data already included we cannot simply push back or push front elements for example, we need to make sure we do not alter the size of the internal slice we are using. The slice intrinsic implementations essentially treat the input already as a dynamic array and perform the appropriate memory operations upon them. I considered alternatives and went with what I think is the most efficient way to implement these intrinsics, however, there is definitely room for cleanup and in the name of getting a first iteration working, we can consider how to optimize these intrinsics in another PR. I have added comments in the ACIR gen itself to help with some of the logic for the implementation, but do let me know if something is not clear and I can document it further. The `fill_internal_slices` pass now also accounts for slice constants passed as inputs to slice intrinsics as these must also be filled with dummy data when they are being attached to a nested slice. ## Additional Context A bug was found in the `fill_internal_slices` pass that was necessary to resolve this issue. Essentially the children fetched from a slice were not being accurately tracked when an `array_get` occurs. This fix is included in this PR as it did not come up until more complex operations with nested slices were attempted. SliceInsert and SliceRemove now use a dynamic index. I only tested using a constant index in this PR and will have a followup PR that shows this tested out as this PR is already large enough. ## 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. --------- Co-authored-by: Tom French <[email protected]> Co-authored-by: Tom French <[email protected]> Co-authored-by: jfecher <[email protected]>
- Loading branch information
1 parent
8b7c5aa
commit 8b23b34
Showing
7 changed files
with
911 additions
and
165 deletions.
There are no files selected for viewing
This file contains 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.