Skip to content

Commit

Permalink
Disable over-ILsize for generic static pgo
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorBo committed Jul 13, 2021
1 parent 4d0bf98 commit e948d10
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions src/coreclr/jit/inlinepolicy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1337,7 +1337,8 @@ void ExtendedDefaultPolicy::NoteInt(InlineObservation obs, int value)
m_CodeSize = static_cast<unsigned>(value);
unsigned maxCodeSize = static_cast<unsigned>(JitConfig.JitExtDefaultPolicyMaxIL());

if (m_HasProfile)
// TODO: Enable for PgoSource::Static as well if it's not the generic profile we bundle.
if (m_HasProfile && (m_RootCompiler->fgPgoSource == ICorJitInfo::PgoSource::Dynamic))
{
maxCodeSize = static_cast<unsigned>(JitConfig.JitExtDefaultPolicyMaxILProf());
}
Expand Down Expand Up @@ -1432,13 +1433,13 @@ double ExtendedDefaultPolicy::DetermineMultiplier()
if (m_ReturnsStructByValue)
{
// For structs-passed-by-value we might avoid expensive copy operations if we inline.
multiplier += 1.5;
multiplier += 2.0;
JITDUMP("\nInline candidate returns a struct by value. Multiplier increased to %g.", multiplier);
}
else if (m_ArgIsStructByValue > 0)
{
// Same here
multiplier += 1.5;
multiplier += 2.0;
JITDUMP("\n%d arguments are structs passed by value. Multiplier increased to %g.", m_ArgIsStructByValue,
multiplier);
}
Expand All @@ -1464,13 +1465,13 @@ double ExtendedDefaultPolicy::DetermineMultiplier()

if (m_ArgFeedsRangeCheck > 0)
{
multiplier += 0.5;
multiplier += 1.0;
JITDUMP("\nInline candidate has arg that feeds range check. Multiplier increased to %g.", multiplier);
}

if (m_NonGenericCallsGeneric)
{
multiplier += 1.5;
multiplier += 2.0;
JITDUMP("\nInline candidate is generic and caller is not. Multiplier increased to %g.", multiplier);
}

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/jitconfigvalues.h
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ CONFIG_STRING(JitInlineReplayFile, W("JitInlineReplayFile"))
// relies on PGO if it exists and generally is more aggressive.
CONFIG_INTEGER(JitExtDefaultPolicy, W("JitExtDefaultPolicy"), 1)
CONFIG_INTEGER(JitExtDefaultPolicyMaxIL, W("JitExtDefaultPolicyMaxIL"), 0x80)
CONFIG_INTEGER(JitExtDefaultPolicyMaxILProf, W("JitExtDefaultPolicyMaxILProf"), 0x200)
CONFIG_INTEGER(JitExtDefaultPolicyMaxILProf, W("JitExtDefaultPolicyMaxILProf"), 0x400)
CONFIG_INTEGER(JitExtDefaultPolicyMaxBB, W("JitExtDefaultPolicyMaxBB"), 7)

// Inliner uses the following formula for PGO-driven decisions:
Expand Down

0 comments on commit e948d10

Please sign in to comment.