-
Notifications
You must be signed in to change notification settings - Fork 4.7k
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
RyuJIT: tail call stress assert in importer on Linux #7586
Comments
@AndyAyersMS : @sivarv said you recent touched code in this area. Perhaps that is at fault? Want to investigate? (I don't know if this is a regression or not) |
Seems likely it was my change dotnet/coreclr#9405 which identifies implicit tail call candidates from inlined code. A quick look at the code makes me wonder if it is a stress mode only bug -- a stress-mode specific update may be missing for the new cases. Will take a look, though it may be a few days before I get around to it. |
Having trouble getting testing going again on my Ubuntu box... not sure what changed but coreclr fails to initialize. |
Ok, finally can repro.... not sure this has anything to do with my changes but will investigate. |
Issue is that with UNIX ABI, for methods returning |
If we think the assert adds value, then we can fix it by using And if we want to find the appropriate ABI type on the callee side we'll need to duplicate/refactor the logic in |
@BruceForstall any thoughts on where we should go here? Options are:
|
It feels to me we should just use the precise |
Unfortunately comparing |
Do you have an example where that is true? |
Sure. Looks like if the return type gets passed back by reference then callee's type has already been updated.
|
@AndyAyersMS @BruceForstall Is this just a case of an incorrect assertion? Should we disable/weaken the assertion or disable a test for now to get things green(er) and leave this issue open to resolve it later? |
Yes, it seems most likely that the assertion is incorrect. ABI lowering happens at different "rates" for the root method and its callees so getting the assert right here may need to take that more fully into account. However it is hard to reconcile the assert-is-incorrect hypothesis with just one test failure -- you'd expect more widespread impact. Perhaps the fact that just one test fails is is telling us that test case ABI coverage for SIMD types is not as diverse as we'd hope. But tail call stress is kind of an odd stress mode and I can't yet rule out that it may be an issue with the way the stress mode is implemented or that the assert failure is hinting at an actual problem. So I think we should keep looking at this. |
Realized why SquareRoot is special -- for So all that explains why the assert only happens in this one case, and that there's no underlying bug and nothing else nefarious going on that I can see. A simple fix is to modify [edit: realized that we only tail call here on Windows, not on Unix, so reworded the first paragraph a bit; see below]. |
Wasn't entirely satisfied yet so kept looking. The root cause of the problem is that in #ifdef FEATURE_UNIX_AMD64_STRUCT_PASSING
...
// The return type will remain as the incoming struct type unless normalized to a
// single eightbyte return type below.
call->gtReturnType = call->gtType; The net effect is that for simd types we change the type from simd to struct here. So this leads to the assert in morph firing because the callee's return type has diverged from the caller's. So one fix is to do what I suggested above and update In both cases we ultimately (on Unix) don't tail call, whereas we do on Windows. I don't know this ABI as well as I do the Windows case so I can't say if we're overly conservative here or not. This might be something worth investigating because it seems like we're introducing an unnecessary copy. But perhaps it has to be this way. Fixing |
If class handles match, the return types are compatible, no matter what the jit types indicate. Addresses #10047.
Will propose the simple fix for now. |
Assert will no longer fire in this case, but we might want to revisit this down the road. So moving to future and keeping it open. |
Closing this since it seems stale and we had a fix already. |
With
COMPlus_TailcallStress=1
, on non-Windows (Ubuntu, Mac, CentOS), the following assertion fires:in test JIT/SIMD/SqrtGeneric_r/SqrtGeneric_r.sh
You can trigger these with:
category:correctness
theme:tail-call
skill-level:intermediate
cost:medium
The text was updated successfully, but these errors were encountered: