Skip to content

Commit

Permalink
Merge pull request #460 from intel/push-2022-10-18
Browse files Browse the repository at this point in the history
Push 2022 10 18
  • Loading branch information
rdementi authored Oct 19, 2022
2 parents 2b68cc1 + 2e93907 commit 2ae6316
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .bdsignore.all
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Intel_SSA
My Inspector XE Results - pcm
.gitignore
.gitattributes
.github
.*\.txt
.*\.pdf
.*\.docx
Expand All @@ -35,3 +36,4 @@ My Inspector XE Results - pcm
.cproject
.project
makefile
sources
21 changes: 20 additions & 1 deletion src/bw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,25 @@ uint64 ClientBW::getIoRequests()
return mmioRange->read32(PCM_CLIENT_IMC_DRAM_IO_REQUESTS - PCM_CLIENT_IMC_EVENT_BASE);
}

#define PCM_ADL_IMC_EVENT_BASE (0xd000)
#define PCM_ADL_IMC_DRAM_DATA_READS (0x858)
#define PCM_ADL_IMC_DRAM_DATA_WRITES (0x8A0)

ADLClientBW::ADLClientBW()
{
mmioRange = std::make_shared<MMIORange>(getClientIMCStartAddr() + PCM_ADL_IMC_EVENT_BASE, 0x1000);
}

uint64 ADLClientBW::getImcReads()
{
return mmioRange->read32(PCM_ADL_IMC_DRAM_DATA_READS);
}

uint64 ADLClientBW::getImcWrites()
{
return mmioRange->read32(PCM_ADL_IMC_DRAM_DATA_WRITES);
}

#define PCM_SERVER_IMC_DRAM_DATA_READS (0x2290)
#define PCM_SERVER_IMC_DRAM_DATA_WRITES (0x2298)
#define PCM_SERVER_IMC_PMM_DATA_READS (0x22a0)
Expand Down Expand Up @@ -179,4 +198,4 @@ uint64 ServerBW::getPMMWrites()
return result;
}

} // namespace pcm
} // namespace pcm
12 changes: 11 additions & 1 deletion src/bw.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ namespace pcm {
uint64 getImcWrites() override;
};

class ADLClientBW : public FreeRunningBWCounters
{
std::shared_ptr<MMIORange> mmioRange;
public:
ADLClientBW();

uint64 getImcReads() override;
uint64 getImcWrites() override;
};

class ClientBW : public FreeRunningBWCounters
{
std::shared_ptr<MMIORange> mmioRange;
Expand Down Expand Up @@ -70,4 +80,4 @@ class ServerBW
uint64 getPMMWrites();
};

} // namespace pcm
} // namespace pcm
31 changes: 26 additions & 5 deletions src/cpucounters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,8 @@ void PCM::initCStateSupportTables()
case APOLLO_LAKE:
case DENVERTON:
case ADL:
case SNOWRIDGE:
case RPL:
case SNOWRIDGE:
PCM_CSTATE_ARRAY(pkgCStateMsr, PCM_PARAM_PROTECT({0, 0, 0x3F8, 0, 0x3F9, 0, 0x3FA, 0, 0, 0, 0 }) );
case NEHALEM_EP:
case NEHALEM:
Expand Down Expand Up @@ -868,7 +869,8 @@ void PCM::initCStateSupportTables()
case DENVERTON:
PCM_SKL_PATH_CASES
case ADL:
case SNOWRIDGE:
case RPL:
case SNOWRIDGE:
case ICX:
PCM_CSTATE_ARRAY(coreCStateMsr, PCM_PARAM_PROTECT({0, 0, 0, 0x3FC, 0, 0, 0x3FD, 0x3FE, 0, 0, 0}) );
case KNL:
Expand Down Expand Up @@ -1507,6 +1509,7 @@ bool PCM::detectNominalFrequency()
|| cpu_model == SNOWRIDGE
|| cpu_model == KNL
|| cpu_model == ADL
|| cpu_model == RPL
|| cpu_model == SKX
|| cpu_model == ICX
) ? (100000000ULL) : (133333333ULL);
Expand Down Expand Up @@ -1637,9 +1640,16 @@ void PCM::initUncoreObjects()
switch (cpu_model)
{
case TGL:
case ADL:
case ADL: // TGLClientBW works fine for ADL
case RPL: // TGLClientBW works fine for ADL
clientBW = std::make_shared<TGLClientBW>();
break;
/* Disabled since ADLClientBW requires 2x multiplier for BW on top
case ADL:
case RPL:
clientBW = std::make_shared<ADLClientBW>();
break;
*/
default:
clientBW = std::make_shared<ClientBW>();
}
Expand Down Expand Up @@ -2377,6 +2387,7 @@ bool PCM::isCPUModelSupported(const int model_)
|| model_ == RKL
|| model_ == TGL
|| model_ == ADL
|| model_ == RPL
|| model_ == SKX
|| model_ == ICX
);
Expand Down Expand Up @@ -2412,10 +2423,12 @@ bool PCM::checkModel()
cpu_model = TGL;
break;
case ADL_1:
case RPL:
cpu_model = ADL;
break;
case RPL_1:
case RPL_2:
cpu_model = ADL;
case RPL_3:
cpu_model = RPL;
break;
}

Expand Down Expand Up @@ -2543,6 +2556,11 @@ PCM::ErrorCode PCM::program(const PCM::ProgramMode mode_, const void * parameter
canUsePerf = false;
if (!silent) std::cerr << "Installed Linux kernel perf does not support hardware top-down level-1 counters. Using direct PMU programming instead.\n";
}
if (canUsePerf && (cpu_model == ADL || cpu_model == RPL))
{
canUsePerf = false;
if (!silent) std::cerr << "Linux kernel perf rejects an architectural event on your platform. Using direct PMU programming instead.\n";
}

if (canUsePerf == false && noMSRMode())
{
Expand Down Expand Up @@ -2600,6 +2618,7 @@ PCM::ErrorCode PCM::program(const PCM::ProgramMode mode_, const void * parameter
else
switch ( cpu_model ) {
case ADL:
case RPL:
hybridAtomEventDesc[0].event_number = ARCH_LLC_MISS_EVTNR;
hybridAtomEventDesc[0].umask_value = ARCH_LLC_MISS_UMASK;
hybridAtomEventDesc[1].event_number = ARCH_LLC_REFERENCE_EVTNR;
Expand Down Expand Up @@ -3892,6 +3911,8 @@ const char * PCM::getUArchCodename(const int32 cpu_model_param) const
return "Tiger Lake";
case ADL:
return "Alder Lake";
case RPL:
return "Raptor Lake";
case SKX:
if (cpu_model_param >= 0)
{
Expand Down
17 changes: 12 additions & 5 deletions src/cpucounters.h
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,7 @@ class PCM_API PCM
switch (cpu_model)
{
case ADL:
case RPL:
if (topology[coreID].core_type == TopologyEntry::Atom)
{
return std::make_pair(OFFCORE_RESPONSE_0_EVTNR, event + 1);
Expand All @@ -1170,6 +1171,7 @@ class PCM_API PCM
switch (cpu_model)
{
case ADL: // ADL big core (GLC)
case RPL:
useGLCOCREvent = true;
break;
}
Expand Down Expand Up @@ -1363,9 +1365,10 @@ class PCM_API PCM
TGL_1 = 141,
ADL = 151,
ADL_1 = 154,
RPL = 183,
RPL_1 = 186,
RPL_2 = 191,
RPL = 0xb7,
RPL_1 = 0xba,
RPL_2 = 0xbf,
RPL_3 = 0xbe,
BDX = 79,
KNL = 87,
SKL = 94,
Expand Down Expand Up @@ -1554,6 +1557,7 @@ class PCM_API PCM
switch (cpu_model)
{
case ADL:
case RPL:
return 6;
case SNOWRIDGE:
return 4;
Expand Down Expand Up @@ -1840,6 +1844,7 @@ class PCM_API PCM
|| cpu_model == PCM::SKX
|| cpu_model == PCM::ICX
|| cpu_model == PCM::ADL
|| cpu_model == PCM::RPL
);
}

Expand Down Expand Up @@ -2064,6 +2069,8 @@ class PCM_API PCM
|| cpu_model == IVY_BRIDGE
|| cpu_model == HASWELL
|| cpu_model == BROADWELL
|| cpu_model == ADL
|| cpu_model == RPL
|| useSKLPath()
;
}
Expand Down Expand Up @@ -3322,7 +3329,7 @@ uint64 getL2CacheMisses(const CounterStateType & before, const CounterStateType
auto pcm = PCM::getInstance();
if (pcm->isL2CacheMissesAvailable() == false) return 0ULL;
const auto cpu_model = pcm->getCPUModel();
if (pcm->useSkylakeEvents() || cpu_model == PCM::SNOWRIDGE || cpu_model == PCM::ADL) {
if (pcm->useSkylakeEvents() || cpu_model == PCM::SNOWRIDGE || cpu_model == PCM::ADL || cpu_model == PCM::RPL) {
return after.Event[BasicCounterState::SKLL2MissPos] - before.Event[BasicCounterState::SKLL2MissPos];
}
if (pcm->isAtom() || cpu_model == PCM::KNL)
Expand Down Expand Up @@ -3417,7 +3424,7 @@ uint64 getL3CacheHitsSnoop(const CounterStateType & before, const CounterStateTy
auto pcm = PCM::getInstance();
if (!pcm->isL3CacheHitsSnoopAvailable()) return 0;
const auto cpu_model = pcm->getCPUModel();
if (cpu_model == PCM::SNOWRIDGE || cpu_model == PCM::ADL)
if (cpu_model == PCM::SNOWRIDGE || cpu_model == PCM::ADL || cpu_model == PCM::RPL)
{
const int64 misses = getL3CacheMisses(before, after);
const int64 refs = after.Event[BasicCounterState::ArchLLCRefPos] - before.Event[BasicCounterState::ArchLLCRefPos];
Expand Down
9 changes: 8 additions & 1 deletion src/pcm-memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ bool anyPmem(const ServerUncoreMemoryMetrics & metrics)
}

bool skipInactiveChannels = true;
bool enforceFlush = false;

void print_help(const string & prog_name)
{
Expand All @@ -92,6 +93,7 @@ void print_help(const string & prog_name)
cout << " -i[=number] | /i[=number] => allow to determine number of iterations\n";
cout << " -silent => silence information output and print only measurements\n";
cout << " -u => update measurements instead of printing new ones\n";
cout << " -f | /f => enforce flushing output\n";
#ifdef _MSC_VER
cout << " --uninstallDriver | --installDriver=> (un)install driver\n";
#endif
Expand Down Expand Up @@ -1100,6 +1102,11 @@ int main(int argc, char * argv[])
print_update = true;
continue;
}
else if (check_argument_equals(*argv, { "-f", "/f" }))
{
enforceFlush = true;
continue;
}
#ifdef _MSC_VER
else if (check_argument_equals(*argv, {"--uninstallDriver"}))
{
Expand Down Expand Up @@ -1206,7 +1213,7 @@ int main(int argc, char * argv[])

mainLoop([&]()
{
if(!csv) cout << flush;
if (enforceFlush || !csv) cout << flush;

calibratedSleep(delay, sysCmd, mainLoop, m);

Expand Down
4 changes: 4 additions & 0 deletions src/pcm-sensor-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ std::ostream& operator<<( std::ostream& os, date const & d ) {
return os;
}

/* Not used right now
std::string read_ndctl_info( std::ofstream& logfile ) {
int pipes[2];
if ( pipe( pipes ) == -1 ) {
Expand Down Expand Up @@ -196,6 +198,8 @@ std::string read_ndctl_info( std::ofstream& logfile ) {
return ndctl.str();
}
*/

class HTTPServer;

class SignalHandler {
Expand Down

0 comments on commit 2ae6316

Please sign in to comment.