Skip to content

Commit 7c5ea10

Browse files
authored
JIT: constrain max IL size for OSR inlining (#117816)
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.
1 parent b387738 commit 7c5ea10

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/coreclr/jit/inlinepolicy.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,15 +1377,21 @@ void ExtendedDefaultPolicy::NoteInt(InlineObservation obs, int value)
13771377
}
13781378
else if (m_RootCompiler->fgHaveSufficientProfileWeights())
13791379
{
1380-
// For now we want to inline somewhat less aggressively in Tier1+Instr. We can reconsider
1380+
// For now we want to inline somewhat less aggressively in Tier1+Instr and OSR. We can reconsider
13811381
// when we have inlinee instrumentation. Otherwise we may lose profile data for key inlinees.
13821382
//
13831383
const bool isTier1Instr = m_RootCompiler->opts.IsInstrumentedAndOptimized();
1384-
JITDUMP("Root has sufficient profile%s\n",
1385-
isTier1Instr ? "; but we are not boosting max IL size for Tier1+Instr" : "");
1386-
if (!isTier1Instr)
1384+
const bool isOSR = m_RootCompiler->opts.IsOSR();
1385+
1386+
if (isTier1Instr || isOSR)
1387+
{
1388+
JITDUMP("Root has sufficient profile. Leaving max IL size at %u for Tier1+Instr or OSR\n",
1389+
maxCodeSize);
1390+
}
1391+
else
13871392
{
13881393
maxCodeSize = static_cast<unsigned>(JitConfig.JitExtDefaultPolicyMaxILRoot());
1394+
JITDUMP("Root has sufficient profile. Boosting max IL size to %u\n", maxCodeSize);
13891395
}
13901396
}
13911397
else

0 commit comments

Comments
 (0)