-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Switch to selfhosted NativeAOT compiler #81205
Conversation
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas Issue DetailsThis will compile the NativeAOT compiler with the LKG build of the NativeAOT compiler that the repo is building with. At this point NativeAOT-compiled compiler is significantly better than the R2R+Trimmed+SingleFile-compiled combo we're shipping right now. Time to compile hello world before: 2.3 seconds. Time to compile hello world after: 1.3 seconds. Cc @dotnet/ilc-contrib
|
@@ -10,6 +10,7 @@ | |||
<!-- BEGIN: Workaround for https://github.com/dotnet/runtime/issues/67742 --> | |||
<PropertyGroup Condition="'$(BuildingInsideVisualStudio)' != 'true'"> | |||
<PublishDir>$(RuntimeBinDir)ilc-published/</PublishDir> | |||
<NativeAotSupported Condition="'$(RuntimeIdentifier)' != 'win-x64' and '$(RuntimeIdentifier)' != 'linux-x64'">false</NativeAotSupported> |
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.
Why exclude macOS (and arm64)?
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.
See the previous failed attempts: Directory.Build.targets(83,5): error : (NETCORE_ENGINEERING_TELEMETRY=Build) The passed-in TargetOS property value 'OSX' must be lowercase.
Directory.Build.targets became opinionated about how to spell OSX. The old ilc probably doesn't spell it right. I don't particularly care about osx in the scope of this PR - this is to speed up testing and we do the majority of testing on Linux and Windows.
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.
I think we can broaden this pretty easily after we get it started and flush out the problems.
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. An eventual improvement will be moving this to a test dependency so we don't have to rely on BuildingInsideVisualStudio
@@ -10,6 +10,7 @@ | |||
<!-- BEGIN: Workaround for https://github.com/dotnet/runtime/issues/67742 --> | |||
<PropertyGroup Condition="'$(BuildingInsideVisualStudio)' != 'true'"> | |||
<PublishDir>$(RuntimeBinDir)ilc-published/</PublishDir> | |||
<NativeAotSupported Condition="'$(RuntimeIdentifier)' != 'win-x64' and '$(RuntimeIdentifier)' != 'linux-x64'">false</NativeAotSupported> |
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.
I think we can broaden this pretty easily after we get it started and flush out the problems.
<PublishSingleFile>true</PublishSingleFile> | ||
<NativeAotSupported Condition="'$(RuntimeIdentifier)' != 'win-x64' and '$(RuntimeIdentifier)' != 'linux-x64'">false</NativeAotSupported> | ||
<PublishAot Condition="'$(NativeAotSupported)' == 'true'">true</PublishAot> | ||
<PublishReadyToRun Condition="'$(NativeAotSupported)' != 'true'">true</PublishReadyToRun> |
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.
Consider moving this to a separate ItemGroup with a top-level NativeAOTSupported
condition.
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.
This is already in a conditioned itemgroup so I would need to repeat the condition. Given this is eventually going away in favor of a live build, maybe it's fine.
Ah, just looked at the test failures. Looks like the configuration is not correct somewhere -- we're passing |
@am11 FYI - using gcc with PublishAot seems broken for crossbuild. I tried working around in this PR, but that ran into the issue that this is not using the live Microsoft.NETCore.Native.Unix.targets and my workaround is a noop. I'm going to meditate on this some more because I don't know what the workaround for the gcc legs would be (I guess we could fix the freebsd one by checking TargetOS). |
This will compile the NativeAOT compiler with the LKG build of the NativeAOT compiler that the repo is building with. At this point NativeAOT-compiled compiler is significantly better than the R2R+Trimmed+SingleFile-compiled combo we're shipping right now. ilc.exe size before: 31 MB. ilc.exe size after: 14 MB. Time to compile hello world before: 2.3 seconds. Time to compile hello world after: 1.3 seconds.
58199fe
to
b07c648
Compare
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
@dotnet/ilc-contrib This is ready for review. |
<!-- Don't R2R on ARM64 machines because ARM64 crossgen2 that comes with .NET SDK <= 7.0 Preview 7 crashes.--> | ||
<PublishReadyToRun Condition="'$(BuildArchitecture)' != 'arm64'">true</PublishReadyToRun> | ||
<PublishSingleFile>true</PublishSingleFile> | ||
<NativeAotSupported Condition="'$(TargetOS)' != 'windows' and '$(TargetOS)' != 'linux'">false</NativeAotSupported> |
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.
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.
I can't comment on the viability of osx, but the rest of the change looks good.
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
Looks like the osx issue was also fixed in the latest SDK drop so I enabled it. |
Went better than expected! |
This will compile the NativeAOT compiler with the LKG build of the NativeAOT compiler that the repo is building with.
At this point NativeAOT-compiled compiler is significantly better than the R2R+Trimmed+SingleFile-compiled combo we're shipping right now.
Time to compile hello world before: 2.3 seconds. Time to compile hello world after: 1.3 seconds.
ilc.exe size before: 31 MB. ilc.exe size after: 14 MB.
Cc @dotnet/ilc-contrib