Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Tiered rejit work items #27147

Merged
merged 2 commits into from
Oct 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions src/jit/block.h
Original file line number Diff line number Diff line change
Expand Up @@ -1274,13 +1274,23 @@ struct BasicBlockList

struct flowList
{
flowList* flNext; // The next BasicBlock in the list, nullptr for end of list.
BasicBlock* flBlock; // The BasicBlock of interest.
flowList* flNext; // The next BasicBlock in the list, nullptr for end of list.
BasicBlock* flBlock; // The BasicBlock of interest.
unsigned flDupCount; // The count of duplicate "edges" (use only for switch stmts)

private:
BasicBlock::weight_t flEdgeWeightMin;
BasicBlock::weight_t flEdgeWeightMax;

unsigned flDupCount; // The count of duplicate "edges" (use only for switch stmts)
public:
BasicBlock::weight_t edgeWeightMin() const
{
return flEdgeWeightMin;
}
BasicBlock::weight_t edgeWeightMax() const
{
return flEdgeWeightMax;
}

// These two methods are used to set new values for flEdgeWeightMin and flEdgeWeightMax
// they are used only during the computation of the edge weights
Expand All @@ -1289,13 +1299,14 @@ struct flowList
//
bool setEdgeWeightMinChecked(BasicBlock::weight_t newWeight, BasicBlock::weight_t slop, bool* wbUsedSlop);
bool setEdgeWeightMaxChecked(BasicBlock::weight_t newWeight, BasicBlock::weight_t slop, bool* wbUsedSlop);
void setEdgeWeights(BasicBlock::weight_t newMinWeight, BasicBlock::weight_t newMaxWeight);

flowList() : flNext(nullptr), flBlock(nullptr), flEdgeWeightMin(0), flEdgeWeightMax(0), flDupCount(0)
flowList() : flNext(nullptr), flBlock(nullptr), flDupCount(0), flEdgeWeightMin(0), flEdgeWeightMax(0)
{
}

flowList(BasicBlock* blk, flowList* rest)
: flNext(rest), flBlock(blk), flEdgeWeightMin(0), flEdgeWeightMax(0), flDupCount(0)
: flNext(rest), flBlock(blk), flDupCount(0), flEdgeWeightMin(0), flEdgeWeightMax(0)
{
}
};
Expand Down
71 changes: 47 additions & 24 deletions src/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3995,8 +3995,8 @@ void Compiler::compSetOptimizationLevel()
sscanf_s(histr, "%x", &methHashHi);
if (methHash >= methHashLo && methHash <= methHashHi)
{
printf("MinOpts for method %s, hash = 0x%x.\n",
info.compFullName, info.compMethodHash());
printf("MinOpts for method %s, hash = %08x.\n",
info.compFullName, methHash);
printf(""); // in our logic this causes a flush
theMinOptsValue = true;
}
Expand Down Expand Up @@ -5491,7 +5491,12 @@ unsigned Compiler::Info::compMethodHash() const
{
if (compMethodHashPrivate == 0)
{
compMethodHashPrivate = compCompHnd->getMethodHash(compMethodHnd);
// compMethodHashPrivate = compCompHnd->getMethodHash(compMethodHnd);
assert(compFullName != nullptr);
assert(*compFullName != 0);
COUNT_T hash = HashStringA(compFullName); // Use compFullName to generate the hash, as it contains the signature
// and return type
compMethodHashPrivate = hash;
}
return compMethodHashPrivate;
}
Expand Down Expand Up @@ -5584,31 +5589,42 @@ void Compiler::compCompileFinish()
{
// clang-format off
headerPrinted = true;
printf(" | Profiled | Exec- | Method has | calls | Num |LclV |AProp| CSE | Reg |bytes | %3s code size | \n", Target::g_tgtCPUName);
printf(" mdToken | | RGN | Count | EH | FRM | LOOP | NRM | IND | BBs | Cnt | Cnt | Cnt | Alloc | IL | HOT | COLD | method name \n");
printf("---------+-----+------+----------+----+-----+------+-----+-----+-----+-----+-----+-----+---------+------+-------+-------+-----------\n");
// 06001234 | PRF | HOT | 219 | EH | ebp | LOOP | 15 | 6 | 12 | 17 | 12 | 8 | 28 p2 | 145 | 211 | 123 | System.Example(int)
printf(" | Profiled | Method | Method has | calls | Num |LclV |AProp| CSE | Perf |bytes | %3s codesize| \n", Target::g_tgtCPUName);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What perfscore gets output on platforms that are missing full support like arm*?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default PerfScore algorithm counts each instruction executed as 1 unit.

printf(" mdToken | CNT | RGN | Hash | EH | FRM | LOOP | NRM | IND | BBs | Cnt | Cnt | Cnt | Score | IL | HOT | CLD | method name \n");
printf("---------+------+------+----------+----+-----+------+-----+-----+-----+-----+-----+-----+---------+------+-------+-----+\n");
// 06001234 | 1234 | HOT | 0f1e2d3c | EH | ebp | LOOP | 15 | 6 | 12 | 17 | 12 | 8 | 1234.56 | 145 | 1234 | 123 | System.Example(int)
// clang-format on
}

printf("%08X | ", currentMethodToken);

CorInfoRegionKind regionKind = info.compMethodInfo->regionKind;

if (opts.altJit)
if (fgHaveProfileData())
{
printf("ALT | ");
}
else if (fgHaveProfileData())
{
printf("PRF | ");
if (profCallCount <= 9999)
{
printf("%4d | ", profCallCount);
}
else if (profCallCount <= 999500)
{
printf("%3dK | ", (profCallCount + 500) / 1000);
}
else
{
printf("%3dM | ", (profCallCount + 500000) / 1000000);
}
}
else
{
printf(" | ");
printf(" | ");
}

if (regionKind == CORINFO_REGION_NONE)
CorInfoRegionKind regionKind = info.compMethodInfo->regionKind;

if (opts.altJit)
{
printf("ALT | ");
}
else if (regionKind == CORINFO_REGION_NONE)
{
printf(" | ");
}
Expand All @@ -5629,7 +5645,7 @@ void Compiler::compCompileFinish()
printf("UNKN | ");
}

printf("%8d | ", profCallCount);
printf("%08x | ", info.compMethodHash());

if (compHndBBtabCount > 0)
{
Expand Down Expand Up @@ -5687,10 +5703,18 @@ void Compiler::compCompileFinish()
#endif // FEATURE_ANYCSE
}

printf(" LSRA |"); // TODO-Cleanup: dump some interesting LSRA stat into the order file?
if (info.compPerfScore < 9999.995)
{
printf(" %7.2f |", info.compPerfScore);
}
else
{
printf(" %7.0f |", info.compPerfScore);
}

printf(" %4d |", info.compMethodInfo->ILCodeSize);
printf(" %5d |", info.compTotalHotCodeSize);
printf(" %5d |", info.compTotalColdCodeSize);
printf(" %3d |", info.compTotalColdCodeSize);

printf(" %s\n", eeGetMethodFullName(info.compMethodHnd));
printf(""); // in our logic this causes a flush
Expand Down Expand Up @@ -6111,9 +6135,8 @@ int Compiler::compCompileHelper(CORINFO_MODULE_HANDLE classPtr,
#ifdef DEBUG
if (JitConfig.DumpJittedMethods() == 1 && !compIsForInlining())
{
printf("Compiling %4d %s::%s, IL size = %u, hsh=0x%x %s\n", Compiler::jitTotalMethodCompiled,
info.compClassName, info.compMethodName, info.compILCodeSize, info.compMethodHash(),
compGetTieringName());
printf("Compiling %4d %s::%s, IL size = %u, hash=%08x\n", Compiler::jitTotalMethodCompiled, info.compClassName,
info.compMethodName, info.compILCodeSize, info.compMethodHash(), compGetTieringName());
}
if (compIsForInlining())
{
Expand Down Expand Up @@ -8634,7 +8657,7 @@ void cFuncIR(Compiler* comp)
{
BasicBlock* block;

printf("Method %s::%s, hsh=0x%x\n", comp->info.compClassName, comp->info.compMethodName,
printf("Method %s::%s, hash=%08x\n", comp->info.compClassName, comp->info.compMethodName,
comp->info.compMethodHash());

printf("\n");
Expand Down
1 change: 1 addition & 0 deletions src/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -6928,6 +6928,7 @@ class Compiler

var_types eeGetArgType(CORINFO_ARG_LIST_HANDLE list, CORINFO_SIG_INFO* sig);
var_types eeGetArgType(CORINFO_ARG_LIST_HANDLE list, CORINFO_SIG_INFO* sig, bool* isPinned);
CORINFO_CLASS_HANDLE eeGetArgClass(CORINFO_SIG_INFO* sig, CORINFO_ARG_LIST_HANDLE list);
unsigned eeGetArgSize(CORINFO_ARG_LIST_HANDLE list, CORINFO_SIG_INFO* sig);

// VOM info, method sigs
Expand Down
7 changes: 7 additions & 0 deletions src/jit/ee_il_dll.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ inline var_types Compiler::eeGetArgType(CORINFO_ARG_LIST_HANDLE list, CORINFO_SI
return JITtype2varType(strip(type));
}

/*****************************************************************************/
inline CORINFO_CLASS_HANDLE Compiler::eeGetArgClass(CORINFO_SIG_INFO* sig, CORINFO_ARG_LIST_HANDLE list)
{
CORINFO_CLASS_HANDLE argClass = info.compCompHnd->getArgClass(sig, list);
briansull marked this conversation as resolved.
Show resolved Hide resolved
return argClass;
}

/*****************************************************************************
*
* Native Direct Optimizations
Expand Down
76 changes: 65 additions & 11 deletions src/jit/eeinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
/*****************************************************************************/

/*****************************************************************************
*
* Filter wrapper to handle exception filtering.
* On Unix compilers don't support SEH.
*/
*
* Filter wrapper to handle exception filtering.
* On Unix compilers don't support SEH.
*/

struct FilterSuperPMIExceptionsParam_eeinterface
{
Expand All @@ -43,6 +43,7 @@ struct FilterSuperPMIExceptionsParam_eeinterface
CORINFO_ARG_LIST_HANDLE argLst;
CORINFO_METHOD_HANDLE hnd;
const char* returnType;
const char** pArgNames;
EXCEPTION_POINTERS exceptionPointers;
};

Expand Down Expand Up @@ -103,17 +104,50 @@ const char* Compiler::eeGetMethodFullName(CORINFO_METHOD_HANDLE hnd)

/* figure out the signature */

param.pThis->eeGetMethodSig(param.hnd, &param.sig);

// allocate space to hold the class names for each of the parameters

if (param.sig.numArgs > 0)
{
param.pArgNames = getAllocator(CMK_DebugOnly).allocate<const char*>(param.sig.numArgs);
}
else
{
param.pArgNames = nullptr;
}

PAL_TRY(FilterSuperPMIExceptionsParam_eeinterface*, pParam, &param)
{
unsigned i;
pParam->pThis->eeGetMethodSig(pParam->hnd, &pParam->sig);
pParam->argLst = pParam->sig.args;

for (i = 0; i < pParam->sig.numArgs; i++)
{
var_types type = pParam->pThis->eeGetArgType(pParam->argLst, &pParam->sig);

pParam->siglength += strlen(varTypeName(type));
switch (type)
{
case TYP_REF:
case TYP_STRUCT:
{
CORINFO_CLASS_HANDLE clsHnd = pParam->pThis->eeGetArgClass(&pParam->sig, pParam->argLst);
// For some SIMD struct types we can get a nullptr back from eeGetArgClass on Linux/X64
if (clsHnd != NO_CLASS_HANDLE)
{
const char* clsName = pParam->pThis->eeGetClassName(clsHnd);
if (clsName != nullptr)
{
pParam->pArgNames[i] = clsName;
break;
}
}
}
__fallthrough;
default:
pParam->pArgNames[i] = varTypeName(type);
break;
}
pParam->siglength += strlen(pParam->pArgNames[i]);
pParam->argLst = pParam->pJitInfo->compCompHnd->getArgNext(pParam->argLst);
}

Expand All @@ -124,9 +158,30 @@ const char* Compiler::eeGetMethodFullName(CORINFO_METHOD_HANDLE hnd)
pParam->siglength += (pParam->sig.numArgs - 1);
}

if (JITtype2varType(pParam->sig.retType) != TYP_VOID)
var_types retType = JITtype2varType(pParam->sig.retType);
if (retType != TYP_VOID)
{
pParam->returnType = varTypeName(JITtype2varType(pParam->sig.retType));
switch (retType)
{
case TYP_REF:
case TYP_STRUCT:
{
CORINFO_CLASS_HANDLE clsHnd = pParam->sig.retTypeClass;
if (clsHnd != NO_CLASS_HANDLE)
{
const char* clsName = pParam->pThis->eeGetClassName(clsHnd);
if (clsName != nullptr)
{
pParam->returnType = clsName;
break;
}
}
}
__fallthrough;
default:
pParam->returnType = varTypeName(retType);
break;
}
pParam->siglength += strlen(pParam->returnType) + 1; // don't forget the delimiter ':'
}

Expand Down Expand Up @@ -175,8 +230,7 @@ const char* Compiler::eeGetMethodFullName(CORINFO_METHOD_HANDLE hnd)
for (i = 0; i < param.sig.numArgs; i++)
{
var_types type = eeGetArgType(param.argLst, &param.sig);
strcat_s(retName, length, varTypeName(type));

strcat_s(retName, length, param.pArgNames[i]);
param.argLst = info.compCompHnd->getArgNext(param.argLst);
if (i + 1 < param.sig.numArgs)
{
Expand Down
Loading