-
Notifications
You must be signed in to change notification settings - Fork 76
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
Detaching multiple regions from an operation breaks that op #3478
Comments
Something like this works: optional_region1 = op.optional_region1
optional_region2 = op.optional_region2
op.detach_region(op.non_optional_region)
op.detach_region(optional_region1)
op.detach_region(optional_region2) |
Indeed, it looks like the IRDL wrapper should take this into account and update the |
CC @math-fehr |
Hmm, I'm actually not sure how to deal with that one, because that's fundamental on how operations are actually defined. That's actually not specific to regions btw, you will also see this for operands or results. So the problem is, how do you get I somehow feel we have the wrong API to detach regions, because as soon as we detach regions, we break |
So, if I understood correctly, there are two states an operation can be in: A "verified" state in which it is after verification in which it should work and a "modified" state, where no guarantees can be made? Maybe we can embrace this a bit by removing the "detach" functions and adding a "dissolve" function instead that dissolves an operation into its constituent parts which can then be re-used. This would be useful during rewriting where you don't need the old op anymore, but you also don't want to clone everything to keep performance up. Alternatively we could replace a detached region with a "poison" object that keeps the number of regions the same but causes verification to fail. This would allow detaching several individual things from an operation. |
Yes that's kind of it, whenever you start modifying an operation, you might enter a place where the operation doesn't verify anymore. The difficulty though, is that sometimes you can detach a region without it being incorrect. For instance, if you have a variadic number So yeah, maybe I think one thing we should maybe do is prefer using functions that move region contents, rather than removing the region (and removing the region only when necessary). |
raises an exception:
Interesting thing to note is that the exception is not raised while removing it, but seemingly while accessing op.optional_region2.
It seems to me that some internal data structures are not updated during detach_region (?).
The text was updated successfully, but these errors were encountered: