Skip to content
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

JIT: don't report profile for methods with insufficient samples during prejitting #55096

Merged
merged 2 commits into from
Jul 5, 2021

Conversation

EgorBo
Copy link
Member

@EgorBo EgorBo commented Jul 2, 2021

Profile for AOT is collected via a special build of an app (all methods stay in tier0 and are instrumented). Let's assume all methods in hot paths are executed at least 1000 times.
I use entryWeight + callSiteWeight > 1000 formula in order to handle hot loops inside cold methods.

image
^ Histogram for entryWeight + callSiteWeight for SPC.dll

This PR drastically reduces R2R size when --Ot is passed to crossgen2 (it means ExtendedDefaultPolicy is used).

New size: 10.06Mb

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jul 2, 2021
@EgorBo
Copy link
Member Author

EgorBo commented Jul 5, 2021

@jakobbotsch could you please take a look?

Copy link
Member

@jakobbotsch jakobbotsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems fine for now, but using raw counts like this in the JIT makes me a bit nervous. E.g. instrumented counts are vastly inflated compared to sampled counts, so comparing them in a raw fashion is difficult.
Ideally this kind of filtering would happen in the training job when the .mibc files are created. We might want to revisit this when we begin consuming SPGO data.

@EgorBo
Copy link
Member Author

EgorBo commented Jul 5, 2021

This seems fine for now, but using raw counts like this in the JIT makes me a bit nervous. E.g. instrumented counts are vastly inflated compared to sampled counts, so comparing them in a raw fashion is difficult.
Ideally this kind of filtering would happen in the training job when the .mibc files are created. We might want to revisit this when we begin consuming SPGO data.

I agree, but initially I wanted to only decrease chances to inline callees in methods with small call counts. But it makes sense only in case if profile was collected by user for his/her specific workflow so the jit can more or less trust it. But it's not the case for the default profile we ship, e.g. it reports just a few calls for "IntPtr.op_Equaliyt(long, long)`. I believe mostly those come from HelloWorld.ibc - I need to check.

@EgorBo EgorBo merged commit efd818b into dotnet:main Jul 5, 2021
@AndyAyersMS AndyAyersMS mentioned this pull request Jul 6, 2021
54 tasks
@EgorBo EgorBo mentioned this pull request Jul 12, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Aug 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants