Skip to content

Commit

Permalink
NativeAOT ARM64 libraries testing (dotnet#64373)
Browse files Browse the repository at this point in the history
Enable ARM64 libraries testing for NativeAOT.

* Copy the crosstargeting build approach from crossgen2. We'll now build two ILC compilers when targeting ARM64 from x64: an arm64-hosted one that is useless on the build machine, and a x64-hosted one, that will work on the build machine. The `ILCompiler.csproj/props/_crossarch.csproj` projects mirror crossgen's approach.
* Limit the number of libraries tests to one. Hopefully it avoids the build races that we'd see until we can update the repo build to .NET 7 Preview 1.
* Create an ARM64 NativeAOT CI leg that sends the libraries tests to Helix to run.
  • Loading branch information
MichalStrehovsky committed Feb 8, 2022
1 parent 8ee59f4 commit b11469f
Show file tree
Hide file tree
Showing 10 changed files with 192 additions and 133 deletions.
2 changes: 1 addition & 1 deletion docs/workflow/building/coreclr/nativeaot.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The executable looks like a native executable, in the sense that it can be debug
## Building

- [Install pre-requisites](../../README.md#build-requirements)
- Run `build[.cmd|.sh] clr+libs -rc [Debug|Release] -lc Release` from the repo root. This will restore nuget packages required for building and build the parts of the repo required for general CoreCLR development. Alternatively, instead of specifying `clr+libs`, you can specify `clr.jit+clr.tools+clr.nativeaotlibs+clr.nativeaotruntime+libs` which is more targeted and builds faster. Replace `clr.jit` with `clr.alljits` if you need to crosscompile.
- Run `build[.cmd|.sh] clr+libs -rc [Debug|Release] -lc Release` from the repo root. This will restore nuget packages required for building and build the parts of the repo required for general CoreCLR development. Alternatively, instead of specifying `clr+libs`, you can specify `clr.alljits+clr.tools+clr.nativeaotlibs+clr.nativeaotruntime+libs` which is more targeted and builds faster.
- [NOT PORTED OVER YET] The build will place the toolchain packages at `artifacts\packages\[Debug|Release]\Shipping`. To publish your project using these packages:
- [NOT PORTED OVER YET] Add the package directory to your `nuget.config` file. For example, replace `dotnet-experimental` line in `samples\HelloWorld\nuget.config` with `<add key="local" value="C:\runtimelab\artifacts\packages\Debug\Shipping" />`
- [NOT PORTED OVER YET] Run `dotnet publish --packages pkg -r [win-x64|linux-x64|osx-64] -c [Debug|Release]` to publish your project. `--packages pkg` option restores the package into a local directory that is easy to cleanup once you are done. It avoids polluting the global nuget cache with your locally built dev package.
Expand Down
3 changes: 2 additions & 1 deletion eng/Subsets.props
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@
<ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\ILCompiler\ILCompiler.csproj" Category="clr" Condition="'$(NativeAotSupported)' == 'true'" />
<ProjectToBuild Include="$(CoreClrProjectRoot)nativeaot\BuildIntegration\BuildIntegration.proj" Category="clr" Condition="'$(NativeAotSupported)' == 'true'" />

<ProjectToBuild Condition="'$(TargetArchitecture)' != 'x64' and '$(BuildArchitecture)' == 'x64'" Include="$(CoreClrProjectRoot)tools\aot\crossgen2\crossgen2_crossarch.csproj" Category="clr" />
<ProjectToBuild Condition="'$(NativeAotSupported)' == 'true' and '$(TargetArchitecture)' != '$(BuildArchitecture)'" Include="$(CoreClrProjectRoot)tools\aot\ILCompiler\ILCompiler_crossarch.csproj" Category="clr" />
<ProjectToBuild Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)'" Include="$(CoreClrProjectRoot)tools\aot\crossgen2\crossgen2_crossarch.csproj" Category="clr" />
</ItemGroup>

<ItemGroup Condition="$(_subset.Contains('+clr.toolstests+'))">
Expand Down
1 change: 1 addition & 0 deletions eng/liveBuilds.targets
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<CoreCLRSharedFrameworkDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'sharedFramework'))</CoreCLRSharedFrameworkDir>
<CoreCLRCrossgen2Dir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'crossgen2'))</CoreCLRCrossgen2Dir>
<CoreCLRILCompilerDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'ilc'))</CoreCLRILCompilerDir>
<CoreCLRCrossILCompilerDir Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)'">$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', '$(BuildArchitecture)', 'ilc'))</CoreCLRCrossILCompilerDir>
<CoreCLRAotSdkDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'aotsdk'))</CoreCLRAotSdkDir>
<CoreCLRBuildIntegrationDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'build'))</CoreCLRBuildIntegrationDir>

Expand Down
36 changes: 32 additions & 4 deletions eng/pipelines/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ jobs:
testGroup: innerloop
timeoutInMinutes: 120
nameSuffix: NativeAOT
buildArgs: -s clr.jit+clr.tools+clr.nativeaotlibs+clr.nativeaotruntime+libs -rc $(_BuildConfig) -lc Release
buildArgs: -s clr.alljits+clr.tools+clr.nativeaotlibs+clr.nativeaotruntime+libs -rc $(_BuildConfig) -lc Release
extraStepsTemplate: /eng/pipelines/coreclr/nativeaot-post-build-steps.yml
condition: >-
or(
Expand All @@ -233,7 +233,7 @@ jobs:
testGroup: innerloop
timeoutInMinutes: 120
nameSuffix: NativeAOT
buildArgs: -s clr.jit+clr.tools+clr.nativeaotlibs+clr.nativeaotruntime+libs -rc $(_BuildConfig) -lc Release
buildArgs: -s clr.alljits+clr.tools+clr.nativeaotlibs+clr.nativeaotruntime+libs -rc $(_BuildConfig) -lc Release
extraStepsTemplate: /eng/pipelines/coreclr/nativeaot-post-build-steps.yml
condition: >-
or(
Expand All @@ -242,7 +242,7 @@ jobs:
eq(variables['isFullMatrix'], true))
#
# CoreCLR NativeAOT checked build and smoke tests
# CoreCLR NativeAOT release build and smoke tests
# Only when CoreCLR is changed
#
- template: /eng/pipelines/common/platform-matrix.yml
Expand All @@ -257,14 +257,42 @@ jobs:
testGroup: innerloop
timeoutInMinutes: 120
nameSuffix: NativeAOT
buildArgs: -s clr.jit+clr.tools+clr.nativeaotlibs+clr.nativeaotruntime+libs -rc $(_BuildConfig) -lc Release
buildArgs: -s clr.alljits+clr.tools+clr.nativeaotlibs+clr.nativeaotruntime+libs -rc $(_BuildConfig) -lc Release
extraStepsTemplate: /eng/pipelines/coreclr/nativeaot-post-build-steps.yml
condition: >-
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true),
eq(variables['isFullMatrix'], true))
#
# CoreCLR NativeAOT release build and libraries tests
# Only when CoreCLR is changed
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
buildConfig: Release
platforms:
- windows_arm64
- Linux_arm64
jobParameters:
testGroup: innerloop
isSingleFile: true
nameSuffix: NativeAOT
buildArgs: -s clr.alljits+clr.tools+clr.nativeaotlibs+clr.nativeaotruntime+libs+libs.tests -c $(_BuildConfig) /p:TestNativeAot=true /p:ArchiveTests=true
timeoutInMinutes: 120
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
extraStepsParameters:
creator: dotnet-bot
testRunNamePrefixSuffix: NativeAOT_$(_BuildConfig)
condition: >-
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true),
eq(variables['isFullMatrix'], true))
# Build and test clr tools
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
Expand Down
6 changes: 5 additions & 1 deletion eng/testing/tests.singlefile.targets
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,15 @@

<PropertyGroup Condition="'$(TestNativeAot)' == 'true'">
<IlcToolsPath>$(CoreCLRILCompilerDir)</IlcToolsPath>
<IlcToolsPath Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)'">$(CoreCLRCrossILCompilerDir)</IlcToolsPath>
<CppCompilerAndLinker Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)' and '$(HostOS)' != 'windows'">clang-9</CppCompilerAndLinker>
<SysRoot Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)' and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot>
<IlcBuildTasksPath>$(CoreCLRILCompilerDir)netstandard/ILCompiler.Build.Tasks.dll</IlcBuildTasksPath>
<IlcSdkPath>$(CoreCLRAotSdkDir)</IlcSdkPath>
<IlcFrameworkPath>$(NetCoreAppCurrentTestHostSharedFrameworkPath)</IlcFrameworkPath>
<NoWarn>$(NoWarn);IL3050;IL3052;IL3055;IL1005</NoWarn>
<NoWarn>$(NoWarn);IL3050;IL3051;IL3052;IL3055;IL1005</NoWarn>
<TrimmerSingleWarn>false</TrimmerSingleWarn>
<SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings>

<!-- Forced by ILLink targets; we should fix the SDK -->
<SelfContained>true</SelfContained>
Expand Down
125 changes: 3 additions & 122 deletions src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj
Original file line number Diff line number Diff line change
@@ -1,126 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>ilc</AssemblyName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<OutputType>Exe</OutputType>
<TargetFramework>$(NetCoreAppToolCurrent)</TargetFramework>
<NoWarn>8002,NU1701</NoWarn>
<Platforms>x64;x86</Platforms>
<PlatformTarget>AnyCPU</PlatformTarget>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendTargetFrameworkToOutputPath Condition="'$(BuildingInsideVisualStudio)' == 'true'">true</AppendTargetFrameworkToOutputPath>
<OutputPath>$(RuntimeBinDir)ilc</OutputPath>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<EnableDefaultEmbeddedResourceItems>false</EnableDefaultEmbeddedResourceItems>
<Configurations>Debug;Release;Checked</Configurations>
<UseAppHost>true</UseAppHost>
<ServerGarbageCollection>true</ServerGarbageCollection>
<TieredCompilation>false</TieredCompilation>
<OutputPath>$(RuntimeBinDir)ilc/</OutputPath>
<RuntimeIdentifier>$(OutputRid)</RuntimeIdentifier>
</PropertyGroup>

<PropertyGroup>
<SelfContained>true</SelfContained>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<RuntimeIdentifier>$(ToolsRID)</RuntimeIdentifier>
</PropertyGroup>

<PropertyGroup>
<ObjWriterRid Condition="'$(ObjWriterRid)' == '' and '$(RuntimeIdentifier)' == 'osx-x64'">osx.10.12-x64</ObjWriterRid>
<ObjWriterRid Condition="'$(ObjWriterRid)' == '' and '$(RuntimeIdentifier)' == 'osx-arm64'">osx.11.0-arm64</ObjWriterRid>
<ObjWriterRid Condition="'$(ObjWriterRid)' == ''">$(RuntimeIdentifier)</ObjWriterRid>

<ObjWriterVersion Condition="'$(ObjWriterVersion)' == '' and '$(RuntimeIdentifier)' == 'linux-arm64'">$(runtimelinuxarm64MicrosoftNETCoreRuntimeObjWriterVersion)</ObjWriterVersion>
<ObjWriterVersion Condition="'$(ObjWriterVersion)' == '' and '$(RuntimeIdentifier)' == 'linux-x64'">$(runtimelinuxx64MicrosoftNETCoreRuntimeObjWriterVersion)</ObjWriterVersion>
<ObjWriterVersion Condition="'$(ObjWriterVersion)' == '' and '$(RuntimeIdentifier)' == 'linux-musl-arm64'">$(runtimelinuxmuslarm64MicrosoftNETCoreRuntimeObjWriterVersion)</ObjWriterVersion>
<ObjWriterVersion Condition="'$(ObjWriterVersion)' == '' and '$(RuntimeIdentifier)' == 'linux-musl-x64'">$(runtimelinuxmuslx64MicrosoftNETCoreRuntimeObjWriterVersion)</ObjWriterVersion>
<ObjWriterVersion Condition="'$(ObjWriterVersion)' == '' and '$(RuntimeIdentifier)' == 'win-arm64'">$(runtimewinarm64MicrosoftNETCoreRuntimeObjWriterVersion)</ObjWriterVersion>
<ObjWriterVersion Condition="'$(ObjWriterVersion)' == '' and '$(RuntimeIdentifier)' == 'win-x64'">$(runtimewinx64MicrosoftNETCoreRuntimeObjWriterVersion)</ObjWriterVersion>
<ObjWriterVersion Condition="'$(ObjWriterVersion)' == '' and '$(RuntimeIdentifier)' == 'osx-arm64'">$(runtimeosx110arm64MicrosoftNETCoreRuntimeObjWriterVersion)</ObjWriterVersion>
<ObjWriterVersion Condition="'$(ObjWriterVersion)' == '' and '$(RuntimeIdentifier)' == 'osx-x64'">$(runtimeosx1012x64MicrosoftNETCoreRuntimeObjWriterVersion)</ObjWriterVersion>

<!-- CoreDisTools are used in debugging visualizers. -->
<IncludeCoreDisTools Condition="'$(Configuration)' != 'Release'">true</IncludeCoreDisTools>
</PropertyGroup>

<Import Project="$(RepositoryEngineeringDir)coredistools.targets" Condition="'$(DotNetBuildFromSource)' != 'true' and '$(IncludeCoreDisTools)' == 'true'" />

<ItemGroup>
<PackageReference Include="runtime.$(ObjWriterRid).Microsoft.NETCore.Runtime.ObjWriter">
<Version>$(ObjWriterVersion)</Version>
</PackageReference>

<Content Include="$(NuGetPackageRoot)runtime.$(ObjWriterRid).microsoft.netcore.runtime.objwriter\$(ObjWriterVersion)\runtimes\$(ObjWriterRid)\native\$(LibPrefix)objwriter$(LibSuffix)">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
<Pack>false</Pack>
</Content>
</ItemGroup>

<ItemGroup>
<Content Include="$(RuntimeBinDir)$(LibPrefix)jitinterface_$(TargetArchitecture)$(LibSuffix)">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
<Pack>false</Pack>
</Content>

<Content Include="$(RuntimeBinDir)$(LibPrefix)clrjit_*_$(TargetArchitecture)$(LibSuffix)">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
<Pack>false</Pack>
</Content>

<Content Include="$(CoreDisToolsLibrary)" Condition="Exists('$(CoreDisToolsLibrary)') and '$(IncludeCoreDisTools)' == 'true'">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ILCompiler.DependencyAnalysisFramework\ILCompiler.DependencyAnalysisFramework.csproj" />
<ProjectReference Include="..\ILCompiler.MetadataTransform\ILCompiler.MetadataTransform.csproj" />
<ProjectReference Include="..\ILCompiler.RyuJit\ILCompiler.RyuJit.csproj" />
<ProjectReference Include="..\ILCompiler.TypeSystem\ILCompiler.TypeSystem.csproj" />
<ProjectReference Include="..\ILCompiler.Compiler\ILCompiler.Compiler.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Include="..\..\Common\CommandLine\Argument.cs" />
<Compile Include="..\..\Common\CommandLine\Argument_1.cs" />
<Compile Include="..\..\Common\CommandLine\ArgumentCommand.cs" />
<Compile Include="..\..\Common\CommandLine\ArgumentCommand_1.cs" />
<Compile Include="..\..\Common\CommandLine\ArgumentLexer.cs" />
<Compile Include="..\..\Common\CommandLine\ArgumentList_1.cs" />
<Compile Include="..\..\Common\CommandLine\ArgumentParser.cs" />
<Compile Include="..\..\Common\CommandLine\ArgumentSyntax.cs" />
<Compile Include="..\..\Common\CommandLine\ArgumentSyntax_Definers.cs" />
<Compile Include="..\..\Common\CommandLine\ArgumentSyntaxException.cs" />
<Compile Include="..\..\Common\CommandLine\ArgumentToken.cs" />
<Compile Include="..\..\Common\CommandLine\CommandLineException.cs" />
<Compile Include="..\..\Common\CommandLine\CommandLineHelpers.cs" />
<Compile Include="..\..\Common\CommandLine\Enumerable.cs" />
<Compile Include="..\..\Common\CommandLine\HelpTextGenerator.cs" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="..\..\Common\CommandLine\Resources\Strings.resx">
<GenerateSource>true</GenerateSource>
<ClassName>Internal.CommandLine.Strings</ClassName>
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<Compile Remove="repro\*" />
</ItemGroup>

<PropertyGroup>
<TargetOSComponent>unix</TargetOSComponent>
<TargetOSComponent Condition="'$(TargetsWindows)' == 'true'">win</TargetOSComponent>
<TargetSpec>$(TargetOSComponent)_$(TargetArchitecture)_$(TargetArchitecture)</TargetSpec>
</PropertyGroup>

<!-- On Windows we can re-use PGO-optimized clrjit.dll produced by the build for AOT compilation.
On Linux renaming the library makes it difficult to debug it. -->
<ItemGroup Condition="'$(TargetsWindows)' == 'true'">
<Content Remove="$(RuntimeBinDir)$(LibPrefix)clrjit_$(TargetSpec)$(LibSuffix)" />
<Content Include="$(RuntimeBinDir)$(LibPrefix)clrjit$(LibSuffix)" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" Link="$(LibPrefix)clrjit_$(TargetSpec)$(LibSuffix)" />
</ItemGroup>
<Import Project="ILCompiler.props" />
</Project>
Loading

0 comments on commit b11469f

Please sign in to comment.