-
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
Specific AVX2 intrinsic inlining generates faulty x64 code #12835
Comments
Checked JIT asserts:
|
CC. @CarolEidt |
Same old problem - duplicate logic between lowering/LSRA/codegen. Lowering is deciding when something can be contained and then LSRA and codegen attempt to replicate its decision instead of just obeying what was already decided. And getting it wrong in the process. In this case lowering has special logic for I would expect that both LSRA and codegen notice that the operand is a contained address mode and do the right thing. What they instead is attempting to guess if the operand might be a contained address mode. |
cc @dotnet/jit-contrib. @CarolEidt is this something you plan to work on? |
@CarolEidt If you're busy with something else I think I can fix this later today. Let me know. |
@mikedn - thanks, but I can take a look at this (unless you're eager to do it - just let me know!) |
I think I'm going to take a look to see if it's possible to remove the duplicate logic between lowering/LSRA/codegen. However, I expect that to be a more intrusive fix and it's probably not the right time for that. |
This adds an LEA case to both `LinearScan::BuildOperandUses` and `CodeGen::genConsumeRegs`. Fix #25039
This adds an LEA case to both `LinearScan::BuildOperandUses` and `CodeGen::genConsumeRegs`. Fix #25039
* Fix contained LEA handling This adds an LEA case to both `LinearScan::BuildOperandUses` and `CodeGen::genConsumeRegs`. Fix #25039
I have a short sequence of code that seems to generate faulty x64 code (and crashes the program).
I'm using the latest SDK bits as of this time as suggested by @tannergooding,
dotnet --info
says:.NET Core SDK (reflecting any global.json): Version: 3.0.100-preview7-012287 Commit: f202b59402 Runtime Environment: OS Name: ubuntu OS Version: 19.04 OS Platform: Linux RID: ubuntu.19.04-x64 Base Path: /home/dmg/dotnet/sdk/3.0.100-preview7-012287/ Host (useful for support): Version: 3.0.0-preview7-27806-02 Commit: 90a101062a .NET Core SDKs installed: 2.1.603 [/home/dmg/dotnet/sdk] 2.1.700 [/home/dmg/dotnet/sdk] 3.0.100-preview5-011568 [/home/dmg/dotnet/sdk] 3.0.100-preview7-012287 [/home/dmg/dotnet/sdk] .NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.11 [/home/dmg/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.11 [/home/dmg/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.0.0-preview5-19227-01 [/home/dmg/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.0.0-preview7.19306.7 [/home/dmg/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.10 [/home/dmg/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.11 [/home/dmg/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 3.0.0-preview5-27626-15 [/home/dmg/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 3.0.0-preview7-27806-02 [/home/dmg/dotnet/shared/Microsoft.NETCore.App] To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download
I have a complete-repro project setup for this issue.
The faulty code (as seen from lldb disassmbly is):
In this fragment,
esi
is initially the index into the permutation table I'm trying to load/convert, and is left shifted by 3 (as each entry is 8 bytes), but is then overwritten with the base address for the permutation table.At this stage, the
vpmovzxbd [rsi + rsi]
is obviously totally bonkers and thankfully generated s segfault...I think that the bug might be related to the base-address of the permutation array being a
ReadOnlySpan<byte>
embedded inside the executable, thanks to C# 7.3, as it seems the JIT is trying to correctly optimize it as aconstant
address during the compilation, but I could also be completely wrong about that last part.Perviously @tannergooding opened up #25008, which is somewhat related to this issue as it related to how the offset calculation is expressed in the generated code.
The text was updated successfully, but these errors were encountered: