-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Never set fgPgoSingleEdge for cctors or large single-edge blocks #117420
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
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
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.
Pull Request Overview
This PR refines the JIT’s optimization mask and enhances profile synthesis to avoid giving inlining boosts to static constructors or large single-edge methods.
- Reduced the set of flags in
CLFLG_MAXOPT
to a smaller subset. - In
ProfileSynthesis::Run
, skipfgPgoSingleEdge
for static constructors, size-optimized methods, or methods with many calls.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/coreclr/jit/jit.h | Updated CLFLG_MAXOPT to only include a few core optimizations |
src/coreclr/jit/fgprofilesynthesis.cpp | Added checks to disable single-edge PGO for cctors, size-opt, and call-heavy methods |
Comments suppressed due to low confidence (2)
src/coreclr/jit/jit.h:757
- Add or update a comment above this macro explaining why certain flags were removed and what the new target optimization level represents.
#define CLFLG_MAXOPT (CLFLG_REGVAR | CLFLG_TREETRANS | CLFLG_INLINING | CLFLG_STRUCTPROMOTE)
src/coreclr/jit/fgprofilesynthesis.cpp:256
- Consider adding tests or a profiling scenario to verify that static constructors and methods exceeding the call threshold are not granted
fgPgoSingleEdge
.
m_comp->fgPgoSingleEdge = !isCctor && !preferSize;
@AndyAyersMS anything else? cc @dotnet/jit-contrib |
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.
Did you try it out on methods like the .cctor
that we looked at the other day?
From the diffs at least it looks like it is doing what we expect.
Yep, checked locally. |
Static cctors tend to be huge and single-edge (e.g. some List or Dictionary static field initialized with a lot of items inline) - if they're compiled with JIT optimizations (TC=0 or dynamic context) - they should not receive an extra inlining boost from #116054. Same for just large single-edge methods.