-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Ensure side effects get spilled for the various hwintrinsic and simdashwintrinsic nodes #70054
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
|
Tagging subscribers to this area: @JulieLeeMSFT Issue DetailsThis resolves #54956
|
|
I remember there was some number of runtime/src/coreclr/jit/gentree.cpp Lines 18902 to 18904 in 187bb1f
They need to be dealt with in some way, as it is very surprising (-- prone to creating subtle bugs) for a Additionally, it would be nice to add tests for all affected intrinsics (not just |
|
@fanyang-mono, could you point me to where Mono makes decisions about side effects? It looks like it has the same issue where its incorrectly re-ordering parameters for some intrinsics. |
I was able to reproduce the issue locally with fullaot. I need some time to investigate and will get back to you tmr. |
|
This will fix the mono failure: |
|
#70308 has merged, we should try re-running failing mono lanes |
|
/azp run runtime |
|
Azure Pipelines successfully started running 1 pipeline(s). |
I agree, I'll log a new issue to track them since they are impacted a different way and will require different handling.
I'll work on adding these. |
|
CC. @dotnet/jit-contrib |
|
Ping @dotnet/jit-contrib Would be good to get this in for 7 to help ensure code works as users expect without accidental side effect re-ordering. |
AndyAyersMS
left a comment
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.
Seems risky to selectively spill like this. If you have a bigger tree of intrinsics where many leaf operands can throw it seems like you could still reorder exceptions between operands at different levels.
|
@AndyAyersMS do you have an example? Shouldn't |
|
We don't generally rely on it elsewhere; it is mainly called from Test case would be something along these lines (might need to fiddle a bit to get it right). Call with [MethodImpl(MethodImplOptions.NoInlining)]
static Vector128<int> SideEffectsTree_Sse2_ShiftLeftLogical(Vector128<int>[] left, byte* right, int d)
{
if (Sse2.IsSupported)
{
return Sse2.ShiftLeftLogical(Sse2.ShiftLeftLogical(left[0], *right), 5 / d)); |
|
@AndyAyersMS, not sure I understand.
So for For most of these intrinsics we have a binary case where we need to swap operand 1 and 2. So we only check if
|
|
Hmmm. I guess, if the stack had 3 operands and the unrelated operand had side effects that could be problematic. In which case we'd want Is that a concern here? The stack should normally be balanced, right? |
|
Looking at it some more I think what you have will be ok, if there are more levels to the tree, you'll just accumulate more op1 spills along the way. Eg if abstractly there is some tree like |
This resolves #54956