diff options
author | Egor Bogatov <egorbo@gmail.com> | 2021-07-08 20:50:16 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-08 20:50:16 +0300 |
commit | 8bab2effec2a3951315ea2e43687e91fb05ee277 (patch) | |
tree | 454aae7919bb7a870853dfb9df986969b452c236 /src/coreclr/jit | |
parent | df7f02c492f73a6b44826ce93b300f8e0e9aaf19 (diff) |
JIT: Set default value for JitExtDefaultPolicyProfTrust 0 (#55229)
Diffstat (limited to 'src/coreclr/jit')
-rw-r--r-- | src/coreclr/jit/inlinepolicy.cpp | 10 | ||||
-rw-r--r-- | src/coreclr/jit/jitconfigvalues.h | 11 |
2 files changed, 19 insertions, 2 deletions
diff --git a/src/coreclr/jit/inlinepolicy.cpp b/src/coreclr/jit/inlinepolicy.cpp index c328233cdf5..fdf4ae19341 100644 --- a/src/coreclr/jit/inlinepolicy.cpp +++ b/src/coreclr/jit/inlinepolicy.cpp @@ -1648,7 +1648,15 @@ double ExtendedDefaultPolicy::DetermineMultiplier() const double profileTrustCoef = (double)JitConfig.JitExtDefaultPolicyProfTrust() / 10.0; const double profileScale = (double)JitConfig.JitExtDefaultPolicyProfScale() / 10.0; - multiplier *= (1.0 - profileTrustCoef) + min(m_ProfileFrequency, 1.0) * profileScale; + if (m_RootCompiler->fgPgoSource == ICorJitInfo::PgoSource::Dynamic) + { + // For now we only "trust" dynamic profiles. + multiplier *= (1.0 - profileTrustCoef) + min(m_ProfileFrequency, 1.0) * profileScale; + } + else + { + multiplier *= min(m_ProfileFrequency, 1.0) * profileScale; + } JITDUMP("\nCallsite has profile data: %g.", m_ProfileFrequency); } diff --git a/src/coreclr/jit/jitconfigvalues.h b/src/coreclr/jit/jitconfigvalues.h index 7527fd49221..cc10adc0b88 100644 --- a/src/coreclr/jit/jitconfigvalues.h +++ b/src/coreclr/jit/jitconfigvalues.h @@ -462,8 +462,17 @@ CONFIG_STRING(JitInlineReplayFile, W("JitInlineReplayFile")) CONFIG_INTEGER(JitExtDefaultPolicy, W("JitExtDefaultPolicy"), 1) CONFIG_INTEGER(JitExtDefaultPolicyMaxIL, W("JitExtDefaultPolicyMaxIL"), 0x64) CONFIG_INTEGER(JitExtDefaultPolicyMaxBB, W("JitExtDefaultPolicyMaxBB"), 7) -CONFIG_INTEGER(JitExtDefaultPolicyProfScale, W("JitExtDefaultPolicyProfScale"), 0x2A) + +// Inliner uses the following formula for PGO-driven decisions: +// +// BM = BM * ((1.0 - ProfTrust) + ProfWeight * ProfScale) +// +// Where BM is a benefit multiplier composed from various observations (e.g. "const arg makes a branch foldable"). +// If a profile data can be trusted for 100% we can safely just give up on inlining anything inside cold blocks +// (except the cases where inlining in cold blocks improves type info/escape analysis for the whole caller). +// For now, it's only applied for dynamic PGO. CONFIG_INTEGER(JitExtDefaultPolicyProfTrust, W("JitExtDefaultPolicyProfTrust"), 0x7) +CONFIG_INTEGER(JitExtDefaultPolicyProfScale, W("JitExtDefaultPolicyProfScale"), 0x2A) CONFIG_INTEGER(JitInlinePolicyModel, W("JitInlinePolicyModel"), 0) CONFIG_INTEGER(JitInlinePolicyProfile, W("JitInlinePolicyProfile"), 0) |