summaryrefslogtreecommitdiff
path: root/src/jit
diff options
context:
space:
mode:
authorKoundinya Veluri <kouvel@users.noreply.github.com>2019-05-23 10:49:10 -0700
committerGitHub <noreply@github.com>2019-05-23 10:49:10 -0700
commit61a02edb7fb443b92f0682a00c42200def2bd33a (patch)
tree7a40753df7c7935d0bddb05688d1c96b498d26d1 /src/jit
parent9271757d2c917c5650c459a4c3fa648c2968a591 (diff)
downloadcoreclr-61a02edb7fb443b92f0682a00c42200def2bd33a.tar.gz
coreclr-61a02edb7fb443b92f0682a00c42200def2bd33a.tar.bz2
coreclr-61a02edb7fb443b92f0682a00c42200def2bd33a.zip
Add some perf events/data for tiered compilation (#24607)
Add some perf events/data for tiered compilation New events: - `Settings` - Sent when TC is enabled - `Flags` - Currently indicates whether QuickJit and QuickJitForLoops are enabled - `Pause` - Sent when TC is paused (due to a new method being called for the first time) - `Resume` - Sent when TC resumes - `NewMethodCount` - Number of methods called for the first time while tiering was paused - `BackgroundJitStart` - Sent when starting to JIT methods in the background - `PendingMethodCount` - Number of methods currently scheduled for background JIT - `BackgroundJitStop` - Sent when background jitting stops - `PendingMethodCount` - Same as above. When 0, background jitting has completed. - `JittedMethodCount` - Number of methods jitted in the background since the previous BackgroundJitStart event on the same thread Miscellaneous: - Updated method JIT events to include the optimization tier - Added a couple more cases where tiered compilation is disabled for methods that have JIT optimization disabled for some reason - Renamed `Duration` field of the new version of the `ContentionEnd` to `DurationNs` to indicate the units of time - Added `OptimizationTierOptimized` to `NativeCodeVersion::OptimizationTier` to distinguish it from `OptimizationTier1`. `OptimizationTierOptimized` is now used for methods that QuickJit is disabled for, and does not send the tier 1 flag. - For info about the code being generated by the JIT, added info to `PrepareCodeConfig` and stored a pointer to it on the thread object for the current JIT invocation. Info is updated in `PrepareCodeConfig` and used for updating the tier on the code version and for sending the ETL event. - If the JIT decides to use MinOpt when `MethodDesc::IsJitOptimizationDisabled()` is false, the info is not stored. The runtime method event will reflect the JIT's choice, the rundown event will not. - Updated to show optimization tiers in SOS similarly to PerfView
Diffstat (limited to 'src/jit')
-rw-r--r--src/jit/compiler.cpp11
-rw-r--r--src/jit/compiler.h4
-rw-r--r--src/jit/flowgraph.cpp29
3 files changed, 25 insertions, 19 deletions
diff --git a/src/jit/compiler.cpp b/src/jit/compiler.cpp
index 4c4a90d937..25249e19bb 100644
--- a/src/jit/compiler.cpp
+++ b/src/jit/compiler.cpp
@@ -4050,6 +4050,13 @@ _SetMinOpts:
// Set the MinOpts value
opts.SetMinOpts(theMinOptsValue);
+ // Notify the VM if MinOpts is being used when not requested
+ if (theMinOptsValue && !compIsForInlining() && !opts.jitFlags->IsSet(JitFlags::JIT_FLAG_TIER0) &&
+ !opts.jitFlags->IsSet(JitFlags::JIT_FLAG_MIN_OPT) && !opts.compDbgCode)
+ {
+ info.compCompHnd->setMethodAttribs(info.compMethodHnd, CORINFO_FLG_SWITCHED_TO_MIN_OPT);
+ }
+
#ifdef DEBUG
if (verbose && !compIsForInlining())
{
@@ -5949,14 +5956,14 @@ int Compiler::compCompileHelper(CORINFO_MODULE_HANDLE classPtr,
}
#ifdef FEATURE_CORECLR
- if (fgHasBackwardJump && (info.compFlags & CORINFO_FLG_DISABLE_TIER0_FOR_LOOPS) != 0 && fgCanSwitchToTier1())
+ if (fgHasBackwardJump && (info.compFlags & CORINFO_FLG_DISABLE_TIER0_FOR_LOOPS) != 0 && fgCanSwitchToOptimized())
#else // !FEATURE_CORECLR
// We may want to use JitConfig value here to support DISABLE_TIER0_FOR_LOOPS
if (fgHasBackwardJump && fgCanSwitchToTier1())
#endif
{
// Method likely has a loop, switch to the OptimizedTier to avoid spending too much time running slower code
- fgSwitchToTier1();
+ fgSwitchToOptimized();
}
compSetOptimizationLevel();
diff --git a/src/jit/compiler.h b/src/jit/compiler.h
index 1db70d1612..c73ca30c16 100644
--- a/src/jit/compiler.h
+++ b/src/jit/compiler.h
@@ -5105,8 +5105,8 @@ protected:
bool fgHasBackwardJump;
- bool fgCanSwitchToTier1();
- void fgSwitchToTier1();
+ bool fgCanSwitchToOptimized();
+ void fgSwitchToOptimized();
bool fgMayExplicitTailCall();
diff --git a/src/jit/flowgraph.cpp b/src/jit/flowgraph.cpp
index d8b12188ec..62d958fa88 100644
--- a/src/jit/flowgraph.cpp
+++ b/src/jit/flowgraph.cpp
@@ -4253,10 +4253,10 @@ private:
};
//------------------------------------------------------------------------
-// fgCanSwitchToTier1: Determines if conditions are met to allow switching the opt level to tier 1
+// fgCanSwitchToOptimized: Determines if conditions are met to allow switching the opt level to optimized
//
// Return Value:
-// True if the opt level may be switched to tier 1, false otherwise
+// True if the opt level may be switched from tier 0 to optimized, false otherwise
//
// Assumptions:
// - compInitOptions() has been called
@@ -4266,7 +4266,7 @@ private:
// This method is to be called at some point before compSetOptimizationLevel() to determine if the opt level may be
// changed based on information gathered in early phases.
-bool Compiler::fgCanSwitchToTier1()
+bool Compiler::fgCanSwitchToOptimized()
{
bool result = opts.jitFlags->IsSet(JitFlags::JIT_FLAG_TIER0) && !opts.jitFlags->IsSet(JitFlags::JIT_FLAG_MIN_OPT) &&
!opts.compDbgCode && !compIsForInlining();
@@ -4281,28 +4281,27 @@ bool Compiler::fgCanSwitchToTier1()
}
//------------------------------------------------------------------------
-// fgSwitchToTier1: Switch the opt level to tier 1
+// fgSwitchToOptimized: Switch the opt level from tier 0 to optimized
//
// Assumptions:
-// - fgCanSwitchToTier1() is true
+// - fgCanSwitchToOptimized() is true
// - compSetOptimizationLevel() has not been called
//
// Notes:
-// This method is to be called at some point before compSetOptimizationLevel() to switch the opt level to tier 1
+// This method is to be called at some point before compSetOptimizationLevel() to switch the opt level to optimized
// based on information gathered in early phases.
-void Compiler::fgSwitchToTier1()
+void Compiler::fgSwitchToOptimized()
{
- assert(fgCanSwitchToTier1());
+ assert(fgCanSwitchToOptimized());
- // Switch to tier 1 and re-init options
+ // Switch to optimized and re-init options
assert(opts.jitFlags->IsSet(JitFlags::JIT_FLAG_TIER0));
opts.jitFlags->Clear(JitFlags::JIT_FLAG_TIER0);
- opts.jitFlags->Set(JitFlags::JIT_FLAG_TIER1);
compInitOptions(opts.jitFlags);
// Notify the VM of the change
- info.compCompHnd->setMethodAttribs(info.compMethodHnd, CORINFO_FLG_SWITCHED_TO_TIER1);
+ info.compCompHnd->setMethodAttribs(info.compMethodHnd, CORINFO_FLG_SWITCHED_TO_OPTIMIZED);
}
//------------------------------------------------------------------------
@@ -5605,12 +5604,12 @@ unsigned Compiler::fgMakeBasicBlocks(const BYTE* codeAddr, IL_OFFSET codeSize, F
#endif // !FEATURE_CORECLR && _TARGET_AMD64_
}
- if (fgCanSwitchToTier1() && fgMayExplicitTailCall())
+ if (fgCanSwitchToOptimized() && fgMayExplicitTailCall())
{
// Method has an explicit tail call that may run like a loop or may not be generated as a tail
- // call in tier 0, switch to tier 1 to avoid spending too much time running slower code and to
- // avoid stack overflow from recursion
- fgSwitchToTier1();
+ // call in tier 0, switch to optimized to avoid spending too much time running slower code and
+ // to avoid stack overflow from recursion
+ fgSwitchToOptimized();
}
#if !defined(FEATURE_CORECLR) && defined(_TARGET_AMD64_)