Skip to content

Conversation

amanasifkhalid
Copy link
Contributor

I noticed that tweaking the computation of the entry weight for OSR methods (in service of #111915) incurred large inlining diffs. This is due to the fact that we use the entry block's weight to compute the normalized weight of a call site. This means we will get the wrong normalized weight for call sites when the entry block's weight diverges from the method's call count. This is currently possible only when the entry block is part of a loop, or when we compute a weight for the OSR entry fixup block that differs from fgCalledCount (which we almost always do). The correct thing to do is to use the root method's call count to normalize the call site's weight.

@Copilot Copilot AI review requested due to automatic review settings February 12, 2025 20:40
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.

Files not reviewed (1)
  • src/coreclr/jit/importer.cpp: Language not supported

@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Feb 12, 2025
Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

@amanasifkhalid
Copy link
Contributor Author

@dotnet/jit-contrib PTAL. Diffs seem to be only in OSR methods. In the cases where we're now doing less inlining, the OSR loop's execution count is less than 100x the method call count; the opposite is true for cases where we're doing more inlining. With this change, we're doing fewer inlines overall. Thanks!

@amanasifkhalid
Copy link
Contributor Author

@AndyAyersMS could you PTAL? Thanks!

@amanasifkhalid
Copy link
Contributor Author

ping @AndyAyersMS

@amanasifkhalid amanasifkhalid merged commit c37cfcc into dotnet:main Feb 18, 2025
112 checks passed
@amanasifkhalid amanasifkhalid deleted the fix-inlinee-weight-comp branch February 18, 2025 17:26
amanasifkhalid added a commit that referenced this pull request Feb 19, 2025
Follow-up to #112499. By ensuring OSR method entry blocks' weights match fgCalledCount during entry canonicalization, we can guarantee that later runs of profile synthesis won't modify fgCalledCount. This should unblock #111915 (comment).
@github-actions github-actions bot locked and limited conversation to collaborators Mar 21, 2025
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