Skip to content
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

Add New Test to Track Number of Jitted Methods #91235

Merged
merged 24 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
7b31090
New beginning for the Jitted Methods Counting Test.
ivdiazsa Aug 28, 2023
b565e74
EXPERIMENTAL CHANGE ONLY: Added a command to print the whole directory
ivdiazsa Aug 29, 2023
2317a4b
experimental change only: Discovered the jobs have dependencies on
ivdiazsa Aug 29, 2023
caf11e8
EXPERIMENT-ONLY CHANGE: Added the 'ls -R' directly to the Helix Post
ivdiazsa Aug 30, 2023
fda5625
Merge branch 'main' into jitted-parts
ivdiazsa Aug 30, 2023
efd048d
Maybe it doesn't like me removing the innerloop...?
ivdiazsa Aug 30, 2023
d243aef
More experimenting... So we can't do just musl...
ivdiazsa Aug 30, 2023
90b639e
Merge branch 'main' into jitted-parts
ivdiazsa Aug 31, 2023
87212da
Changed the test's methodology to use the JitInfo API, instead of
ivdiazsa Aug 31, 2023
7c3cca8
Added the `AlwaysUseCrossgen2` property to the HelloWorld test app.
ivdiazsa Sep 5, 2023
85f3317
Now printing the Jitted Methods to compare with my local machine.
ivdiazsa Sep 6, 2023
0893d48
REVIEW-READY: Reenabled all the pipelines to see if there are any
ivdiazsa Sep 7, 2023
35bc35e
Changed the Jitted methods counter to consider the whole process,
ivdiazsa Sep 7, 2023
cf7996b
DEBUG-ONLY CHANGE: We're getting more Jitted methods on Arm64 for some
ivdiazsa Sep 8, 2023
bb026de
Merge branch 'main' into jitted-parts
ivdiazsa Sep 8, 2023
1a33f0b
Enabled musl outerloop pipelines because we were observing different
ivdiazsa Sep 8, 2023
88d59f2
Will you stop complaining now?
ivdiazsa Sep 8, 2023
ad3f2fd
READY: Reenabled the pipelines and disabled the test for R2R_CG2
ivdiazsa Sep 11, 2023
b99398d
Changed the jits-number limit.
ivdiazsa Sep 11, 2023
adbb0b2
Changed the test to not require an external app anymore, and fixed
ivdiazsa Sep 12, 2023
1e81e8a
DEBUG-ONLY CHANGE: Printing some logging to try to figure out why
ivdiazsa Sep 18, 2023
ad7a855
...
ivdiazsa Sep 18, 2023
376b205
...
ivdiazsa Sep 18, 2023
d9cb394
Due to how some machines are set up, it is actually possible for a
ivdiazsa Sep 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/coreclr/vm/jitinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,14 @@ FCIMPLEND
FCIMPL1(INT64, GetCompiledMethodCount, CLR_BOOL currentThread)
{
FCALL_CONTRACT;

// WIP-DEBUG-ONLY change: Windows is causing problems in the CI, but can't
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This WIP code needs to be reverted!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I forgot! Good catch, Jan. I will submit a PR fixing that right away.

// be replicated locally. Using this for some logging there to try to figure
// it out.
printf("\nENTERING GETCOMPILEDMETHODCOUNT:");
printf("%d\n", currentThread ? 1 : 0);
printf("%ld\n", (long) t_cMethodsJittedForThread);
printf("%ld\n", (long) AtomicLoad64WithoutTearing(&g_cMethodsJitted));
printf(":EXITING GETCOMPILEDMETHODCOUNT\n");
return currentThread ? t_cMethodsJittedForThread : AtomicLoad64WithoutTearing(&g_cMethodsJitted);
}
FCIMPLEND
Expand Down
3 changes: 2 additions & 1 deletion src/tests/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
<Target Name="CheckForTestOutsideOfGroup" BeforeTargets="Build">
<Error Condition="'$(InMergedTestDirectory)' == 'true'
and '$(OutputType)' == 'Exe'
and '$(_CLRTestNeedsToRun)' == 'true'
and '$(RequiresProcessIsolation)' != 'true'
and '$(BuildAsStandalone)' != 'true'
and '$(IsMergedTestRunnerAssembly)' != 'true'"
Expand Down Expand Up @@ -510,7 +511,7 @@
</ItemGroup>
</Target>

<PropertyGroup Condition="'$(Language)' == 'C#' and ('$(BuildAsStandalone)' == 'true' or '$(RequiresProcessIsolation)' == 'true' or '$(InMergedTestDirectory)' == 'true' or '$(IsMergedTestRunnerAssembly)' == 'true')">
<PropertyGroup Condition="'$(Language)' == 'C#' and '$(_CLRTestNeedsToRun)' == 'true' and ('$(BuildAsStandalone)' == 'true' or '$(RequiresProcessIsolation)' == 'true' or '$(InMergedTestDirectory)' == 'true' or '$(IsMergedTestRunnerAssembly)' == 'true')">
<ReferenceXUnitWrapperGenerator Condition="'$(ReferenceXUnitWrapperGenerator)' == ''">true</ReferenceXUnitWrapperGenerator>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using Xunit;

using InteropServices = System.Runtime.InteropServices;
using JitInfo = System.Runtime.JitInfo;

public class JittedMethodsCountingTest
{
private const int MAX_JITTED_METHODS_ACCEPTED = 70;

[Fact]
public static int TestEntryPoint()
{
// If DOTNET_ReadyToRun is disabled, then this test ought to be skipped.
if (!IsReadyToRunEnvSet())
{
Console.WriteLine("\nThis test is only supported in ReadyToRun scenarios."
+ " Skipping...\n");
return 100;
}

if (IsRunCrossgen2Set() && IsRunningOnARM64())
{
Console.WriteLine("\nThis test is currently unsupported on ARM64 when"
+ " RunCrossGen2 is enabled. Skipping...\n");
return 100;
}

Console.WriteLine("\nHello World from Jitted Methods Counting Test!");

long jits = JitInfo.GetCompiledMethodCount(false);
Console.WriteLine("Number of Jitted Methods in App: {0}\n", jits);

return (jits >= 0 && jits <= MAX_JITTED_METHODS_ACCEPTED) ? 100 : 101;
}

private static bool IsReadyToRunEnvSet()
{
string? dotnetR2R = Environment.GetEnvironmentVariable("DOTNET_ReadyToRun");
return (string.IsNullOrEmpty(dotnetR2R) || dotnetR2R == "1");
}

private static bool IsRunCrossgen2Set()
{
string? runCrossgen2 = Environment.GetEnvironmentVariable("RunCrossGen2");
return (runCrossgen2 == "1");
}

private static bool IsRunningOnARM64()
{
InteropServices.Architecture thisMachineArch = InteropServices
.RuntimeInformation
.OSArchitecture;

return (thisMachineArch == InteropServices.Architecture.Arm64);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<JitOptimizationSensitive>true</JitOptimizationSensitive>
</PropertyGroup>

<ItemGroup>
<Compile Include="JittedMethodsCountingTest.cs" />
</ItemGroup>

</Project>