Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/coreclr/jit/fginline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,17 @@ PhaseStatus Compiler::fgInline()
Metrics.ProfileConsistentBeforeInline++;
}

if (!fgHaveProfileWeights())
{
JITDUMP("INLINER: no pgo data\n");
}
else
{
JITDUMP("INLINER: pgo source is %s; pgo data is %sconsistent; %strusted; %ssufficient\n",
compGetPgoSourceName(), fgPgoConsistent ? "" : "not ", fgHaveTrustedProfileWeights() ? "" : "not ",
fgHaveSufficientProfileWeights() ? "" : "not ");
}

noway_assert(fgFirstBB != nullptr);

BasicBlock* block = fgFirstBB;
Expand Down
13 changes: 13 additions & 0 deletions src/coreclr/jit/inlinepolicy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1372,13 +1372,24 @@ void ExtendedDefaultPolicy::NoteInt(InlineObservation obs, int value)
// TODO: Enable for PgoSource::Static as well if it's not the generic profile we bundle.
if (m_HasProfileWeights && (m_RootCompiler->fgHaveTrustedProfileWeights()))
{
JITDUMP("Callee and root has trusted profile\n");
maxCodeSize = static_cast<unsigned>(JitConfig.JitExtDefaultPolicyMaxILProf());
}
else if (m_RootCompiler->fgHaveSufficientProfileWeights())
{
JITDUMP("Root has sufficient profile\n");
maxCodeSize = static_cast<unsigned>(JitConfig.JitExtDefaultPolicyMaxILRoot());
}
else
{
JITDUMP("Callee has %s profile\n", m_HasProfileWeights ? "untrusted" : "no");
}

unsigned alwaysInlineSize = InlineStrategy::ALWAYS_INLINE_SIZE;
if (m_InsideThrowBlock)
{
// Inline only small code in BBJ_THROW blocks, e.g. <= 8 bytes of IL
JITDUMP("Call site in throw block\n");
alwaysInlineSize /= 2;
maxCodeSize = min(alwaysInlineSize + 1, maxCodeSize);
}
Expand All @@ -1401,6 +1412,7 @@ void ExtendedDefaultPolicy::NoteInt(InlineObservation obs, int value)
else
{
// Callee too big, not a candidate
JITDUMP("Callee IL size %u exceeds maxCodeSize %u\n", m_CodeSize, maxCodeSize);
SetNever(InlineObservation::CALLEE_TOO_MUCH_IL);
}
break;
Expand All @@ -1425,6 +1437,7 @@ void ExtendedDefaultPolicy::NoteInt(InlineObservation obs, int value)

if ((unsigned)value > bbLimit)
{
JITDUMP("Callee BB count %u exceeds bbLimit %u\n", value, bbLimit);
SetNever(InlineObservation::CALLEE_TOO_MANY_BASIC_BLOCKS);
}
}
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/jit/jitconfigvalues.h
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,7 @@ CONFIG_STRING(JitInlineReplayFile, "JitInlineReplayFile")
// relies on PGO if it exists and generally is more aggressive.
RELEASE_CONFIG_INTEGER(JitExtDefaultPolicy, "JitExtDefaultPolicy", 1)
RELEASE_CONFIG_INTEGER(JitExtDefaultPolicyMaxIL, "JitExtDefaultPolicyMaxIL", 0x80)
RELEASE_CONFIG_INTEGER(JitExtDefaultPolicyMaxILRoot, "JitExtDefaultPolicyMaxILRoot", 0x100)
RELEASE_CONFIG_INTEGER(JitExtDefaultPolicyMaxILProf, "JitExtDefaultPolicyMaxILProf", 0x400)
RELEASE_CONFIG_INTEGER(JitExtDefaultPolicyMaxBB, "JitExtDefaultPolicyMaxBB", 7)

Expand Down
Loading