Skip to content

Commit 4faabd3

Browse files
Flip logic for enabling VXSort in the GC (#118633)
For native AOT we [document](https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/optimizing) three build modes: a blended default, optimized for size, and optimized for speed. Typically, optimize for speed is needed to get as closed as possible to CoreCLR-JIT performance (e.g. optimize for speed is the only mode that enables Tier-1 inliner in the JIT). The blended default gets close, but this gives an extra percent or two in throughput at the cost of more size. The VXSort code and table costs 115,712 bytes. We currently compile with VXSort enabled in blended mode and optimize for speed. We link out VXSort when optimizing for size. Maybe this is not something that should be part of the blended default. * When you do `dotnet new console --aot` and `dotnet publish` the hello world, 11% of the output binary is VXSort (!) * Even in more significant apps (e.g. a simple Kestrel host), VxSort is still a single-digit percentage of the app. * I was not able to measure improvement with VxSort on real world apps that I tried (native AOT compiled ILC, benchmarks we use in ASP.NET labs). I'm leaning towards disabling this on blended builds. Our default guidance if someone is not happy with native AOT TP is to switch to Speed optimized builds, so if there's a problem because of this being off, our default guidance would resolve this right away without even having to profile and root cause the problem to sorting. I think using VxSort in the Speed optimization mode only is the right default.
1 parent a90f7ab commit 4faabd3

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ The .NET Foundation licenses this file to you under the MIT license.
7171
<EventPipeName Condition="'$(EventSourceSupport)' == 'true'">libeventpipe-enabled</EventPipeName>
7272

7373
<LinkStandardCPlusPlusLibrary Condition="'$(LinkStandardCPlusPlusLibrary)' == '' and '$(_IsiOSLikePlatform)' == 'true' and '$(InvariantGlobalization)' != 'true'">true</LinkStandardCPlusPlusLibrary>
74-
<VxSortSupportName>libRuntime.VxsortEnabled</VxSortSupportName>
75-
<VxSortSupportName Condition="'$(OptimizationPreference)' == 'Size' or '$(IlcDisableVxsort)' == 'true'">libRuntime.VxsortDisabled</VxSortSupportName>
74+
<VxSortSupportName>libRuntime.VxsortDisabled</VxSortSupportName>
75+
<VxSortSupportName Condition="'$(OptimizationPreference)' == 'Speed' or '$(IlcEnableVxsort)' == 'true'">libRuntime.VxsortEnabled</VxSortSupportName>
7676
<StandaloneGCSupportName>libstandalonegc-disabled</StandaloneGCSupportName>
7777
<StandaloneGCSupportName Condition="'$(IlcStandaloneGCSupport)' == 'true'">libstandalonegc-enabled</StandaloneGCSupportName>
7878
</PropertyGroup>

src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Windows.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ The .NET Foundation licenses this file to you under the MIT license.
2222
<FullRuntimeName Condition="'$(ServerGarbageCollection)' == 'true' or '$(IlcLinkServerGC)' == 'true'">Runtime.ServerGC</FullRuntimeName>
2323
<BootstrapperName>bootstrapper</BootstrapperName>
2424
<BootstrapperName Condition="'$(NativeLib)' != '' or '$(CustomNativeMain)' == 'true'">bootstrapperdll</BootstrapperName>
25-
<VxSortSupportName>Runtime.VxsortEnabled</VxSortSupportName>
26-
<VxSortSupportName Condition="'$(OptimizationPreference)' == 'Size' or '$(IlcDisableVxsort)' == 'true'">Runtime.VxsortDisabled</VxSortSupportName>
25+
<VxSortSupportName>Runtime.VxsortDisabled</VxSortSupportName>
26+
<VxSortSupportName Condition="'$(OptimizationPreference)' == 'Speed' or '$(IlcEnableVxsort)' == 'true'">Runtime.VxsortEnabled</VxSortSupportName>
2727
<StandaloneGCSupportName>standalonegc-disabled</StandaloneGCSupportName>
2828
<StandaloneGCSupportName Condition="'$(IlcStandaloneGCSupport)' == 'true'">standalonegc-enabled</StandaloneGCSupportName>
2929
<EntryPointSymbol Condition="'$(EntryPointSymbol)' == ''">wmainCRTStartup</EntryPointSymbol>

src/tests/nativeaot/SmokeTests/HardwareIntrinsics/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ static int Main()
2121
Console.WriteLine("****************************************************");
2222

2323
long lowerBound, upperBound;
24-
lowerBound = 1200 * 1024; // ~1.2 MB
25-
upperBound = 1600 * 1024; // ~1.6 MB
24+
lowerBound = 1100 * 1024; // ~1.1 MB
25+
upperBound = 1500 * 1024; // ~1.5 MB
2626

2727
if (fileSize < lowerBound || fileSize > upperBound)
2828
{

0 commit comments

Comments
 (0)