Skip to content

Commit

Permalink
Change prejit instrumentation default back to block profiling (#49441)
Browse files Browse the repository at this point in the history
Both crossgen1 and crossgen2 currently reject schemas that contain edge profile
counters. Change the jit defaults back to block profiling when prejitting.

See notes in #49267.
  • Loading branch information
AndyAyersMS authored Mar 11, 2021
1 parent 830a540 commit 9c3fc56
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/coreclr/jit/fgprofile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1489,7 +1489,7 @@ PhaseStatus Compiler::fgPrepareToInstrumentMethod()
//
// We enable edge profiling by default, except when:
// * disabled by option
// * we are prejitting via classic ngen
// * we are prejitting
// * we are jitting osr methods
//
// Currently, OSR is incompatible with edge profiling. So if OSR is enabled,
Expand All @@ -1500,15 +1500,9 @@ PhaseStatus Compiler::fgPrepareToInstrumentMethod()
//
CLANG_FORMAT_COMMENT_ANCHOR;

#ifdef FEATURE_READYTORUN_COMPILER
const bool r2r = opts.IsReadyToRun();
#else
const bool r2r = false;
#endif
const bool prejit = opts.jitFlags->IsSet(JitFlags::JIT_FLAG_PREJIT);
const bool classicNgen = prejit && !r2r;
const bool osr = (opts.jitFlags->IsSet(JitFlags::JIT_FLAG_TIER0) && (JitConfig.TC_OnStackReplacement() > 0));
const bool useEdgeProfiles = (JitConfig.JitEdgeProfiling() > 0) && !classicNgen && !osr;
const bool prejit = opts.jitFlags->IsSet(JitFlags::JIT_FLAG_PREJIT);
const bool osr = (opts.jitFlags->IsSet(JitFlags::JIT_FLAG_TIER0) && (JitConfig.TC_OnStackReplacement() > 0));
const bool useEdgeProfiles = (JitConfig.JitEdgeProfiling() > 0) && !prejit && !osr;

if (useEdgeProfiles)
{
Expand All @@ -1517,7 +1511,7 @@ PhaseStatus Compiler::fgPrepareToInstrumentMethod()
else
{
JITDUMP("Using block profiling, because %s\n",
(JitConfig.JitEdgeProfiling() > 0) ? "edge profiles disabled" : classicNgen ? "classic Ngen" : "OSR");
(JitConfig.JitEdgeProfiling() > 0) ? "edge profiles disabled" : prejit ? "prejitting" : "OSR");

fgCountInstrumentor = new (this, CMK_Pgo) BlockCountInstrumentor(this);
}
Expand Down

0 comments on commit 9c3fc56

Please sign in to comment.