-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Compile System.Private.CoreLib with Crossgen2 by default #44618
Conversation
Does this have an impact on code quality, or is the before/after identical? |
Our measurements so far indicate that Crossgen- and Crossgen2-compiled SPC should be almost identical with regards to runtime performance, working set and size on disk. Having said that, merging this commit will throw a much broader set of tests at the library so I cannot rule out some outlier popping up, that's why this change is intentionally trivial to revert. @mangod9 also suggested that I shoot a heads-up e-mail to the runtime repo committers once this goes in to help identify the cause of any issues that may appear. |
Ok, thanks. |
There appears to be a build failure on OSX? |
The Linux x64 crossgen2 invocation failed. It has failed with an assert:
|
The win x86 and OSX x64 too |
Got it, @EgorBo's change 819a3cc#diff-ff19628c24a151a3f919c197c4785be0c9b10fa61f2e61beb4e4867b676dcc8c removed two intrinsics without updating the assertion check at
I'll send out the fix as a separate PR to keep this switch-over PR trivial to rollback. |
PR is out: #44624 |
Before you merge, it would be good for @DrewScoggins to verify we're not seeing any perf lab outage, so if we see any regressions we have a dense set of runs to help pin down which change is responsible. |
I've booked vacation from Friday till next Tuesday. Assuming I manage to check in the fix for the assertion check tomorrow morning before I leave, I would be probably inclined to check this in on Saturday or Sunday - this should hopefully also make it easier to identify potential fallout of this change as the rate of check-ins is usually lower over the weekend. |
Currently lab testing in an instrumented run including the fix for the assertion check: #44625 |
cc @dotnet/jit-contrib Please make sure there's a good writeup somewhere on how to repro and debug crossgen2 errors (particularly what happens if the jit asserts or crashes, and how to pass complus settings), as the first problems a jit developer often sees with new jit code surface during the crossgen of SPC that's done by the build. We also need to make sure PMI, SPMI, and our automated SPMI collection processes are ready. @sandreenko weren't you looking at this recently? |
@AndyAyersMS crossgen2 has been validated with various weekly CI jobs, this change essentially now compiles s.p.corelib.dll by default. Is your concern mainly that there are going to be some JIT failures which might be difficult to debug? Regardless we can certainly get a runbook created for debugging steps. |
Btw, I still have #43017 out to make the Checked build actually different from a Release build and have asserts fire consistently. I need a signoff to merge, but I guess we need to fix the regression first. |
@trylek Could you just comment out the line |
@DrewScoggins, I have pushed the change to run perf scenarios. |
@mangod9 because the newly built jit runs during the crossgen steps of the build, changes to the jit can cause build failures. So often the first debugging one does as part of changing the jit is to fix the issues that arise during crossgen. You often have to do this before running simple tests, if that step of the build can't easily be bypassed. Since the crossgen run is kicked off by the build it may not be easy to figure out how to repro and understand these failures by say running the same thing under the debugger. Thus it's essential that the debugging experience be well documented, eg what command lines are needed, how to specify which jit is being invoked, how to tunnel through the complus settings that are useful when investigating jit issues. We also often use crossgen for estimating throughput of jit changes. I suspect this is not going to work very well anymore with crossgen2, but we'll have to see. |
Yeah thats fair. We will work on putting these together. |
SPMI is ready for crossgen2, not sure if we have jitutils support for it to do asm diffs. However, the debugging experience with crossgen2 was worse than crossgen for me in the past, because:
|
@DrewScoggins could you please check the Linux x64 runtime-perf failures, if they are perf related? |
I added support for asm diffs with crossgen2 a year ago in dotnet/jitutils#228 and dotnet/jitutils#234. It may need to be tweaked if crossgen2 command line args have changed since then. Also, we'll probably need to control crossgen2 multithreading. |
Curious, how do we see the perf results? |
These results are not saved, nor are they even applicable. These tests just run the tests on VMs for a single iteration to ensure that they have not been broken by the change, not to investigate regressions or improvements. |
The OSX x64 failure is known, #45088. |
OK, after one retry the PR run is green now. I have triggered the outerloop run and I intend to merge this in tomorrow European morning (around PST midnight) assuming it reasonably passes and no-one objects. I believe this to be the perfect moment - around Thanksgiving the traffic is pretty low so any potential regression will stand out. As discussed previously, I'll send a heads-up e-mail to the runtime repo committers to watch out for any weird behavior after the merge. Thanks everyone for help with various aspects of this change! |
sounds like a good plan. Thanks @trylek |
3d541e5
to
201b00e
Compare
After I deleted the Utf8String-related experimental code from the runtime repo per JanK's suggestion, I can now enable Crossgen2 compilation for System.Private.CoreLib by default. Thanks Tomas
This reverts commit 01c1559872a322469eeceb8bea9084a1d104bc2f.
201b00e
to
4f8f6d8
Compare
Other than the file size regression, crossgen2 is great! 🙂 # ubuntu x64
$ ./build.sh -c Release
$ du -h artifacts/bin/coreclr/Linux.x64.Release/System.Private.CoreLib.dll
# before
8.9M artifacts/bin/coreclr/Linux.x64.Release/System.Private.CoreLib.dll
# after
9.6M artifacts/bin/coreclr/Linux.x64.Release/System.Private.CoreLib.dll |
Thanks @am11 for pointing that out, I'll take a look. That is surprising as the last time I looked, the CG2 version was actually shorter. |
OK, so I took a first look using the R2RDump --diff function. I tried this on Windows x64 as there's basically no size difference between the Windows and Linux version (the only actual difference being slightly different calling convention implying subtle changes in some JITted method lengths). The total difference is about 850 KB; almost half of this delta, 380 KB, corresponds to the section |
…net#44618)" This reverts commit b79e4d3.
After I deleted the Utf8String-related experimental code from the
runtime repo per JanK's suggestion, I can now enable Crossgen2
compilation for System.Private.CoreLib by default.
Thanks
Tomas
/cc: @dotnet/crossgen-contrib