-
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
[mono][amd64] Pass and return SIMD values in SIMD registers. #93182
Conversation
ee2220b
to
7098675
Compare
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
Can't reproduce the x64 failures. |
05d0b47
to
0672fb3
Compare
/azp run runtime |
Azure Pipelines successfully started running 1 pipeline(s). |
if (*fr >= FLOAT_PARAM_REGS) { | ||
pass_on_stack = TRUE; | ||
} else { | ||
ainfo->storage = ArgSIMDInSSEReg; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it intentional this doesn't match the native ABI for the platform?
There are particular rules for when and how certain SIMD types are passed depending on the ABI of the underlying platform (Windows x64, Unix SysV, etc).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just an experiment right now, it has many problems, including this one.
b25cc4b
to
53abde4
Compare
/azp run runtime |
Azure Pipelines successfully started running 1 pipeline(s). |
53abde4
to
327537b
Compare
327537b
to
913be6d
Compare
Remaining issues:
|
@vargaz What happens if gsharedvt is used, will we fallback and use none SIMD regs as we did before this PR or will just not when having SIMD types in parameters or return type? |
I will look into windows support for this, working on it in a downstream repro to see how it behaves and will then upstream. Don't think that should block us from progressing on this PR. |
c871a75
to
61dc12c
Compare
Another significant problem is that the generic instances used by generic sharing like Vector<T_INT> are not marked as simd types, so for |
I guess it will be possible for caller to detect this scenario and choose calling convention accordingly? |
XMOVE can be optimized away which creates problems if the argument is on the stack, since mono_spill_global_vars () doesn't process call arguments, it only processes the move instructions before it. If a normal argument is on the stack, it means its volatile/indirect, so its move is not optimized away, but for simd args, they can become indirect when the xcall opcode is decomposed which can happen after the xmove was optimized away, so we end up with code like: ``` ldaddr R19 <- R20 vcall2 voidcall [..] [s:xmm0 <- R20] ```
61dc12c
to
d89493a
Compare
So it looks like gshared support for the simd types cannot really be enabled right now, because gsharing for primitive types works by erasing the difference between primitive types and enums, so a Vector128<T_INT> can be instantiated by both an int an enums whose base type is int, but the simd types don't allow enum element types.
will no longer throw an exception.
|
Closing for now. |
No description provided.