-
Notifications
You must be signed in to change notification settings - Fork 783
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
FSC: Consider enabling background JIT with non-dynamic PGO for faster compilation #15434
Comments
This feels like a low-cost high value performance improvement. Are there plans to pick it up again? @vzarytovskii |
The main idea is to rely on R2R to save time for startup, #13328 should improve R2R coverage. What exactly did you measure - the |
The
Warmup run (no existing profile): 965ms |
I suspect it highlights the gap in R2R coverage rather than motivates to enable profile-driven Multicore JIT. Ideally, F# compiler should jit nothing to compile an app |
If making it do no JIT is as easy as using background JIT then sure. But is it really, given that it's been looked at a year ago but didn't get any traction? Personally I would be very happy to use opt-in background JIT right now, instead of waiting. |
You need to measure its impact on large codebases too first, e.g. .NET 8.0 has dynamic PGO enabled by default that might help for long-running processes, but Multicore JIT won't use it afair. Although, I know very little about it and how well tested it is maybe @jkotas knows better? |
Yeah, it's currently in progress, but unfortunately involves a lot more infrastructure changes than just having some flag enabled somewhere. |
@EgorBo you're right that I should do more testing. Although I'd argue that reducing compilation time of tiny projects would go a long way encouraging people to try fsharp. Compilation is not really a long running process though. It would be if we used compiler service but we don't. @vzarytovskii The in-progress solution not being trivial is my point. The flag I tested is 3 lines of code and requires no changes in the deployment. The profile can be generated by the user in a temp directory, with different profile for different project name being compiled. If it was available right now, I would definitely want to try it. |
Multicore JIT is supported feature. If you run into functional problems with it, we will investigate them. It is used by Powershell. |
It only looks like it :) We need to make changes to several places, including (probably) our signed build (both SDK and VS), dotnet/dotnet, source build, maybe something else (because we don't "maintain" flags for publishing). MIBC might be the easiest solution here (I have added almost everything which is needed, so it's already in progress). |
Hey @safesparrow - I am looking through the startup perf related issues and trying to get my head around them. Regarding this particular ticket, does it still hold?
I am just starting with this topic so might be horribly missing something. I will be primarily looking into MIBC but just wanted to understand if your particular suggestion here is still relevant. |
This item should be closed in favour using mibc profiles runtime provides for us. |
The FSC_Profile was an env var that my local version of the compiler exe used to decide if it should generate/read the JIT profile or not at startup. I haven't looked into this in a long time and won't have much time to look at it again soon. I'd be happy if any low hanging fruit were implemented - unless those are already in the latest compiler. |
Thanks for the clarification. Yeah, we're looking into this, stay tuned :) |
Context
I noticed that JIT takes a considerable amount of time in compilation, and the fraction of time it takes is especially high for small projects.
I experimented with using non-dynamic PGO for JITting to allow JITting to happen in the background, before its results are needed.
Tests
I tested it against an empty project from the
dotnet
template (just one file). The PGO-enabled compilation was ~300ms faster (~0.95s -> ~0.65s). I generated the profile by running compilation on the same test project a few times, and measured timings then.Here is a profile showing JIT work happening without PGO:
It shows 1200ms of JIT on the main thread, and similar amount on other threads (mostly blocking actual work).
Here is a profile showing JIT work happening with PGO:
It shows 835ms of JIT on the main thread, ~700ms on other work threads, and 1250ms on a dedicated JITting thread (CLR worker).
Questions
The text was updated successfully, but these errors were encountered: