Skip to content

Commit

Permalink
SPMI changes
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorBo committed Jan 4, 2024
1 parent a91a8d5 commit b06db31
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 15 deletions.
10 changes: 5 additions & 5 deletions src/coreclr/inc/jiteeversionguid.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ typedef const GUID *LPCGUID;
#define GUID_DEFINED
#endif // !GUID_DEFINED

constexpr GUID JITEEVersionIdentifier = { /* a19264d9-82b9-4aa4-833f-ee4b52352d7e */
0xa19264d9,
0x82b9,
0x4aa4,
{0x83, 0x3f, 0xee, 0x4b, 0x52, 0x35, 0x2d, 0x7e}
constexpr GUID JITEEVersionIdentifier = { /* 0cb8113f-52e5-444f-b713-dcb749b5d211 */
0x0cb8113f,
0x52e5,
0x444f,
{0xb7, 0x13, 0xdc, 0xb7, 0x49, 0xb5, 0xd2, 0x11}
};

//////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
21 changes: 11 additions & 10 deletions src/coreclr/jit/fgprofile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2315,15 +2315,16 @@ class ValueHistogramProbeInserter
// \--* LCL_VAR long tmp
//

const unsigned lenTmpNum = compiler->lvaGrabTemp(true DEBUGARG("length histogram profile tmp"));
GenTree* storeLenToTemp = compiler->gtNewTempStore(lenTmpNum, *lenArgRef);
GenTree* lengthLocal = compiler->gtNewLclvNode(lenTmpNum, genActualType(*lenArgRef));
GenTreeOp* lengthNode = compiler->gtNewOperNode(GT_COMMA, lengthLocal->TypeGet(), storeLenToTemp, lengthLocal);
GenTree* histNode = compiler->gtNewIconNode(reinterpret_cast<ssize_t>(hist), TYP_I_IMPL);
unsigned helper = is32 ? CORINFO_HELP_VALUEPROFILE32 : CORINFO_HELP_VALUEPROFILE64;
const unsigned lenTmpNum = compiler->lvaGrabTemp(true DEBUGARG("length histogram profile tmp"));
GenTree* storeLenToTemp = compiler->gtNewTempStore(lenTmpNum, *lenArgRef);
GenTree* lengthLocal = compiler->gtNewLclvNode(lenTmpNum, genActualType(*lenArgRef));
GenTreeOp* lengthNode = compiler->gtNewOperNode(GT_COMMA, lengthLocal->TypeGet(), storeLenToTemp, lengthLocal);
GenTree* histNode = compiler->gtNewIconNode(reinterpret_cast<ssize_t>(hist), TYP_I_IMPL);
unsigned helper = is32 ? CORINFO_HELP_VALUEPROFILE32 : CORINFO_HELP_VALUEPROFILE64;
GenTreeCall* helperCallNode = compiler->gtNewHelperCallNode(helper, TYP_VOID, lengthNode, histNode);

*lenArgRef = compiler->gtNewOperNode(GT_COMMA, lengthLocal->TypeGet(), helperCallNode, compiler->gtCloneExpr(lengthLocal));
*lenArgRef = compiler->gtNewOperNode(GT_COMMA, lengthLocal->TypeGet(), helperCallNode,
compiler->gtCloneExpr(lengthLocal));
m_instrCount++;
}
};
Expand Down Expand Up @@ -2677,7 +2678,7 @@ PhaseStatus Compiler::fgInstrumentMethod()
const PhaseStatus earlyExitPhaseStatus =
madeAnticipatoryChanges ? PhaseStatus::MODIFIED_EVERYTHING : PhaseStatus::MODIFIED_NOTHING;

// Optionally, when jitting, if there were no class probes and only one count probe,
// Optionally, when jitting, if there were no class probes, no value probes and only one count probe,
// suppress instrumentation.
//
// We leave instrumentation in place when prejitting as the sample hits in the method
Expand All @@ -2699,8 +2700,8 @@ PhaseStatus Compiler::fgInstrumentMethod()
if (minimalProbeMode && (fgCountInstrumentor->SchemaCount() == 1) &&
(fgHistogramInstrumentor->SchemaCount() == 0) && (fgValueInstrumentor->SchemaCount() == 0))
{
JITDUMP(
"Not instrumenting method: minimal probing enabled, and method has only one counter and no class probes\n");
JITDUMP("Not instrumenting method: minimal probing enabled, and method has only one counter and no class and "
"no value probes\n");

return earlyExitPhaseStatus;
}
Expand Down
12 changes: 12 additions & 0 deletions src/coreclr/tools/superpmi/superpmi-shared/methodcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5779,6 +5779,18 @@ void MethodContext::dmpGetPgoInstrumentationResults(DWORDLONG key, const Agnosti
printf("[%u] %016" PRIX64 " ", j, CastHandle(*(uintptr_t*)(pInstrumentationData + pBuf[i].Offset + j * sizeof(uintptr_t))));
}
break;
case ICorJitInfo::PgoInstrumentationKind::ValueHistogramIntCount:
printf("V %u", *(unsigned*)(pInstrumentationData + pBuf[i].Offset));
break;
case ICorJitInfo::PgoInstrumentationKind::ValueHistogramLongCount:
printf("V %" PRIu64 "", *(uint64_t*)(pInstrumentationData + pBuf[i].Offset));
break;
case ICorJitInfo::PgoInstrumentationKind::ValueHistogram:
for (unsigned int j = 0; j < pBuf[i].Count; j++)
{
printf("[%u] %lld", j, (int64_t)*(intptr_t*)(pInstrumentationData + pBuf[i].Offset + j * sizeof(uintptr_t)));
}
break;
case ICorJitInfo::PgoInstrumentationKind::GetLikelyClass:
case ICorJitInfo::PgoInstrumentationKind::GetLikelyMethod:
{
Expand Down

0 comments on commit b06db31

Please sign in to comment.