-
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
Convert some old style intrinsics to NamedIntrinsic #62271
Conversation
Tagging subscribers to this area: @JulieLeeMSFT Issue DetailsConverted:
|
Thanks for doing this, I recall there was some problem with GetType one in crossgen2 but I don't remember the details - let's see what CI thinks about it first 🙂 |
cde5ed2
to
e1a81fa
Compare
Co-authored-by: EgorBo <egorbo@gmail.com>
44c2cb9
to
638836f
Compare
@am11 LGTM, but could you please make sure it doesn't produce any diffs? because I'm a bit worried about the GetType
it's a lot of steps but unfortunately for this specific case where we want to test changes in vm instead of jit it's the only option |
Yup, I remember, not my first time though dotnet/jitutils#275 ;) |
No diffs; only textual diffs are found.
@EgorBo, some paths are changed in latest tooling (e,g |
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.
LGTM, Thanks!
@EgorBo, if there are no further comments, can this be merged? Thanks! |
src/coreclr/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs
Show resolved
Hide resolved
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
I think the |
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.
Thank you!
I will be happy to help you to work through the issues that prevent getting rid of the few remaining old-style intrinsics.
@jkotas, thank you! I have pushed the w.i.p commit to the same branch main...am11:feature/jit/namedintrinsic. Currently, it only compiles the native code, but failing on runtime. $ artifacts/bin/testhost/net7.0-Linux-Debug-x64/shared/Microsoft.NETCore.App/7.0.0/corerun \
$(pwd)/../hwapp/bin/Debug/net6.0/hwapp.dll
Stack overflow.
Repeat 261416 times:
--------------------------------
at System.Runtime.Intrinsics.X86.Sse2.get_IsSupported()
--------------------------------
at System.SpanHelpers.IndexOf(Char ByRef, Char, Int32)
at System.String.wcslen(Char*)
at System.String.Ctor(Char*)
at System.AppContext.Setup(Char**, Char**, Int32) However, first on the main branch; I am still trying to figure out a C# code sample which will make the importer detect runtime/src/coreclr/jit/importer.cpp Line 3855 in 1d4b5f6
DOTNET_JitDump=* ./corerun ... ), but I am yet to see any of the array ones. 🤔
array like intrinsics which are recognized on hello-world start startup: # runtime main branch
$ DOTNET_JitDump=* artifacts/bin/testhost/net7.0-Linux-Debug-x64/shared/Microsoft.NETCore.App/7.0.0/corerun \
$(pwd)/../hwapp/bin/Debug/net6.0/hwapp.dll | grep -i intrinsic.*recog | sort -u | grep -i array
Named Intrinsic System.Array.GetLowerBound: Recognized
Named Intrinsic System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray: Recognized
Named Intrinsic System.Runtime.InteropServices.MemoryMarshal.GetArrayDataReference: Not recognized and these are the only old style intrinsics recognized: $ DOTNET_JitDump=* artifacts/bin/testhost/net7.0-Linux-Debug-x64/shared/Microsoft.NETCore.App/7.0.0/corerun \
$(pwd)/../hwapp/bin/Debug/net6.0/hwapp.dll | grep ^Intrinsic.*Recog | sort -u
Intrinsic CORINFO_INTRINSIC_ByReference_Ctor Recognized
Intrinsic CORINFO_INTRINSIC_ByReference_Value Recognized |
You have some mix up between
These intrinsics are generated for multi-dimensional arrays. |
Thanks! All three of them are detected with this program. var x = new int[2,2];
x[0,0] = 2;
x[1,0] = 1;
unsafe
{
fixed(int *y = &x[0,0])
{
Console.WriteLine("{0}, {1}, {2}, {3}", x.GetLowerBound(0), x.GetUpperBound(1), x[1,0], (IntPtr)y);
}
} ( |
I've pushed the array intrinsic implementation to the branch. Currently, corerun is getting a sigsegv. |
Also, the last line just before the crash in jit dumps is related to stub helper:
|
I do not see anything obvious that can explain this crash by just looking at the code. Could you please open draft PR with the change to make it easy to comment on it? There are some minor issue that I would like to comment on. |
Opened #62639. |
Converted:
CORINFO_INTRINSIC_RTH_GetValueInternal
->NI_System_RuntimeTypeHandle_GetValueInternal
CORINFO_INTRINSIC_Object_GetType
->NI_System_Object_GetType
CORINFO_INTRINSIC_StubHelpers_GetStubContext
->NI_System_StubHelpers_GetStubContext
CORINFO_INTRINSIC_StubHelpers_GetStubContextAddr
->NI_System_StubHelpers_GetStubContext
CORINFO_INTRINSIC_StubHelpers_NextCallReturnAddress
->NI_System_StubHelpers_GetStubContext