-
Notifications
You must be signed in to change notification settings - Fork 225
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
SSA Refactor: Handle merging slice values #1889
Comments
@vezenovm what is the status of this issue? |
@kevaundray still open |
Just checking in to see when you're planning to work on this issue? |
@iAmMichaelConnor I am taking a look today. But I can't give a solid time estimate right now as it is not a simple issue. I do know it won't be solved by end of the week or even start of next week most likely. |
No worries - that's good to know :) |
We might want to reconsider indexing of slice insert/remove at the SSA level. We are currently using user-level indices (not multiplied with element_size). This is inconsistent with array accessing on SSA, which uses flattened indexing! |
@sirasistant was the issue you're referencing not fixed by #2150? |
I think that PR fixed it for slice op simplifications, but for slice ops that are not simplified (which is supported in brillig) there still is an inconsistency |
Yes, just confirmed in master:
Generates this ssa:
|
@sirasistant I think we should look into fixing this in brillig since the SSA itself seems correct to me. Those are the arguments For consistency it could go either way. You could argue if the indices in slice remove don't account for structs then it's inconsistent with the indices for array accesses. Or you could argue if they did account for structs then slice_remove and friends would be inconsistent with other function calls where the arguments are unchanged. |
Oh, this is already handled in brillig, it's just issuing a multiplication. It's just that it was unexpected to see a "user level" index arrive for slice ops when it doesn't for array indices. But yeah It's different because slice ops are intrinsics 🤔 |
I was thinking about changing it to have the intrinsics be expanded into multiple calls on the case of structs (what simplify_instruction does currently) during ssa-gen, but I don't think it's possible after all since you'd need to do it on a function call but don't always know what function you're calling. E.g. let f = if x { slice_remove } else { foo };
let slice = f([], 7); |
@iAmMichaelConnor This is now merged into master. I am moving onto using dynamic indices with slices, and once that is complete slices will be fully supported. If you don't need dynamic indexing immediately your team could start transitioning to using slices. |
@iAmMichaelConnor I would hold off on switching to slices just yet. We have found a bug here (#2599) that would most likely cause issues for you. There is a potential fix I am hoping resolves this quickly, but if the fix turns out to not be viable it will most likely not be a simple issue. |
Problem
Slice values currently cannot be merged from separate basic blocks. See this panic here This essentially means that slices cannot be supported in if statements where the condition uses a witness. This is a big missing feature and we cannot fully release slices and the new SSA until this is resolved.
Happy Case
I should be able to do this:
Alternatives Considered
N/A
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: