-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
JIT: Support assignments of multi-reg values to enregistered promoted structs #34105
Comments
@terrajobst - The idea of having an intrinsic return a |
Tuples: we can use tuples in APIs and as of recently we did in a few cases. The general guidance is: don't use them as parameters and only use them when the number of values if 4 or less and we're sure we never need to add more. For the most part, we prefer custom structs because we can add members. |
Thanks @terrajobst. I'll proceed on the assumption that tuples would be a reasonable way to address the problem of returning multi-register values in intrinsics. |
A possible downside of tuples would be it takes the good name if we have a better type in the future. For example, I don't think this should be a blocker, but it is something we might want to take into consideration when proposing these APIs. |
@tannergooding - we already have that issue. I'm experimenting with supporting |
I think it was to mirror the C/C++ API actually: https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=mulx |
The fundamental issue here is that we need to be able to take a result from a single node that produces multiple registers, and assign them to the corresponding fields of a promoted struct. This is supported reasonably well currently when the target is going to be in memory anyway (on stack or otherwise). However when the target is a local struct that otherwise could be in registers, we force it to memory. Multi-reg localVars
@dotnet/jit-contrib - thoughts? P.S. There may be a better place for this discussion (suggestions welcome). |
I am experimenting with it as well, but my case is simpler:
I was trying to substitute all manipulations with the parent LCL_VAR (that should be defs only, all usages should use fields, otherwise it can't be promoted independently). It was straightforward in valuenum, harder in SSA. So I prefer option 1 with my current perspective because options 2 and 3 won't solve the case that I see (especially option 2). |
Allow struct lclVars that are returned in multiple registers to be enregistered, as long as the fields are a match for the registers. Fix dotnet#34105
* Enregister multireg lclVars Allow struct lclVars that are returned in multiple registers to be enregistered, as long as the fields are a match for the registers. Fix #34105
Allow struct lclVars that are returned in multiple registers to be enregistered, as long as the fields are a match for the registers. Fix dotnet#34105
Currently, calls or other operations (such as
MUL_LONG
on 32-bit platforms) that return multiple registers must be stored (either to the stack or elsewhere). This means that promoted structs (whose fields have been promoted to allow them to be separately tracked, optimized and enregistered) will be forced to the stack.This is the underlying issue in #5112 and #8571, but support for this would also enable
MUL_LONG
to be supported without forcing the destination to be in memory, as well as enabling hardware intrinsics such asBmi2.MultiplyNoFlags
to return aValueTuple
and allow the result to go directly to a pair of registers.category:cq
theme:structs
skill-level:expert
cost:large
The text was updated successfully, but these errors were encountered: