diff --git a/src/coreclr/inc/clrconfigvalues.h b/src/coreclr/inc/clrconfigvalues.h index 7832490029ce3..7e524b6e40f66 100644 --- a/src/coreclr/inc/clrconfigvalues.h +++ b/src/coreclr/inc/clrconfigvalues.h @@ -617,7 +617,7 @@ CONFIG_DWORD_INFO(INTERNAL_OSR_HighId, W("OSR_HighId"), 10000000, "High end of e RETAIL_CONFIG_STRING_INFO(INTERNAL_PGODataPath, W("PGODataPath"), "Read/Write PGO data from/to the indicated file.") RETAIL_CONFIG_DWORD_INFO(INTERNAL_ReadPGOData, W("ReadPGOData"), 0, "Read PGO data") RETAIL_CONFIG_DWORD_INFO(INTERNAL_WritePGOData, W("WritePGOData"), 0, "Write PGO data") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_TieredPGO, W("TieredPGO"), 0, "Instrument Tier0 code and make counts available to Tier1") +RETAIL_CONFIG_DWORD_INFO(EXTERNAL_TieredPGO, W("TieredPGO"), 0, "Instrument Tier0 code and make counts available to Tier1") #endif /// diff --git a/src/coreclr/vm/eeconfig.cpp b/src/coreclr/vm/eeconfig.cpp index 3b4ad3176e6da..ce8e2691940bc 100644 --- a/src/coreclr/vm/eeconfig.cpp +++ b/src/coreclr/vm/eeconfig.cpp @@ -237,6 +237,10 @@ HRESULT EEConfig::Init() tieredCompilation_DeleteCallCountingStubsAfter = 0; #endif +#if defined(FEATURE_PGO) + fTieredPGO = false; +#endif + #if defined(FEATURE_ON_STACK_REPLACEMENT) dwOSR_HitLimit = 10; dwOSR_CounterBump = 5000; @@ -769,6 +773,10 @@ HRESULT EEConfig::sync() } #endif +#if defined(FEATURE_PGO) + fTieredPGO = Configuration::GetKnobBooleanValue(W("System.Runtime.TieredPGO"), CLRConfig::EXTERNAL_TieredPGO); +#endif + #if defined(FEATURE_ON_STACK_REPLACEMENT) dwOSR_HitLimit = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_OSR_HitLimit); dwOSR_CounterBump = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_OSR_CounterBump); diff --git a/src/coreclr/vm/eeconfig.h b/src/coreclr/vm/eeconfig.h index 78b67d51f9196..0cb79d7f85fdc 100644 --- a/src/coreclr/vm/eeconfig.h +++ b/src/coreclr/vm/eeconfig.h @@ -90,6 +90,10 @@ class EEConfig DWORD TieredCompilation_DeleteCallCountingStubsAfter() const { LIMITED_METHOD_CONTRACT; return tieredCompilation_DeleteCallCountingStubsAfter; } #endif +#if defined(FEATURE_PGO) + bool TieredPGO(void) const { LIMITED_METHOD_CONTRACT; return fTieredPGO; } +#endif + #if defined(FEATURE_ON_STACK_REPLACEMENT) // OSR Config DWORD OSR_CounterBump() const { LIMITED_METHOD_CONTRACT; return dwOSR_CounterBump; } @@ -648,6 +652,10 @@ class EEConfig DWORD tieredCompilation_DeleteCallCountingStubsAfter; #endif +#if defined(FEATURE_PGO) + bool fTieredPGO; +#endif + #if defined(FEATURE_ON_STACK_REPLACEMENT) DWORD dwOSR_HitLimit; DWORD dwOSR_CounterBump; diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index d30b46adbbfec..5bc01735c0a08 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -12640,7 +12640,7 @@ CORJIT_FLAGS GetCompileFlags(MethodDesc * ftn, CORJIT_FLAGS flags, CORINFO_METHO { flags.Set(CORJIT_FLAGS::CORJIT_FLAG_BBINSTR); } - else if ((CLRConfig::GetConfigValue(CLRConfig::INTERNAL_TieredPGO) > 0) + else if ((g_pConfig->TieredPGO()) && (flags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_TIER0) || flags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_OSR))) { flags.Set(CORJIT_FLAGS::CORJIT_FLAG_BBINSTR); @@ -12650,8 +12650,7 @@ CORJIT_FLAGS GetCompileFlags(MethodDesc * ftn, CORJIT_FLAGS flags, CORINFO_METHO { flags.Set(CORJIT_FLAGS::CORJIT_FLAG_BBOPT); } - else if ((CLRConfig::GetConfigValue(CLRConfig::INTERNAL_TieredPGO) > 0) - && flags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_TIER1)) + else if (g_pConfig->TieredPGO() && flags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_TIER1)) { flags.Set(CORJIT_FLAGS::CORJIT_FLAG_BBOPT); } diff --git a/src/coreclr/vm/pgo.cpp b/src/coreclr/vm/pgo.cpp index b6b1a155eb948..ad12d5c9d11d4 100644 --- a/src/coreclr/vm/pgo.cpp +++ b/src/coreclr/vm/pgo.cpp @@ -344,8 +344,8 @@ void PgoManager::ReadPgoData() { // Skip, if we're not reading, or we're writing profile data, or doing tiered pgo // - if ((CLRConfig::GetConfigValue(CLRConfig::INTERNAL_WritePGOData) > 0) || - (CLRConfig::GetConfigValue(CLRConfig::INTERNAL_TieredPGO) > 0) || + if (g_pConfig->TieredPGO() || + (CLRConfig::GetConfigValue(CLRConfig::INTERNAL_WritePGOData) > 0) || (CLRConfig::GetConfigValue(CLRConfig::INTERNAL_ReadPGOData) == 0)) { return;