-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[NO-MERGE / DESIGN DISCUSSION ONLY] Infra fixes for Ivan's JIT count test #90647
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
Conversation
This change combines Ivan's private branch 'jit-participants' with a couple of infra fixes to make his test work. The fundamental remaining piece is figuring out how to get rid of the commented out line in XUnitWrapperGenerator.cs, @jkoritzinsky please advise how to check the ProjectReference item for the ReferenceOutputAssembly so that we ignore the reference in the merged wrapper generator when it's set to false - i.o.w. when the project doesn't intend to use the reference as a direct component of its managed executable, it's rather intented as a payload that's manipulated in a special manner at runtime. I assume that, once we clarify this one remaining problem, I'll send out the PR for the build script changes; that should subsequently let Ivan adapt my changes to his test case based on his discretion and make it fully functional both locally and in the lab. Thanks Tomas
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsThis change combines Ivan's private branch 'jit-participants' I assume that, once we clarify this one remaining problem, I'll send Thanks Tomas
|
| </ItemGroup> | ||
|
|
||
| <PropertyGroup> | ||
| <ProjectAssetsFile>$(JitPackagesConfigFileDirectory)benchmark/obj/project.assets.json</ProjectAssetsFile> |
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.
Do we know if this is actually necessary? I don't think we're using it in other tests.
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="HelloWorld/HelloWorld.csproj"> | ||
| <ReferenceOutputAssembly>false</ReferenceOutputAssembly> |
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 clause is what I believe should tell the merged wrapper generator that we should skip this reference as it's not supposed to be a direct project component.
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.
You might also need to change the OutputItemType to Content to get it to not warn.
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.
Hmm, is that somehow related to the next line or something completely different?
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.
Sorry, didn't see that under the comment. You're right, nevermind.
| startInfo.EnvironmentVariables.Add("DOTNET_JitDisasmSummary", "1"); | ||
| startInfo.EnvironmentVariables.Add("DOTNET_TieredCompilation", "0"); | ||
| startInfo.EnvironmentVariables.Add("DOTNET_ReadyToRun", "1"); | ||
| startInfo.EnvironmentVariables.Add("DOTNET_JitStdOutFile", jitOutputFile); |
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 tried this without the stdout file redirection and it seemed to work for me when I specified RedirectStandardOutput=true in the ProcessStartInfo constructor and I used app.StandardOutput.ReadToEnd() before the call to WaitForExit. Having said that, using the DOTNET variable for explicit specification of JIT standard output seems easier at the very least because the app emits the Hello world! string at the last line and you'd need to modify the parser to cope with that.
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 using DOTNET_JitStdOutFile is the better way for these main reasons:
- It's self-explanatory as to what we're doing with that file.
- We don't have to parse the app's output out of the way, plus only having the jitted methods can make investigations easier.
- The fact dotnet keeps eating the output on my machine is concerning. There might be some underlying bug that only seems to repro under specific circumstances, and it makes this test give incorrect results when it happens.
| string[] lines = File.ReadAllLines(jitOutputFile); | ||
|
|
||
| Console.WriteLine("=========== App standard output ==========="); | ||
| foreach (string line in lines) |
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 leave it up to you how verbose you decide the output should be but please keep in mind that sufficient diagnostic information can typically substantially speed up bug investigation.
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.
Yeah I was planning to print everything afterwards. I only had the short output you saw first to make it easier to see whether the test was running appropriately.
| public class JittedMethodsCounter | ||
| { | ||
| [Fact] | ||
| public static int TestEntryPoint() |
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'm not sure about this one, is that an earlier version of the test you're working on now so that we should ultimately get rid of it or are you envisioning two different modes of testing?
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 going to be removed. It slipped through. The actual test is the other file you reviewed.
| int appResult = RunHelloWorldApp(appName, jitOutputFile); | ||
| int jits = GetNumberOfJittedMethods(jitOutputFile); | ||
|
|
||
| return jits > 0 && jits <= MAX_JITTED_METHODS_ACCEPTED ? 100 : 101; |
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.
Please note that I added a check that the number of JITted methods is nonzero. I firmly believe it's even beyond the scope of .NET 9 to achieve JIT runtime count being zero and, while I'll be the first person to celebrate the milestone, for now the zero value most likely means something has just malfunctioned. Please take it as a reviewer suggestion to consider.
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 didn't know 0 meant an error in this case. Thanks for the observations Tomas!
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.
Well, I'm not saying that zero is strictly wrong, a time may come when, say, "dotnet new webapi" will indeed runtime JIT 0 methods at startup (meaning that Crossgen2 precompilation has become "perfect" for this particular app), however that is not happening today and my feeling is that hitting zero today would much more likely signify an infra issue like the log not being generated or properly parsed. I'm looking forward to the time when 0 is the expected value and anything else is investigated as a Crossgen2 bug :-).
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.
It will be part of the celebration. That day I adjust this test so that zero jitted methods can be a potentially expected result :)
trylek
left a comment
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 have made some tiny fixes around launching the managed app - in the Helix lab it's much easier and actually desirable to run managed apps via "corerun" than using "dotnet" especially as corerun is the freshly built thing, not some month-old preview drop; there were also a few tiny syntactic bugs but other than that your new test looks great to me, thanks Ivan!
|
Is the generator warning on the HelloWorld project or on the merged test runner project? If it's on the Hello World project, then the correct solution is to disable the reference to the generator from that project as it isn't a test project. |
|
@jkoritzinsky - I believe it's no longer on the HelloWorld project, that gets now excluded via the |
| Console.WriteLine("Launching: {0} {1}", startInfo.FileName, startInfo.Arguments); | ||
|
|
||
| startInfo.EnvironmentVariables.Add("DOTNET_JitDisasmSummary", "1"); | ||
| startInfo.EnvironmentVariables.Add("DOTNET_TieredCompilation", "0"); |
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.
Should this be testing the default config (ie DOTNET_TieredCompilation=1)?
|
Closing this one in favor of #90681. |
This change combines Ivan's private branch 'jit-participants'
with a couple of my infra fixes to make his test work. The fundamental
remaining piece is figuring out how to get rid of the commented out
line in XUnitWrapperGenerator.cs, @jkoritzinsky please advise how
to check the ProjectReference item for the ReferenceOutputAssembly
so that we ignore the reference in the merged wrapper generator
when it's set to false - i.o.w. when the project doesn't intend to
use the reference as a direct component of its managed executable
so that it's rather intended as a payload that's manipulated in a special
manner at runtime.
I assume that, once we clarify this one remaining problem, I'll send
out the PR for the build script changes; that should subsequently
let Ivan adapt my changes to his test case based on his discretion
and make it fully functional both locally and in the lab.
Thanks
Tomas