-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Dynamic PGO work planned for .NET 7 #64659
Comments
Tagging subscribers to this area: @JulieLeeMSFT Issue DetailsThis issue captures the planned work for .NET 7. This list is expected to change throughout the release cycle according to ongoing planning and discussions, with possible additions and subtractions to the scope. SummaryDynamic PGO is an opt-in feature introduced in .NET 6. In .NET 7 we will work on making Dynamic PGO easier to use, applicable to more scenarios, and offering more performance improvements. Planned for .NET 7
Under Consideration
|
Hi! ...Sorry if this isn't the correct place for this post... I've been playing around with PGO in .net 6 with mostly excellent results, but... I've hit one case where it appears (to ignorant me) that the statistics collecting method isn't being replaced by the optimized version (well at least that is my simple understanding of what PGO should be doing...) Anyway I'm not sure what information I can provide, I have tried creating a simple test case (with BenchmarkDotNet) but when it the simple case it appeared to do the "correct thing". i.e. works at the equivalent-ish speed. But in my "production" case it consistently, without fail, always generates badness. The method is generated using Expression trees - i.e. compiled Lambda - but is just a very simple object construction based on a
The It works perfectly fine and performant in "normal" .net 6, or with the PGO environmental variables set and debug build (although I assume that's just because it doesn't engage the PGO engine?). As you can see in the image from the profiler, the compiled lambda, and a function (It's called in a tight loop, populating an Anyway, it's in proprietary code, and given that my simplified version didn't exhibit the same issue, I'm not sure what I can offer, but you can direct me to provide further information if you feel the need. Edit: the code that generates the deserializer is used on numerous types - i.e standard reflection based Expression treee creation stuff. In the "production" run it seems to work fine for about a dozen Types, only running slowly for a single one. And noted above, even that single one, when done is an isolated project, worked as expected. Hmmm. |
No worries, this is a good place. What environment vars are you setting? If you've set If so, the general fix for this is On Stack Replacement (aka OSR) which will be on by default in .NET 7 Preview 4. There is an unsupported early version of OSR in .NET 6 which may or may not work... feel free give it a try by setting You can also mitigate in source if you can restructure the code so that your loop is tiled into a two-level loop where the inner loop is in a helper method and the outer loop runs at least 30 iterations (split 10,000 into say -> 100 x 100). I realize this may not be easy if you don't have explicit looping. |
Yes indeed I had I did try splitting the loop, but couldn't seem to force it out of Tier0. I also looked at setting Anyway, my main concern that this could of been an issue going forward has been alleviated, so thank for that. |
Work for .NET 7 is completed. |
This issue captures the planned work for .NET 7. This list is expected to change throughout the release cycle according to ongoing planning and discussions, with possible additions and subtractions to the scope.
Summary
Dynamic PGO is an opt-in feature introduced in .NET 6. In .NET 7 we will work on making Dynamic PGO easier to use, applicable to more scenarios, and offering more performance improvements.
As part of this work, we will also enable On-Stack Replacement (OSR) and change the default for QuickJitForLoops for x64 and arm64. This will improve Dynamic PGO by including methods with loops in the Tier0 set. It will also notably improve startup time for apps that have jit-intensive startup interval.
Planned for .NET 7
Under Consideration
Cut from .NET 7 Plans
The text was updated successfully, but these errors were encountered: