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
Support for dynamic indices is included in this PR (#2446). However, it still has a missing feature with handling dynamic indices for the SliceInsert and SliceRemove intrinsics. Implementing SliceInsert and SliceRemove with non-const inputs is not as straightforward as the other slice intrinsics in ACIR gen.
A more involved codegen will be required. In both SSA gen and ACIR gen, slice intrinsicssimplifications could be performed in most cases with the im::Vector builtins. Without a constant index, the im::Vector builtin cannot be used, and an equivalent codegen of the insert and remove methods will most likely be required.
Happy Case
We can use insert and remove on slices with witness values.
For example, this should be enabled:
fn main(x: Field) {
let mut slice = [];
for i in 0..5 {
slice = slice.push_back(i);
}
slice = slice.insert(x - 2, 20);
assert( ... );
}
Alternatives Considered
If this is not implemented the feature will just be missing.
Additional Context
No response
Would you like to submit a PR for this Issue?
No
Support Needs
No response
The text was updated successfully, but these errors were encountered:
I think an approach I'd like for this bug and one direction I strongly want to move towards in the future is to have a compiler error for unimplemented features like this so that users do not randomly encounter these crashes.
For example, for here I think we can add a std::assert_constant(index) within our slice insert and remove methods in the standard library. This should give users a nicer error while we're trying to implement it in the meantime.
# Description
## Problem\*
Resolves#2462
## Summary\*
This PR simply builds upon #3617
by including some tests that use a dynamic index on SliceInsert and
SliceRemove.
## Additional Context
## Documentation\*
Check one:
- [ ] 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.
Problem
Support for dynamic indices is included in this PR (#2446). However, it still has a missing feature with handling dynamic indices for the SliceInsert and SliceRemove intrinsics. Implementing SliceInsert and SliceRemove with non-const inputs is not as straightforward as the other slice intrinsics in ACIR gen.
A more involved codegen will be required. In both SSA gen and ACIR gen, slice intrinsicssimplifications could be performed in most cases with the
im::Vector
builtins. Without a constant index, theim::Vector
builtin cannot be used, and an equivalent codegen of theinsert
andremove
methods will most likely be required.Happy Case
We can use insert and remove on slices with witness values.
For example, this should be enabled:
Alternatives Considered
If this is not implemented the feature will just be missing.
Additional Context
No response
Would you like to submit a PR for this Issue?
No
Support Needs
No response
The text was updated successfully, but these errors were encountered: