Skip to content

Commit 2737961

Browse files
committed
add MTL support
address #713 Change-Id: I12c01aafe88c545c3202b0db4d87c19643e24283
1 parent 0f7ba13 commit 2737961

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

src/cpucounters.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,7 @@ void PCM::initCStateSupportTables()
697697
case DENVERTON:
698698
case ADL:
699699
case RPL:
700+
case MTL:
700701
case SNOWRIDGE:
701702
PCM_CSTATE_ARRAY(pkgCStateMsr, PCM_PARAM_PROTECT({0, 0, 0x3F8, 0, 0x3F9, 0, 0x3FA, 0, 0, 0, 0 }) );
702703
case NEHALEM_EP:
@@ -769,6 +770,7 @@ void PCM::initCStateSupportTables()
769770
PCM_SKL_PATH_CASES
770771
case ADL:
771772
case RPL:
773+
case MTL:
772774
case SNOWRIDGE:
773775
case ICX:
774776
case SPR:
@@ -1595,6 +1597,7 @@ bool PCM::detectNominalFrequency()
15951597
|| cpu_model == KNL
15961598
|| cpu_model == ADL
15971599
|| cpu_model == RPL
1600+
|| cpu_model == MTL
15981601
|| cpu_model == SKX
15991602
|| cpu_model == ICX
16001603
|| cpu_model == SPR
@@ -1853,7 +1856,8 @@ void PCM::initUncoreObjects()
18531856
{
18541857
case TGL:
18551858
case ADL: // TGLClientBW works fine for ADL
1856-
case RPL: // TGLClientBW works fine for ADL
1859+
case RPL: // TGLClientBW works fine for RPL
1860+
case MTL: // TGLClientBW works fine for MTL
18571861
clientBW = std::make_shared<TGLClientBW>();
18581862
break;
18591863
/* Disabled since ADLClientBW requires 2x multiplier for BW on top
@@ -2976,6 +2980,7 @@ bool PCM::isCPUModelSupported(const int model_)
29762980
|| model_ == TGL
29772981
|| model_ == ADL
29782982
|| model_ == RPL
2983+
|| model_ == MTL
29792984
|| model_ == SKX
29802985
|| model_ == ICX
29812986
|| model_ == SPR
@@ -3146,7 +3151,7 @@ PCM::ErrorCode PCM::program(const PCM::ProgramMode mode_, const void * parameter
31463151
canUsePerf = false;
31473152
if (!silent) std::cerr << "Installed Linux kernel perf does not support hardware top-down level-1 counters. Using direct PMU programming instead.\n";
31483153
}
3149-
if (canUsePerf && (cpu_model == ADL || cpu_model == RPL))
3154+
if (canUsePerf && (cpu_model == ADL || cpu_model == RPL || cpu_model == MTL))
31503155
{
31513156
canUsePerf = false;
31523157
if (!silent) std::cerr << "Linux kernel perf rejects an architectural event on your platform. Using direct PMU programming instead.\n";
@@ -3232,6 +3237,7 @@ PCM::ErrorCode PCM::program(const PCM::ProgramMode mode_, const void * parameter
32323237
switch ( cpu_model ) {
32333238
case ADL:
32343239
case RPL:
3240+
case MTL:
32353241
LLCArchEventInit(hybridAtomEventDesc);
32363242
hybridAtomEventDesc[2].event_number = SKL_MEM_LOAD_RETIRED_L2_MISS_EVTNR;
32373243
hybridAtomEventDesc[2].umask_value = SKL_MEM_LOAD_RETIRED_L2_MISS_UMASK;
@@ -4544,6 +4550,8 @@ const char * PCM::getUArchCodename(const int32 cpu_model_param) const
45444550
return "Alder Lake";
45454551
case RPL:
45464552
return "Raptor Lake";
4553+
case MTL:
4554+
return "Meteor Lake";
45474555
case SKX:
45484556
if (cpu_model_param >= 0)
45494557
{

src/cpucounters.h

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,6 +1554,7 @@ class PCM_API PCM
15541554
{
15551555
case ADL:
15561556
case RPL:
1557+
case MTL:
15571558
if (topology[coreID].core_type == TopologyEntry::Atom)
15581559
{
15591560
return std::make_pair(OFFCORE_RESPONSE_0_EVTNR, event + 1);
@@ -1568,6 +1569,7 @@ class PCM_API PCM
15681569
case EMR:
15691570
case ADL: // ADL big core (GLC)
15701571
case RPL:
1572+
case MTL:
15711573
useGLCOCREvent = true;
15721574
break;
15731575
}
@@ -1792,6 +1794,7 @@ class PCM_API PCM
17921794
RPL_1 = 0xba,
17931795
RPL_2 = 0xbf,
17941796
RPL_3 = 0xbe,
1797+
MTL = 0xAA,
17951798
BDX = 79,
17961799
KNL = 87,
17971800
SKL = 94,
@@ -2005,6 +2008,7 @@ class PCM_API PCM
20052008
{
20062009
case ADL:
20072010
case RPL:
2011+
case MTL:
20082012
return 6;
20092013
case SNOWRIDGE:
20102014
return 4;
@@ -2342,6 +2346,7 @@ class PCM_API PCM
23422346
|| cpu_model == PCM::ICX
23432347
|| cpu_model == PCM::ADL
23442348
|| cpu_model == PCM::RPL
2349+
|| cpu_model == PCM::MTL
23452350
|| cpu_model == PCM::SPR
23462351
|| cpu_model == PCM::EMR
23472352
);
@@ -2613,6 +2618,7 @@ class PCM_API PCM
26132618
|| cpu_model == BROADWELL
26142619
|| cpu_model == ADL
26152620
|| cpu_model == RPL
2621+
|| cpu_model == MTL
26162622
|| useSKLPath()
26172623
;
26182624
}
@@ -4015,7 +4021,12 @@ uint64 getL2CacheMisses(const CounterStateType & before, const CounterStateType
40154021
auto pcm = PCM::getInstance();
40164022
if (pcm->isL2CacheMissesAvailable() == false) return 0ULL;
40174023
const auto cpu_model = pcm->getCPUModel();
4018-
if (pcm->useSkylakeEvents() || cpu_model == PCM::SNOWRIDGE || cpu_model == PCM::ADL || cpu_model == PCM::RPL) {
4024+
if (pcm->useSkylakeEvents()
4025+
|| cpu_model == PCM::SNOWRIDGE
4026+
|| cpu_model == PCM::ADL
4027+
|| cpu_model == PCM::RPL
4028+
|| cpu_model == PCM::MTL
4029+
) {
40194030
return after.Event[BasicCounterState::SKLL2MissPos] - before.Event[BasicCounterState::SKLL2MissPos];
40204031
}
40214032
else if (pcm->isAtom() || cpu_model == PCM::KNL)
@@ -4121,7 +4132,11 @@ uint64 getL3CacheHitsSnoop(const CounterStateType & before, const CounterStateTy
41214132
auto pcm = PCM::getInstance();
41224133
if (!pcm->isL3CacheHitsSnoopAvailable()) return 0;
41234134
const auto cpu_model = pcm->getCPUModel();
4124-
if (cpu_model == PCM::SNOWRIDGE || cpu_model == PCM::ADL || cpu_model == PCM::RPL)
4135+
if (cpu_model == PCM::SNOWRIDGE
4136+
|| cpu_model == PCM::ADL
4137+
|| cpu_model == PCM::RPL
4138+
|| cpu_model == PCM::MTL
4139+
)
41254140
{
41264141
const int64 misses = getL3CacheMisses(before, after);
41274142
const int64 refs = after.Event[BasicCounterState::ArchLLCRefPos] - before.Event[BasicCounterState::ArchLLCRefPos];

0 commit comments

Comments
 (0)