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: Prevent generic context runaway during inlining of polymorphic recursive methods #90306

Merged
merged 5 commits into from
Aug 12, 2023

Conversation

jakobbotsch
Copy link
Member

The inliner heuristics do not take into account that inlining methods causes type/method loading of the generic context. After #88749 this can quickly cause significant resources to be consumed as part of inlining when polymorphic recursion is involved (the blow-up can be exponential, as we see in the failing test under jitstress).

This PR adds another safe-guard to the recursive inlining check in terms of a complexity limit on the generic context of the inline candidate.

Fix #90144

…ecursive methods

The inliner heuristics do not take into account that inlining methods
causes type/method loading of the generic context. After dotnet#88749 this can
quickly cause significant resources to be consumed as part of inlining
when polymorphic recursion is involved (the blow-up can be exponential,
as we see in the failing test under jitstress).

This PR adds another safe-guard to the recursive inlining check in terms
of a complexity limit on the generic context of the inline candidate.

Fix dotnet#90144
@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 Aug 10, 2023
@ghost ghost assigned jakobbotsch Aug 10, 2023
@ghost
Copy link

ghost commented Aug 10, 2023

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

Issue Details

The inliner heuristics do not take into account that inlining methods causes type/method loading of the generic context. After #88749 this can quickly cause significant resources to be consumed as part of inlining when polymorphic recursion is involved (the blow-up can be exponential, as we see in the failing test under jitstress).

This PR adds another safe-guard to the recursive inlining check in terms of a complexity limit on the generic context of the inline candidate.

Fix #90144

Author: jakobbotsch
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

@jakobbotsch
Copy link
Member Author

@MihuBot

@jakobbotsch
Copy link
Member Author

/azp run runtime-coreclr jitstress, runtime-coreclr libraries-jitstress

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

src/coreclr/vm/jitinterface.cpp Outdated Show resolved Hide resolved
src/coreclr/vm/jitinterface.cpp Outdated Show resolved Hide resolved
src/coreclr/vm/jitinterface.cpp Outdated Show resolved Hide resolved
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
@jakobbotsch jakobbotsch marked this pull request as ready for review August 10, 2023 17:40
@jakobbotsch
Copy link
Member Author

cc @dotnet/jit-contrib PTAL @EgorBo (and @AndyAyersMS if available)

@JulieLeeMSFT
Copy link
Member

PTAL @agocke @MichalStrehovsky .

@JulieLeeMSFT JulieLeeMSFT added this to the 8.0.0 milestone Aug 10, 2023
@EgorBo
Copy link
Member

EgorBo commented Aug 11, 2023

@MihuBot

@EgorBo
Copy link
Member

EgorBo commented Aug 11, 2023

@MihuBot

Ah I didn't notice you already had it 🙂 don't know how to cancel

@ghost ghost locked as resolved and limited conversation to collaborators Sep 11, 2023
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.

JIT: Deep inlining of polymorphic recursion can cause hangs during JIT
4 participants