diff options
author | Andy Ayers <andya@microsoft.com> | 2016-03-17 17:23:19 -0700 |
---|---|---|
committer | Andy Ayers <andya@microsoft.com> | 2016-03-21 15:55:55 -0700 |
commit | 5c7dd45d7c035445a33a321c595a03fba73da93f (patch) | |
tree | bb7cea44caf3de24329dfef6f54893106796b9ae /src/jit/inlinepolicy.h | |
parent | 6120148c2f3df11ea902989675fb33dd0d71723c (diff) | |
download | coreclr-5c7dd45d7c035445a33a321c595a03fba73da93f.tar.gz coreclr-5c7dd45d7c035445a33a321c595a03fba73da93f.tar.bz2 coreclr-5c7dd45d7c035445a33a321c595a03fba73da93f.zip |
Inliner: initial data gathering for code size estimates
Some initial work to gather data to drive the modelling of inline
code size impact. See #3775 for context.
Update the `DiscretionaryPolicy` to capture more observations.
Add a limit feature `JitInlineLimit` so the jit will stop inlining after
a given number of successful inlines.
Add a `DumpData` method to `InlinePolicy` which will display all the
observations that were made to evaluate an inline. Implement this for the
`DiscretionaryPolicy`. Add a matching `DumpSchema` that writes out
column headers for each of the observations.
Modify `InlineResult` to cache the last successful policy on the root
compiler instance. Use that along with the `JitInlineLimit` and
`DumpData` to display detailed information about the last sucessful
inline along with the code size for the method. All this is displayed
if `JitInlineDumpData ` is enabled.
This allows for isolating code size measurements as follows. Compile or
jit something with `JitInlineLimit = 0` and `JitInlineDumpData =1` (and
for now, `JitInlinePolicyDiscretionary = 1`, since other policies do not
implement any interesting data dumping).
Record the this root set of method sizes and IDs. Repeat with
`JitInlineLimit=1`. For each method where there was an inline, the size
impact of that inline can be computed by comparing this version versus
the version from the root set. Repeat with `JitInlineLimit=2`, comparing
versus the `=1` versions.
Currently the method token is used to identify the root method. This is
not sufficiently unique but unfortunately there currently aren't
substantially better alternatives. See #1957 for some discussion.
Diffstat (limited to 'src/jit/inlinepolicy.h')
-rw-r--r-- | src/jit/inlinepolicy.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/jit/inlinepolicy.h b/src/jit/inlinepolicy.h index 8d1d5b2963..99e0c05c01 100644 --- a/src/jit/inlinepolicy.h +++ b/src/jit/inlinepolicy.h @@ -48,6 +48,9 @@ public: , m_CallsiteFrequency(InlineCallsiteFrequency::UNUSED) , m_InstructionCount(0) , m_LoadStoreCount(0) + , m_CalleeNativeSizeEstimate(0) + , m_CallsiteNativeSizeEstimate(0) + , m_Multiplier(0.0) , m_IsForceInline(false) , m_IsForceInlineKnown(false) , m_IsInstanceCtor(false) @@ -99,6 +102,9 @@ protected: InlineCallsiteFrequency m_CallsiteFrequency; unsigned m_InstructionCount; unsigned m_LoadStoreCount; + int m_CalleeNativeSizeEstimate; + int m_CallsiteNativeSizeEstimate; + double m_Multiplier; bool m_IsForceInline :1; bool m_IsForceInlineKnown :1; bool m_IsInstanceCtor :1; @@ -168,12 +174,32 @@ public: DiscretionaryPolicy(Compiler* compiler, bool isPrejitRoot); // Policy observations + void NoteBool(InlineObservation obs, bool value) override; void NoteInt(InlineObservation obs, int value) override; // Policy policies bool PropagateNeverToRuntime() const override; + // Policy determinations + void DetermineProfitability(CORINFO_METHOD_INFO* methodInfo) override; + + // Externalize data + void DumpData() const override; + void DumpSchema() const override; + + // Miscellaneous const char* GetName() const override { return "DiscretionaryPolicy"; } + +private: + + unsigned m_Depth; + unsigned m_BlockCount; + unsigned m_Maxstack; + unsigned m_ArgCount; + unsigned m_LocalCount; + CorInfoType m_ReturnType; + unsigned m_ThrowCount; + unsigned m_CallCount; }; #endif // DEBUG |