-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Addressing code review suggestions #1975
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
Changes from all commits
d147a2a
098882d
f7f6107
e8ff47b
818c357
7409d12
8da82d1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,32 +7,32 @@ namespace BenchmarkDotNet.Toolchains.NativeAot | |
| { | ||
| public class NativeAotToolchain : Toolchain | ||
| { | ||
| /// <summary> | ||
| /// compiled as net5.0, targets experimental 6.0.0-* NativeAOT build from the https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json | ||
| /// </summary> | ||
| public static readonly IToolchain Net50 = GetBuilderForOldExperimentalFeed().TargetFrameworkMoniker("net5.0").ToToolchain(); | ||
| /// <summary> | ||
| /// compiled as net6.0, targets experimental 6.0.0-* NativeAOT build from the https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json | ||
| /// </summary> | ||
| public static readonly IToolchain Net60 = GetBuilderForOldExperimentalFeed().TargetFrameworkMoniker("net6.0").ToToolchain(); | ||
| public static readonly IToolchain Net60 = CreateBuilder() | ||
| .UseNuGet("6.0.0-*", "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From what I know, .NET 6.0 works perfectly fine under 7.0 ILC and 6.0 is minimum target for ILC right now. Do we really need to tests 6.0 experimental? I do use .NET 6.0 + ILCompiler 7.0 and that's I believe what would be suggested by @MichalStrehovsky too.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I need it as I want to benchmark ILCompiler 6.0 vs 7.0 to see if there are any regressions.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make sense then.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ILCompiler 6.0 is really just an arbitrary snapshot close to when the branding in main changed from 6.0 to 7.0 (but not exactly because we didn't integrate from runtime to runtimelab commit by commit, but in ~weekly chunks). It doesn't have fixes that .NET 6.0 received after main snapped, (i.e. what got integrated from main to 6.0 after the snap), it doesn't have fixes close to when it snapped, and it's therefore not very comparable to .NET 6.0. As long as that's understood, it's fine. |
||
| .TargetFrameworkMoniker("net6.0") | ||
| .ToToolchain(); | ||
|
|
||
| /// <summary> | ||
| /// compiled as net7.0, targets latest (7.0.0-*) NativeAOT build from the .NET 7 feed: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json | ||
| /// </summary> | ||
| public static readonly IToolchain Net70 = CreateBuilder().UseNuGet().TargetFrameworkMoniker("net7.0").ToToolchain(); | ||
|
|
||
| private static NativeAotToolchainBuilder GetBuilderForOldExperimentalFeed() | ||
| => CreateBuilder().UseNuGet("6.0.0-*", "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json"); | ||
| public static readonly IToolchain Net70 = CreateBuilder() | ||
| .UseNuGet("7.0.0-*", "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json") | ||
| .TargetFrameworkMoniker("net7.0") | ||
| .ToToolchain(); | ||
|
|
||
| internal NativeAotToolchain(string displayName, | ||
| string ilCompilerVersion, string ilcPath, | ||
| string runtimeFrameworkVersion, string targetFrameworkMoniker, string runtimeIdentifier, | ||
| string customDotNetCliPath, string packagesRestorePath, | ||
| Dictionary<string, string> feeds, bool useNuGetClearTag, bool useTempFolderForRestore, | ||
| bool rootAllApplicationAssemblies, bool ilcGenerateCompleteTypeMetadata, bool ilcGenerateStackTraceData, string trimmerDefaultAction) | ||
| bool rootAllApplicationAssemblies, bool ilcGenerateCompleteTypeMetadata, bool ilcGenerateStackTraceData) | ||
| : base(displayName, | ||
| new Generator(ilCompilerVersion, runtimeFrameworkVersion, targetFrameworkMoniker, customDotNetCliPath, | ||
| runtimeIdentifier, feeds, useNuGetClearTag, useTempFolderForRestore, packagesRestorePath, | ||
| rootAllApplicationAssemblies, ilcGenerateCompleteTypeMetadata, ilcGenerateStackTraceData, trimmerDefaultAction), | ||
| rootAllApplicationAssemblies, ilcGenerateCompleteTypeMetadata, ilcGenerateStackTraceData), | ||
| new DotNetCliPublisher(customDotNetCliPath, GetExtraArguments(runtimeIdentifier), GetEnvironmentVariables(ilcPath)), | ||
| new Executor()) | ||
| { | ||
|
|
@@ -43,8 +43,7 @@ internal NativeAotToolchain(string displayName, | |
|
|
||
| public static NativeAotToolchainBuilder CreateBuilder() => NativeAotToolchainBuilder.Create(); | ||
|
|
||
| public static string GetExtraArguments(string runtimeIdentifier) | ||
| => $"-r {runtimeIdentifier}"; | ||
| public static string GetExtraArguments(string runtimeIdentifier) => $"-r {runtimeIdentifier}"; | ||
|
|
||
| // https://github.com/dotnet/corert/blob/7f902d4d8b1c3280e60f5e06c71951a60da173fb/Documentation/how-to-build-and-run-ilcompiler-in-console-shell-prompt.md#compiling-source-to-native-code-using-the-ilcompiler-you-built | ||
| // we have to pass IlcPath env var to get it working | ||
|
|
||
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.
TrimMode=linkby default in .NET 6 and NativeAOT doesn't support .NET 5. It's probably unnecessary.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.
We are still supporting .NET 5 with runtimelab ILCompiler (
--runtimes nativeaot5.0) and I've noticed that it has great impact on the build time for this particular config (which is used by our CI as we are still using .NET 5 SDK in BDN)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.
The ILCompiler package brings it's own compiler, CoreLib and the entire BCL - I think if you use the runtimelab ILCompiler with
--runtimes nativeaot5.0or--runtimes nativeaot6.0, you won't see any difference in their performance. The only difference is that the reference assemblies that the C# compiles against won't let you use 6.0 APIs with runtimes=5.0. Either way you get RyuJIT, runtime, CoreLib and framework that is half way between 6.0 and 7.0.The only difference might be if there's third party NuGets - it will pick up 5.0 versions if they multitarget.
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.
After this one #1978 does
--runtimes nativeaot5.0needed?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've removed
nativeaot5.0. Moreover, I think that once we ship .NET 7 with official NativeAOT support we should also removenativeaot6.0.BTW I've tested the following command:
With
<TrimMode>link</TrimMode>it takes 9s to publish the generated app. Without it it takes 110s. So I am going to keep it.