Skip to content

JIT: Prevent generic context runaway during inlining of polymorphic recursive methods - #90306

Merged
jakobbotsch merged 5 commits into
dotnet:mainfrom
jakobbotsch:fix-90144
Aug 12, 2023
Merged

JIT: Prevent generic context runaway during inlining of polymorphic recursive methods#90306
jakobbotsch merged 5 commits into
dotnet:mainfrom
jakobbotsch:fix-90144

Conversation

@jakobbotsch

Copy link
Copy Markdown
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.
Fixdotnet#90144
@ghostghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Aug 10, 2023
@ghost

Copy link
Copy Markdown

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
Copy Markdown
MemberAuthor

@MihuBot

@jakobbotsch

Copy link
Copy Markdown
MemberAuthor

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

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 2 pipeline(s).

Comment threadsrc/coreclr/jit/fginline.cpp Outdated
Comment threadsrc/coreclr/vm/jitinterface.cpp Outdated
Comment threadsrc/coreclr/vm/jitinterface.cpp Outdated
Comment threadsrc/coreclr/vm/jitinterface.cpp Outdated
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
Copy Markdown
MemberAuthor

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

@JulieLeeMSFT

Copy link
Copy Markdown
Member

PTAL @agocke@MichalStrehovsky .

@JulieLeeMSFTJulieLeeMSFT added this to the 8.0.0 milestone Aug 10, 2023
@EgorBo

Copy link
Copy Markdown
Member

@MihuBot

@EgorBo

Copy link
Copy Markdown
Member

@MihuBot

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

@ghostghost locked as resolved and limited conversation to collaborators Sep 11, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-CodeGen-coreclrCLR 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

@jakobbotsch@JulieLeeMSFT@EgorBo@jkotas