-
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
[NativeAOT] Enable CI for macOS x64/arm64 #75421
Conversation
Tagging subscribers to this area: @dotnet/area-infrastructure-libraries Issue Detailsnull
|
I assume that someone will need to run appropriate |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
No pipelines are associated with this pull request. |
Thanks! |
I realized a lot of tests will fail because #75333 was not merged yet. I also should enable regular NativeAOT osx-arm64 build in the non-extra pipelines. Let's see the results first though... |
Looks like this needs fixing:
|
Yep. Not quite sure what the correct fix is but I will give it a try. |
I think we want to use clang-9 for Linux only (it is a workaround for missing clang alias in our Linux docker images). |
Yep, seems like regular |
420329b
to
2913429
Compare
The cross-compilation does not work as expected:
Do we need to pass some kind of target architecture flag to clang? |
A cross compilation flag ( Try applying this kind of a patch (untested, as I don't have mac with intel chip): --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets
+++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets
@@ -29,11 +29,12 @@ The .NET Foundation licenses this file to you under the MIT license.
<FullRuntimeName Condition="'$(ServerGarbageCollection)' == 'true'">libRuntime.ServerGC</FullRuntimeName>
<CrossCompileRid />
- <CrossCompileRid Condition="'$(TargetOS)' != 'OSX' and !$(RuntimeIdentifier.EndsWith('-$(OSHostArch)'))">$(RuntimeIdentifier)</CrossCompileRid>
+ <CrossCompileRid Condition="!$(RuntimeIdentifier.EndsWith('-$(OSHostArch)'))">$(RuntimeIdentifier)</CrossCompileRid>
<CrossCompileArch />
<CrossCompileArch Condition="$(CrossCompileRid.EndsWith('-x64'))">x86_64</CrossCompileArch>
- <CrossCompileArch Condition="$(CrossCompileRid.EndsWith('-arm64'))">aarch64</CrossCompileArch>
+ <CrossCompileArch Condition="$(CrossCompileRid.EndsWith('-arm64')) and '$(TargetOS)' != 'OSX'">aarch64</CrossCompileArch>
+ <CrossCompileArch Condition="$(CrossCompileRid.EndsWith('-arm64')) and '$(TargetOS)' == 'OSX'">arm64</CrossCompileArch>
<TargetTriple />
<TargetTriple Condition="'$(CrossCompileArch)' != ''">$(CrossCompileArch)-linux-gnu</TargetTriple>
@@ -85,7 +86,8 @@ The .NET Foundation licenses this file to you under the MIT license.
<ItemGroup>
<LinkerArg Include="@(NativeLibrary)" />
<LinkerArg Include="--sysroot=$(SysRoot)" Condition="'$(SysRoot)' != ''" />
- <LinkerArg Include="--target=$(TargetTriple)" Condition="'$(TargetTriple)' != ''" />
+ <LinkerArg Include="--target=$(TargetTriple)" Condition="'$(TargetOS)' != 'OSX' and '$(TargetTriple)' != ''" />
+ <LinkerArg Include="-arch $(CrossCompileArch)" Condition="'$(TargetOS)' == 'OSX' and '$(CrossCompileArch)' != ''" />
<LinkerArg Include="-g" Condition="$(NativeDebugSymbols) == 'true'" />
<LinkerArg Include="-Wl,--strip-debug" Condition="$(NativeDebugSymbols) != 'true' and '$(TargetOS)' != 'OSX'" />
<LinkerArg Include="-Wl,-rpath,'$(IlcRPath)'" /> |
I will test it today. You can run the whole build under |
It took these changes to succeed the cross build: am11@542104d.
Good to know. It was |
It got past the point of previous failure. We will need to re-trigger the extra pipeline. |
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
macOS x64 is still crash fest unfortunately. I will check the dumps but if I don't find anything obvious I will split that off into separate PR. macOS ARM64 all seem like small things that should be easy to fix. I plan to do it later this week. |
macOS arm64:
macOS x64: UPD: The macOS x64 may have problem stack walking but it could easily be something in the context capture too... The Debug build has meaningful UPD 2: There's definitely garbage compact unwinding information. In some cases it encodes stack size as reference into the code but it points to instruction that's not UPD 3: The incorrect UPD 4: With the fixed compact unwinding I am back to failing thread suspension/hijacking. In debug builds I also get asserts from Rosetta all the time when running under
|
@VSadov Could you please take a look? |
src/libraries/System.Runtime.Extensions/tests/System/EnvironmentTests.cs
Outdated
Show resolved
Hide resolved
fd4eef3
to
656abda
Compare
My theory is that the underlying reason why the hijacking fails is that the stack unwinding doesn't quite work correctly for this particular use case. The compact unwinding may not be accurate when unwinding a frame which is currently in the prolog/epilog. This likely happens significantly more often in the Rosetta emulation layer where I seem to hit the asserts with the signal being delivered exactly at the first instruction of a method. In fact, not even On ARM64 this doesn't happen, or at least not that often, because most of the managed methods get compiled with prologs/epilogs that cannot be represented as compact unwinding and thus it falls back to DWARF unwinding information in the end (compact unwinding is still needed to make the linker happy and insert pointers to the DWARF info). DWARF has enough information to unwind even prologs/epilogs correctly. |
I added some rudimentary handling of the function prologs in |
The test tries to validate Environment.OSVersion.Version which works correctly. RuntimeInformation.RuntimeIdentifier, however, doesn't use versioned RIDs when NativeAOT is used.
…n in triple to get compact unwinding tables generated
22a8804
to
6a6cb0f
Compare
Rebased on top of |
6a6cb0f
to
d4a521a
Compare
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
(+) No more random crashes. The AzDO link doesn't seem to work anymore. Here are the details:
|
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
The test failures seem unrelated (tvOS succeeded but failed to pass the XML results due to TCP port in use; Linux Bionic failed to find a device) 🎉 |
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.
Looks great. Thank you!
...time.InteropServices.UnitTests/System/Runtime/InteropServices/ObjectiveC/MessageSendTests.cs
Outdated
Show resolved
Hide resolved
…ime.InteropServices.UnitTests/System/Runtime/InteropServices/ObjectiveC/MessageSendTests.cs
Thanks for all the help on this one! |
@filipnavara Thank you!! |
No description provided.