Skip to content

JIT: constrain max IL size for OSR inlining #117816

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

Merged
merged 1 commit into from
Jul 18, 2025

Conversation

AndyAyersMS
Copy link
Member

If we inline too aggressively at intermediate tiers, we can lose profile data that would be beneficial at the final tier.

Extend the recent fixes made for limiting max IL size at Tier1+Instr to include OSR as well. This one is a arguably bit more delicate as OSR may well be the final tier, but there is no way to know that.

We are just returning to the .NET 9 behavior here.

Fixes #117717. May also fix some of the other regressions that have not yet been analyzed in depth.

If we inline too aggressively at intermediate tiers, we can lose profile
data that would be beneficial at the final tier.

Extend the recent fixes made for limiting max IL size at Tier1+Instr to
include OSR as well. This one is a arguably bit more delicate as OSR may
well be the final tier, but there is no way to know that.

We are just returning to the .NET 9 behavior here.

Fixes dotnet#117717. May also fix some of the other regressions that have
not yet been analyzed in depth.
@Copilot Copilot AI review requested due to automatic review settings July 18, 2025 15:26
@github-actions github-actions bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jul 18, 2025
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.

Pull Request Overview

This PR constrains the maximum IL size for OSR (On-Stack Replacement) inlining to prevent overly aggressive inlining that could result in loss of valuable profile data for final tier compilation. The change extends existing Tier1+Instrumented compilation limits to also apply to OSR scenarios, reverting to .NET 9 behavior.

Key changes:

  • Extends IL size constraints from Tier1+Instrumented scenarios to also include OSR compilation
  • Updates logging messages to reflect the new OSR consideration
  • Adds explicit logging for both constrained and boosted scenarios

@AndyAyersMS
Copy link
Member Author

@EgorBo PTAL
cc @dotnet/jit-contrib

Copy link
Contributor

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

Copy link
Member

@JulieLeeMSFT JulieLeeMSFT left a comment

Choose a reason for hiding this comment

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

LGTM.

@AndyAyersMS
Copy link
Member Author

Diffs

SPMI won't give us the whole picture here, but clearly we're doing quite a bit less inlining in OSR methods.

Copy link
Member

@amanasifkhalid amanasifkhalid left a comment

Choose a reason for hiding this comment

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

LGTM too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.

Performance regression of ~+50% in LINQ(?) in .NET 10 compared to .NET 9
3 participants