Uh oh!
There was an error while loading. Please reload this page.
[NativeAOT] Enable CI for macOS x64/arm64 - #75421
Conversation
ghost
commented
Sep 11, 2022
Tagging subscribers to this area: @dotnet/area-infrastructure-libraries Issue Detailsnull
|
filipnavara
commented
Sep 11, 2022
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.
jkotas
commented
Sep 11, 2022
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
No pipelines are associated with this pull request. |
filipnavara
commented
Sep 11, 2022
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... |
jkotas
commented
Sep 11, 2022
Looks like this needs fixing: |
filipnavara
commented
Sep 11, 2022
Yep. Not quite sure what the correct fix is but I will give it a try. |
jkotas
commented
Sep 11, 2022
I think we want to use clang-9 for Linux only (it is a workaround for missing clang alias in our Linux docker images). |
filipnavara
commented
Sep 11, 2022
Yep, seems like regular |
jkotas
commented
Sep 11, 2022
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)'" /> |
filipnavara
commented
Sep 12, 2022
I will test it today. You can run the whole build under |
am11
commented
Sep 12, 2022
It took these changes to succeed the cross build: am11@542104d.
Good to know. It was |
filipnavara
commented
Sep 12, 2022
It got past the point of previous failure. We will need to re-trigger the extra pipeline. |
jkotas
commented
Sep 12, 2022
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
filipnavara
commented
Sep 12, 2022
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 |
jkotas
commented
Sep 13, 2022
@VSadov Could you please take a look? |
Uh oh!
There was an error while loading. Please reload this page.
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. |
filipnavara
commented
Sep 13, 2022
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
filipnavara
commented
Sep 30, 2022
Rebased on top of |
jkotas
commented
Sep 30, 2022
/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: |
jkotas
commented
Sep 30, 2022
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
filipnavara
commented
Sep 30, 2022
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) 🎉 |
Uh oh!
There was an error while loading. Please reload this page.
…ime.InteropServices.UnitTests/System/Runtime/InteropServices/ObjectiveC/MessageSendTests.cs
filipnavara
commented
Sep 30, 2022
Thanks for all the help on this one! |
VSadov
commented
Sep 30, 2022
@filipnavara Thank you!! |
No description provided.