-
Notifications
You must be signed in to change notification settings - Fork 5.5k
ZJIT: Allocate register for VRegs that begin and end at the same index #14270
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
Conversation
If the LiveRange looks like (idx, idx), we will currently not allocate a register. This change allocates a register and then immediately deallocates it. Fix Shopify#614
I guess this would turn what's currently an arcane crash message due to unused output to a silent transient register pressure. It's an improvement, but I'd want some feedback mechanism, maybe a But also, test failures. |
This comment has been minimized.
This comment has been minimized.
We used to control every LIR instruction in YJIT's design, so it was useful to have a notification to remove unused LIR instructions because it was easy to identify why it happens and remove it, which also helps us simplify the implementation. Now that we have an extra abstraction layer of HIR with multiple possible behaviors (HIR opt or not), I guess it's harder to remove unused instructions in ZJIT? I'm open to taking this direction, but I'd like to understand what's happening and why we need this, which I don't think are explained in Shopify#614 (comment) or Shopify#614 (comment). |
Alternatively, if this happens only when you disable the HIR optimizer, we could take this path when it's disabled, and make it panic (probably with a better message than what we see today) when it's enabled. At least for the production mode, unused instructions are something to be fixed, somewhere in HIR, LIR, or the LIR backend. |
In Shopify#614 it happens because the HIR ends up looking like this in the block:
The |
Thanks for the explanation. It makes sense to allow such LIR to be compiled then. I still want the |
We need a register to allocate to the result of the (unused) call in tests
I think you can call |
If the LiveRange looks like (idx, idx), we will currently not allocate a
register. This change allocates a register and then immediately
deallocates it.
Fix Shopify#614