forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When QuickJit is disabled, fix assertion failures
- When QuickJit is disabled, the initial tier is Optimized instead of the correct Tier0. This causes assertion failures as tiering tries to count calls and promote the method to Tier1. - Does not appear to be an issue in release builds, as the methods are still call-counted and promoted despite the incorrect tier - Add some basic tiering tests for config modes that are exposed and supported through <app>.runtimeconfig.json, QuickJit and QuickJitForLoops, when on and off - Removed an invalid and redundant assertion that was causing a profiler rejit test to fail, see dotnet#33492 (comment). What the assertion was intending to verify is already verified by an assertion above it that checks the tier, which also covers the default native code version case.
- Loading branch information
Showing
13 changed files
with
267 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/coreclr/tests/src/baseservices/TieredCompilation/BasicTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Runtime.CompilerServices; | ||
using System.Threading; | ||
|
||
public static class BasicTest | ||
{ | ||
private static int Main() | ||
{ | ||
const int Pass = 100; | ||
|
||
PromoteToTier1(Foo); | ||
Foo(); | ||
|
||
return Pass; | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
private static void Foo() | ||
{ | ||
Foo2(); | ||
} | ||
|
||
private static void Foo2() | ||
{ | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
private static void PromoteToTier1(Action action) | ||
{ | ||
// Call the method once to register a call for call counting | ||
action(); | ||
|
||
// Allow time for call counting to begin | ||
Thread.Sleep(500); | ||
|
||
// Call the method enough times to trigger tier 1 promotion | ||
for (int i = 0; i < 100; i++) | ||
{ | ||
action(); | ||
} | ||
|
||
// Allow time for the method to be jitted at tier 1 | ||
Thread.Sleep(500); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/coreclr/tests/src/baseservices/TieredCompilation/BasicTest_DefaultMode.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
<Optimize>true</Optimize> | ||
<CLRTestPriority>0</CLRTestPriority> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="BasicTest.cs" /> | ||
</ItemGroup> | ||
</Project> |
21 changes: 21 additions & 0 deletions
21
src/coreclr/tests/src/baseservices/TieredCompilation/BasicTest_DefaultMode_R2r.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
<Optimize>true</Optimize> | ||
<CLRTestPriority>0</CLRTestPriority> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="BasicTest.cs" /> | ||
</ItemGroup> | ||
<PropertyGroup> | ||
<CLRTestBatchPreCommands><![CDATA[ | ||
$(CLRTestBatchPreCommands) | ||
"%CORE_ROOT%\crossgen" -ReadyToRun -Platform_Assemblies_Paths "%CORE_ROOT%" -out $(MSBuildProjectName).ni.dll $(MSBuildProjectName).dll | ||
]]></CLRTestBatchPreCommands> | ||
<BashCLRTestPreCommands><![CDATA[ | ||
$(BashCLRTestPreCommands) | ||
"$CORE_ROOT/crossgen" -ReadyToRun -Platform_Assemblies_Paths "$CORE_ROOT" -out $(MSBuildProjectName).ni.dll $(MSBuildProjectName).dll | ||
]]></BashCLRTestPreCommands> | ||
</PropertyGroup> | ||
</Project> |
21 changes: 21 additions & 0 deletions
21
src/coreclr/tests/src/baseservices/TieredCompilation/BasicTest_QuickJitForLoopsOff.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
<Optimize>true</Optimize> | ||
<CLRTestPriority>0</CLRTestPriority> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="BasicTest.cs" /> | ||
</ItemGroup> | ||
<PropertyGroup> | ||
<CLRTestBatchPreCommands><![CDATA[ | ||
$(CLRTestBatchPreCommands) | ||
set COMPlus_TC_QuickJitForLoops=0 | ||
]]></CLRTestBatchPreCommands> | ||
<BashCLRTestPreCommands><![CDATA[ | ||
$(BashCLRTestPreCommands) | ||
export COMPlus_TC_QuickJitForLoops=0 | ||
]]></BashCLRTestPreCommands> | ||
</PropertyGroup> | ||
</Project> |
23 changes: 23 additions & 0 deletions
23
...coreclr/tests/src/baseservices/TieredCompilation/BasicTest_QuickJitForLoopsOff_R2r.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
<Optimize>true</Optimize> | ||
<CLRTestPriority>0</CLRTestPriority> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="BasicTest.cs" /> | ||
</ItemGroup> | ||
<PropertyGroup> | ||
<CLRTestBatchPreCommands><![CDATA[ | ||
$(CLRTestBatchPreCommands) | ||
"%CORE_ROOT%\crossgen" -ReadyToRun -Platform_Assemblies_Paths "%CORE_ROOT%" -out $(MSBuildProjectName).ni.dll $(MSBuildProjectName).dll | ||
set COMPlus_TC_QuickJitForLoops=0 | ||
]]></CLRTestBatchPreCommands> | ||
<BashCLRTestPreCommands><![CDATA[ | ||
$(BashCLRTestPreCommands) | ||
"$CORE_ROOT/crossgen" -ReadyToRun -Platform_Assemblies_Paths "$CORE_ROOT" -out $(MSBuildProjectName).ni.dll $(MSBuildProjectName).dll | ||
export COMPlus_TC_QuickJitForLoops=0 | ||
]]></BashCLRTestPreCommands> | ||
</PropertyGroup> | ||
</Project> |
21 changes: 21 additions & 0 deletions
21
src/coreclr/tests/src/baseservices/TieredCompilation/BasicTest_QuickJitForLoopsOn.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
<Optimize>true</Optimize> | ||
<CLRTestPriority>0</CLRTestPriority> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="BasicTest.cs" /> | ||
</ItemGroup> | ||
<PropertyGroup> | ||
<CLRTestBatchPreCommands><![CDATA[ | ||
$(CLRTestBatchPreCommands) | ||
set COMPlus_TC_QuickJitForLoops=1 | ||
]]></CLRTestBatchPreCommands> | ||
<BashCLRTestPreCommands><![CDATA[ | ||
$(BashCLRTestPreCommands) | ||
export COMPlus_TC_QuickJitForLoops=1 | ||
]]></BashCLRTestPreCommands> | ||
</PropertyGroup> | ||
</Project> |
23 changes: 23 additions & 0 deletions
23
src/coreclr/tests/src/baseservices/TieredCompilation/BasicTest_QuickJitForLoopsOn_R2r.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
<Optimize>true</Optimize> | ||
<CLRTestPriority>0</CLRTestPriority> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="BasicTest.cs" /> | ||
</ItemGroup> | ||
<PropertyGroup> | ||
<CLRTestBatchPreCommands><![CDATA[ | ||
$(CLRTestBatchPreCommands) | ||
"%CORE_ROOT%\crossgen" -ReadyToRun -Platform_Assemblies_Paths "%CORE_ROOT%" -out $(MSBuildProjectName).ni.dll $(MSBuildProjectName).dll | ||
set COMPlus_TC_QuickJitForLoops=1 | ||
]]></CLRTestBatchPreCommands> | ||
<BashCLRTestPreCommands><![CDATA[ | ||
$(BashCLRTestPreCommands) | ||
"$CORE_ROOT/crossgen" -ReadyToRun -Platform_Assemblies_Paths "$CORE_ROOT" -out $(MSBuildProjectName).ni.dll $(MSBuildProjectName).dll | ||
export COMPlus_TC_QuickJitForLoops=1 | ||
]]></BashCLRTestPreCommands> | ||
</PropertyGroup> | ||
</Project> |
21 changes: 21 additions & 0 deletions
21
src/coreclr/tests/src/baseservices/TieredCompilation/BasicTest_QuickJitOff.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
<Optimize>true</Optimize> | ||
<CLRTestPriority>0</CLRTestPriority> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="BasicTest.cs" /> | ||
</ItemGroup> | ||
<PropertyGroup> | ||
<CLRTestBatchPreCommands><![CDATA[ | ||
$(CLRTestBatchPreCommands) | ||
set COMPlus_TC_QuickJit=0 | ||
]]></CLRTestBatchPreCommands> | ||
<BashCLRTestPreCommands><![CDATA[ | ||
$(BashCLRTestPreCommands) | ||
export COMPlus_TC_QuickJit=0 | ||
]]></BashCLRTestPreCommands> | ||
</PropertyGroup> | ||
</Project> |
23 changes: 23 additions & 0 deletions
23
src/coreclr/tests/src/baseservices/TieredCompilation/BasicTest_QuickJitOff_R2r.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
<Optimize>true</Optimize> | ||
<CLRTestPriority>0</CLRTestPriority> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="BasicTest.cs" /> | ||
</ItemGroup> | ||
<PropertyGroup> | ||
<CLRTestBatchPreCommands><![CDATA[ | ||
$(CLRTestBatchPreCommands) | ||
"%CORE_ROOT%\crossgen" -ReadyToRun -Platform_Assemblies_Paths "%CORE_ROOT%" -out $(MSBuildProjectName).ni.dll $(MSBuildProjectName).dll | ||
set COMPlus_TC_QuickJit=0 | ||
]]></CLRTestBatchPreCommands> | ||
<BashCLRTestPreCommands><![CDATA[ | ||
$(BashCLRTestPreCommands) | ||
"$CORE_ROOT/crossgen" -ReadyToRun -Platform_Assemblies_Paths "$CORE_ROOT" -out $(MSBuildProjectName).ni.dll $(MSBuildProjectName).dll | ||
export COMPlus_TC_QuickJit=0 | ||
]]></BashCLRTestPreCommands> | ||
</PropertyGroup> | ||
</Project> |
21 changes: 21 additions & 0 deletions
21
src/coreclr/tests/src/baseservices/TieredCompilation/BasicTest_QuickJitOn.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
<Optimize>true</Optimize> | ||
<CLRTestPriority>0</CLRTestPriority> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="BasicTest.cs" /> | ||
</ItemGroup> | ||
<PropertyGroup> | ||
<CLRTestBatchPreCommands><![CDATA[ | ||
$(CLRTestBatchPreCommands) | ||
set COMPlus_TC_QuickJit=1 | ||
]]></CLRTestBatchPreCommands> | ||
<BashCLRTestPreCommands><![CDATA[ | ||
$(BashCLRTestPreCommands) | ||
export COMPlus_TC_QuickJit=1 | ||
]]></BashCLRTestPreCommands> | ||
</PropertyGroup> | ||
</Project> |
23 changes: 23 additions & 0 deletions
23
src/coreclr/tests/src/baseservices/TieredCompilation/BasicTest_QuickJitOn_R2r.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
<Optimize>true</Optimize> | ||
<CLRTestPriority>0</CLRTestPriority> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="BasicTest.cs" /> | ||
</ItemGroup> | ||
<PropertyGroup> | ||
<CLRTestBatchPreCommands><![CDATA[ | ||
$(CLRTestBatchPreCommands) | ||
"%CORE_ROOT%\crossgen" -ReadyToRun -Platform_Assemblies_Paths "%CORE_ROOT%" -out $(MSBuildProjectName).ni.dll $(MSBuildProjectName).dll | ||
set COMPlus_TC_QuickJit=1 | ||
]]></CLRTestBatchPreCommands> | ||
<BashCLRTestPreCommands><![CDATA[ | ||
$(BashCLRTestPreCommands) | ||
"$CORE_ROOT/crossgen" -ReadyToRun -Platform_Assemblies_Paths "$CORE_ROOT" -out $(MSBuildProjectName).ni.dll $(MSBuildProjectName).dll | ||
export COMPlus_TC_QuickJit=1 | ||
]]></BashCLRTestPreCommands> | ||
</PropertyGroup> | ||
</Project> |