diff options
author | Andy Ayers <andya@microsoft.com> | 2021-05-26 18:56:09 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-26 18:56:09 +0300 |
commit | 7f090c346afbedcfbff93c4002b577bab1988ecb (patch) | |
tree | 89a036378ac4d5212f02e6c69253ad30fb3b5ec2 /src/coreclr/inc | |
parent | dc5a1c8f221ff3c38d61021e517719ac1aa24356 (diff) |
JIT: pgo/devirt diagnostic improvements (#53247)
Several changes to help better diagnose PGO and devirtualization issues:
* Report the source of the PGO data to the jit
* Report the reason for a devirtualization failure to the jit
* Add checking mode that compares result of devirtualization to class profile
* Add reporting mode to assess overall rates of devirtualization failure
when the jit has exact type information.
Also fix a loophole where in some case we'd still devirtualize if not
optimizing.
Note crossgen2 does not yet set devirtualization failure reasons.
Diffstat (limited to 'src/coreclr/inc')
-rw-r--r-- | src/coreclr/inc/corinfo.h | 23 | ||||
-rw-r--r-- | src/coreclr/inc/corjit.h | 14 | ||||
-rw-r--r-- | src/coreclr/inc/icorjitinfoimpl_generated.h | 3 | ||||
-rw-r--r-- | src/coreclr/inc/jiteeversionguid.h | 10 |
4 files changed, 40 insertions, 10 deletions
diff --git a/src/coreclr/inc/corinfo.h b/src/coreclr/inc/corinfo.h index 197450f279d..231b669ebee 100644 --- a/src/coreclr/inc/corinfo.h +++ b/src/coreclr/inc/corinfo.h @@ -1602,6 +1602,21 @@ struct CORINFO_CALL_INFO bool wrapperDelegateInvoke; }; +enum CORINFO_DEVIRTUALIZATION_DETAIL +{ + CORINFO_DEVIRTUALIZATION_UNKNOWN, // no details available + CORINFO_DEVIRTUALIZATION_SUCCESS, // devirtualization was successful + CORINFO_DEVIRTUALIZATION_FAILED_CANON, // object class was canonical + CORINFO_DEVIRTUALIZATION_FAILED_COM, // object class was com + CORINFO_DEVIRTUALIZATION_FAILED_CAST, // object class could not be cast to interface class + CORINFO_DEVIRTUALIZATION_FAILED_LOOKUP, // interface method could not be found + CORINFO_DEVIRTUALIZATION_FAILED_DIM, // interface method was default interface method + CORINFO_DEVIRTUALIZATION_FAILED_SUBCLASS, // object not subclass of base class + CORINFO_DEVIRTUALIZATION_FAILED_SLOT, // virtual method installed via explicit override + CORINFO_DEVIRTUALIZATION_FAILED_BUBBLE, // devirtualization crossed version bubble + CORINFO_DEVIRTUALIZATION_COUNT, // sentinel for maximum value +}; + struct CORINFO_DEVIRTUALIZATION_INFO { // @@ -1617,10 +1632,12 @@ struct CORINFO_DEVIRTUALIZATION_INFO // invariant is `resolveVirtualMethod(...) == (devirtualizedMethod != nullptr)`. // - requiresInstMethodTableArg is set to TRUE if the devirtualized method requires a type handle arg. // - exactContext is set to wrapped CORINFO_CLASS_HANDLE of devirt'ed method table. + // - details on the computation done by the jit host // - CORINFO_METHOD_HANDLE devirtualizedMethod; - bool requiresInstMethodTableArg; - CORINFO_CONTEXT_HANDLE exactContext; + CORINFO_METHOD_HANDLE devirtualizedMethod; + bool requiresInstMethodTableArg; + CORINFO_CONTEXT_HANDLE exactContext; + CORINFO_DEVIRTUALIZATION_DETAIL detail; }; //---------------------------------------------------------------------------- diff --git a/src/coreclr/inc/corjit.h b/src/coreclr/inc/corjit.h index b6c97d9f5ab..d4a22f2ee3e 100644 --- a/src/coreclr/inc/corjit.h +++ b/src/coreclr/inc/corjit.h @@ -396,6 +396,17 @@ public: int32_t Other; }; + enum class PgoSource + { + Unknown = 0, // PGO data source unknown + Static = 1, // PGO data comes from embedded R2R profile data + Dynamic = 2, // PGO data comes from current run + Blend = 3, // PGO data comes from blend of prior runs and current run + Text = 4, // PGO data comes from text file + IBC = 5, // PGO data from classic IBC + Sampling= 6, // PGO data derived from sampling + }; + #define DEFAULT_UNKNOWN_TYPEHANDLE 1 #define UNKNOWN_TYPEHANDLE_MIN 1 #define UNKNOWN_TYPEHANDLE_MAX 33 @@ -412,8 +423,9 @@ public: PgoInstrumentationSchema **pSchema, // OUT: pointer to the schema table (array) which describes the instrumentation results // (pointer will not remain valid after jit completes). uint32_t * pCountSchemaItems, // OUT: pointer to the count of schema items in `pSchema` array. - uint8_t ** pInstrumentationData // OUT: `*pInstrumentationData` is set to the address of the instrumentation data + uint8_t ** pInstrumentationData, // OUT: `*pInstrumentationData` is set to the address of the instrumentation data // (pointer will not remain valid after jit completes). + PgoSource * pPgoSource // OUT: value describing source of pgo data ) = 0; // Allocate a profile buffer for use in the current process diff --git a/src/coreclr/inc/icorjitinfoimpl_generated.h b/src/coreclr/inc/icorjitinfoimpl_generated.h index ebd9813e2c4..c65a0840d6f 100644 --- a/src/coreclr/inc/icorjitinfoimpl_generated.h +++ b/src/coreclr/inc/icorjitinfoimpl_generated.h @@ -678,7 +678,8 @@ JITINTERFACE_HRESULT getPgoInstrumentationResults( CORINFO_METHOD_HANDLE ftnHnd, ICorJitInfo::PgoInstrumentationSchema** pSchema, uint32_t* pCountSchemaItems, - uint8_t** pInstrumentationData) override; + uint8_t** pInstrumentationData, + ICorJitInfo::PgoSource* pgoSource) override; JITINTERFACE_HRESULT allocPgoInstrumentationBySchema( CORINFO_METHOD_HANDLE ftnHnd, diff --git a/src/coreclr/inc/jiteeversionguid.h b/src/coreclr/inc/jiteeversionguid.h index 54ed6978c7a..548fcf5f7f3 100644 --- a/src/coreclr/inc/jiteeversionguid.h +++ b/src/coreclr/inc/jiteeversionguid.h @@ -43,11 +43,11 @@ typedef const GUID *LPCGUID; #define GUID_DEFINED #endif // !GUID_DEFINED -constexpr GUID JITEEVersionIdentifier = { /* 895f5d24-eb01-4aff-ad6c-1efc6a91498a */ - 0x895f5d24, - 0xeb01, - 0x4aff, - {0xad, 0x6c, 0x1e, 0xfc, 0x6a, 0x91, 0x49, 0x8a} +constexpr GUID JITEEVersionIdentifier = { /* 81a5e384-8ca5-4947-8b2e-1d76556728fd */ + 0x81a5e384, + 0x8ca5, + 0x4947, + {0x8b, 0x2e, 0x1d, 0x76, 0x55, 0x67, 0x28, 0xfd} }; ////////////////////////////////////////////////////////////////////////////////////////////////////////// |