Skip to content

Conversation

@AndyAyersMS
Copy link
Member

We currently stop inlining once we hit a fixed limit of 512 local vars (specified via MAX_LV_NUM_COUNT_FOR_INLINING). We hit this limit now more often because of increased inliner aggressiveness, and at any rate it should be some fraction of JitMaxLocalsToTrack instead of a fixed value.

When the inliner hits this limit it often leaves quite valuable inlines on the table.

Revise this so the inliner is allowed to consume 90% of the max locals during inlining (50% would be a no-diff change).

This fixes some regressions reported in #114996 which were then made worse by #116054.

We currently stop inlining once we hit a fixed limit of 512 local vars
(specified via `MAX_LV_NUM_COUNT_FOR_INLINING`). We hit this limit now
more often because of increased inliner aggressiveness, and at any rate
it should be some fraction of `JitMaxLocalsToTrack` instead of a fixed
value.

When the inliner hits this limit it often leaves quite valuable inlines
on the table.

Revise this so the inliner is allowed to consume 90% of the max locals
during inlining (50% would be a no-diff change).

This fixes some regressions reported in dotnet#114996 which were then made
worse by dotnet#116054.
Copilot AI review requested due to automatic review settings August 8, 2025 02:55
@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 Aug 8, 2025
Copy link
Contributor

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 changes how the JIT inliner determines when to stop inlining due to local variable limits. Instead of using a hard-coded limit of 512 locals, it now uses 90% of the dynamically configured maximum locals to track (JitMaxLocalsToTrack).

  • Replaces fixed MAX_LV_NUM_COUNT_FOR_INLINING constant with a percentage-based check
  • Allows the inliner to use up to 90% of the available local variable budget
  • Aims to address performance regressions by enabling more valuable inlining opportunities

@dotnet-policy-service
Copy link
Contributor

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

@AndyAyersMS
Copy link
Member Author

@dotnet/jit-contrib FYI
@EgorBo PTAL

I think we should seriously consider taking this for .NET 10, we can always tune it back later if we don't like the results. No way to get a clear read short of running in the perf lab.

Copy link
Member

@tannergooding tannergooding left a comment

Choose a reason for hiding this comment

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

Seems like a positive change all around

@tannergooding
Copy link
Member

Do you know what the spmi diff failures are from? It looks like a few threw exceptions but it isn’t clear from the log what actually marked it as “failed”. Seems like a potential infra issue (non blocking) we might want to track getting resolved

@jakobbotsch
Copy link
Member

Do you know what the spmi diff failures are from? It looks like a few threw exceptions but it isn’t clear from the log what actually marked it as “failed”. Seems like a potential infra issue (non blocking) we might want to track getting resolved

It looks like JIT is segfaulting. I see it on other runs of superpmi-diffs too. I opened #118522 for it.

@EgorBo
Copy link
Member

EgorBo commented Aug 8, 2025

@MihuBot

@AndyAyersMS
Copy link
Member Author

@EgorBot --intel --arm --filter *.WriteBasicUtf8*

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.

4 participants