Skip to content

Commit 99020ce

Browse files
authored
Merge pull request #99 from opcm/CLX_push
Cascade Lake + PMM support
2 parents 0df446a + c29ced4 commit 99020ce

File tree

8 files changed

+832
-224
lines changed

8 files changed

+832
-224
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ Release64
2727
.metadata/
2828
html/
2929
latex/
30+
*.swp

cpucounters.cpp

Lines changed: 331 additions & 104 deletions
Large diffs are not rendered by default.

cpucounters.h

Lines changed: 157 additions & 31 deletions
Large diffs are not rendered by default.

pcm-core.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ int main(int argc, char * argv[])
295295
bool show_partial_core_output = false;
296296
std::bitset<MAX_CORES> ycores;
297297

298+
298299
PCM * m = PCM::getInstance();
299300

300301
conf.fixedCfg = NULL; // default

pcm-memory.cpp

Lines changed: 273 additions & 85 deletions
Large diffs are not rendered by default.

pcm-sensor.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ int main()
7070
for (uint32 a = 0; a < counters.getNumSockets(); ++a) {
7171
cout << "Socket" << a << "/BytesReadFromMC\tfloat" << endl;
7272
cout << "Socket" << a << "/BytesWrittenToMC\tfloat" << endl;
73+
cout << "Socket" << a << "/BytesReadFromPMM\tfloat" << endl;
74+
cout << "Socket" << a << "/BytesWrittenToPMM\tfloat" << endl;
7375
cout << "Socket" << a << "/Frequency\tfloat" << endl;
7476
cout << "Socket" << a << "/IPC\tfloat" << endl;
7577
cout << "Socket" << a << "/L2CacheHitRatio\tfloat" << endl;
@@ -258,6 +260,13 @@ int main()
258260
cout << "read from MC Socket" << i << "\t0\t\tGB" << endl;
259261
}
260262
}
263+
for (uint32 i = 0; i < counters.getNumSockets(); ++i) {
264+
stringstream c;
265+
c << "Socket" << i << "/BytesReadFromPMM?";
266+
if (s == c.str()) {
267+
cout << "read from PMM memory on Socket" << i << "\t0\t\tGB" << endl;
268+
}
269+
}
261270
for (uint32 i = 0; i < counters.getNumSockets(); ++i) {
262271
stringstream c;
263272
c << "Socket" << i << "/DRAMEnergy?";
@@ -337,9 +346,9 @@ int main()
337346
}
338347
for (uint32 i = 0; i < counters.getNumSockets(); ++i) {
339348
stringstream c;
340-
c << "Socket" << i << "/BytesWrittenToMC?";
349+
c << "Socket" << i << "/BytesWrittenToPMM?";
341350
if (s == c.str()) {
342-
cout << "written to MC Socket" << i << "\t0\t\tGB" << endl;
351+
cout << "written to PMM memory on Socket" << i << "\t0\t\tGB" << endl;
343352
//cout << "CPU" << i << "\tBytes written to memory channel\t0\t1\t GB" << endl;
344353
}
345354
}
@@ -613,6 +622,8 @@ int main()
613622
OUTPUT_SOCKET_METRIC("/ThermalHeadroom", (counters.getSocket<int32, ::getThermalHeadroom>(i)))
614623
OUTPUT_SOCKET_METRIC("/BytesReadFromMC", (double(counters.getSocket<uint64, ::getBytesReadFromMC>(i)) / 1024 / 1024 / 1024))
615624
OUTPUT_SOCKET_METRIC("/BytesWrittenToMC", (double(counters.getSocket<uint64, ::getBytesWrittenToMC>(i)) / 1024 / 1024 / 1024))
625+
OUTPUT_SOCKET_METRIC("/BytesReadFromPMM", (double(counters.getSocket<uint64, ::getBytesReadFromPMM>(i)) / 1024 / 1024 / 1024))
626+
OUTPUT_SOCKET_METRIC("/BytesWrittenToPMM", (double(counters.getSocket<uint64, ::getBytesWrittenToPMM>(i)) / 1024 / 1024 / 1024))
616627
OUTPUT_SOCKET_METRIC("/Frequency", (counters.getSocket<double, ::getAverageFrequency>(i) / 1000000))
617628
OUTPUT_SOCKET_METRIC("/IPC", (counters.getSocket<double, ::getIPC>(i)))
618629
OUTPUT_SOCKET_METRIC("/L2CacheHitRatio", (counters.getSocket<double, ::getL2CacheHitRatio>(i)))

pcm.cpp

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ void print_output(PCM * m,
179179
if (m->memoryTrafficMetricsAvailable()) cout << " READ : bytes read from main memory controller (in GBytes)" << "\n";
180180
if (m->memoryTrafficMetricsAvailable()) cout << " WRITE : bytes written to main memory controller (in GBytes)" << "\n";
181181
if (m->LLCReadMissLatencyMetricsAvailable()) cout << "LLCRDMISSLAT: average latency of last level cache miss for reads and prefetches (in ns)";
182+
if (m->PMMTrafficMetricsAvailable()) cout << " PMM RD : bytes read from PMM memory (in GBytes)" << "\n";
183+
if (m->PMMTrafficMetricsAvailable()) cout << " PMM WR : bytes written to PMM memory (in GBytes)" << "\n";
182184
if (m->MCDRAMmemoryTrafficMetricsAvailable()) cout << " MCDRAM READ : bytes read from MCDRAM controller (in GBytes)" << "\n";
183185
if (m->MCDRAMmemoryTrafficMetricsAvailable()) cout << " MCDRAM WRITE : bytes written to MCDRAM controller (in GBytes)" << "\n";
184186
if (m->memoryIOTrafficMetricAvailable()) cout << " IO : bytes read/written due to IO requests to memory controller (in GBytes); this may be an over estimate due to same-cache-line partial requests" << "\n";
@@ -345,7 +347,6 @@ void print_output(PCM * m,
345347
{
346348
cout << "\n" << "Intel(r) "<< m->xPI() <<" traffic estimation in bytes (data and non-data traffic outgoing from CPU/socket through "<< m->xPI() <<" links):" << "\n" << "\n";
347349

348-
349350
const uint32 qpiLinks = (uint32)m->getQPILinksPerSocket();
350351

351352
cout << " ";
@@ -381,6 +382,8 @@ void print_output(PCM * m,
381382
cout << "MEM (GB)->|";
382383
if (m->memoryTrafficMetricsAvailable())
383384
cout << " READ | WRITE |";
385+
if (m->PMMTrafficMetricsAvailable())
386+
cout << " PMM RD | PMM WR |";
384387
if (m->MCDRAMmemoryTrafficMetricsAvailable())
385388
cout << " MCDRAM READ | MCDRAM WRITE |";
386389
if (m->memoryIOTrafficMetricAvailable())
@@ -399,6 +402,9 @@ void print_output(PCM * m,
399402
if (m->memoryTrafficMetricsAvailable())
400403
cout << " " << setw(5) << getBytesReadFromMC(sktstate1[i], sktstate2[i]) / double(1e9) <<
401404
" " << setw(5) << getBytesWrittenToMC(sktstate1[i], sktstate2[i]) / double(1e9);
405+
if (m->PMMTrafficMetricsAvailable())
406+
cout << " " << setw(5) << getBytesReadFromPMM(sktstate1[i], sktstate2[i]) / double(1e9) <<
407+
" " << setw(5) << getBytesWrittenToPMM(sktstate1[i], sktstate2[i]) / double(1e9);
402408
if (m->MCDRAMmemoryTrafficMetricsAvailable())
403409
cout << " " << setw(11) << getBytesReadFromEDC(sktstate1[i], sktstate2[i]) / double(1e9) <<
404410
" " << setw(11) << getBytesWrittenToEDC(sktstate1[i], sktstate2[i]) / double(1e9);
@@ -424,6 +430,9 @@ void print_output(PCM * m,
424430
if (m->memoryTrafficMetricsAvailable())
425431
cout << " " << setw(5) << getBytesReadFromMC(sstate1, sstate2) / double(1e9) <<
426432
" " << setw(5) << getBytesWrittenToMC(sstate1, sstate2) / double(1e9);
433+
if (m->PMMTrafficMetricsAvailable())
434+
cout << " " << setw(5) << getBytesReadFromPMM(sstate1, sstate2) / double(1e9) <<
435+
" " << setw(5) << getBytesWrittenToPMM(sstate1, sstate2) / double(1e9);
427436
if (m->memoryIOTrafficMetricAvailable())
428437
cout << " " << setw(5) << getIORequestBytesFromMC(sstate1, sstate2) / double(1e9);
429438
cout << " ";
@@ -499,6 +508,9 @@ void print_csv_header(PCM * m,
499508
if (m->memoryTrafficMetricsAvailable())
500509
cout << ";;";
501510

511+
if (m->PMMTrafficMetricsAvailable())
512+
cout << ";;";
513+
502514
if (m->MCDRAMmemoryTrafficMetricsAvailable())
503515
cout << ";;";
504516

@@ -540,6 +552,8 @@ void print_csv_header(PCM * m,
540552
cout << ";";
541553
if (m->memoryTrafficMetricsAvailable())
542554
cout << ";;";
555+
if (m->PMMTrafficMetricsAvailable())
556+
cout << ";;";
543557
if (m->MCDRAMmemoryTrafficMetricsAvailable())
544558
cout << ";;";
545559
}
@@ -639,6 +653,9 @@ void print_csv_header(PCM * m,
639653
if (m->memoryTrafficMetricsAvailable())
640654
cout << "READ;WRITE;";
641655

656+
if (m->PMMTrafficMetricsAvailable())
657+
cout << "PMM_RD;PMM_WR;";
658+
642659
if (m->MCDRAMmemoryTrafficMetricsAvailable())
643660
cout << "MCDRAM_READ;MCDRAM_WRITE;";
644661

@@ -680,6 +697,8 @@ void print_csv_header(PCM * m,
680697
cout << "RMB;";
681698
if (m->memoryTrafficMetricsAvailable())
682699
cout << "READ;WRITE;";
700+
if (m->PMMTrafficMetricsAvailable())
701+
cout << "PMM_RD;PMM_WR;";
683702
if (m->MCDRAMmemoryTrafficMetricsAvailable())
684703
cout << "MCDRAM_READ;MCDRAM_WRITE;";
685704
cout << "TEMP;";
@@ -835,6 +854,10 @@ void print_csv(PCM * m,
835854
cout << getBytesReadFromMC(sstate1, sstate2) / double(1e9) <<
836855
';' << getBytesWrittenToMC(sstate1, sstate2) / double(1e9) << ';';
837856

857+
if (m->PMMTrafficMetricsAvailable())
858+
cout << getBytesReadFromPMM(sstate1, sstate2) / double(1e9) <<
859+
';' << getBytesWrittenToPMM(sstate1, sstate2) / double(1e9) << ';';
860+
838861
if (m->MCDRAMmemoryTrafficMetricsAvailable())
839862
cout << getBytesReadFromEDC(sstate1, sstate2) / double(1e9) <<
840863
';' << getBytesWrittenToEDC(sstate1, sstate2) / double(1e9) << ';';
@@ -880,6 +903,9 @@ void print_csv(PCM * m,
880903
if (m->memoryTrafficMetricsAvailable())
881904
cout << ';' << getBytesReadFromMC(sktstate1[i], sktstate2[i]) / double(1e9) <<
882905
';' << getBytesWrittenToMC(sktstate1[i], sktstate2[i]) / double(1e9);
906+
if (m->PMMTrafficMetricsAvailable())
907+
cout << ';' << getBytesReadFromPMM(sktstate1[i], sktstate2[i]) / double(1e9) <<
908+
';' << getBytesWrittenToPMM(sktstate1[i], sktstate2[i]) / double(1e9);
883909
if (m->MCDRAMmemoryTrafficMetricsAvailable())
884910
cout << ';' << getBytesReadFromEDC(sktstate1[i], sktstate2[i]) / double(1e9) <<
885911
';' << getBytesWrittenToEDC(sktstate1[i], sktstate2[i]) / double(1e9);

types.h

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,6 @@ struct BecktonUncorePMUCNTCTLRegister
574574
#define KNL_EDC7_ECLK_REGISTER_DEV_ADDR (31)
575575
#define KNL_EDC7_ECLK_REGISTER_FUNC_ADDR (2)
576576

577-
578577
/**
579578
* XPF_ for Xeons: SNB, IVT, HSX, BDW, etc.
580579
* KNX_ for Xeon Phi (Knights *) processors
@@ -651,6 +650,26 @@ struct BecktonUncorePMUCNTCTLRegister
651650
#define QPI_PORT1_MISC_REGISTER_FUNC_ADDR (0)
652651
#define QPI_PORT2_MISC_REGISTER_FUNC_ADDR (0)
653652

653+
#define SKX_M2M_0_REGISTER_DEV_ADDR (8)
654+
#define SKX_M2M_0_REGISTER_FUNC_ADDR (0)
655+
#define SKX_M2M_1_REGISTER_DEV_ADDR (9)
656+
#define SKX_M2M_1_REGISTER_FUNC_ADDR (0)
657+
658+
#define M2M_PCI_PMON_BOX_CTL_ADDR (0x258)
659+
660+
#define M2M_PCI_PMON_CTL0_ADDR (0x228)
661+
#define M2M_PCI_PMON_CTL1_ADDR (0x230)
662+
#define M2M_PCI_PMON_CTL2_ADDR (0x238)
663+
#define M2M_PCI_PMON_CTL3_ADDR (0x240)
664+
665+
#define M2M_PCI_PMON_CTR0_ADDR (0x200)
666+
#define M2M_PCI_PMON_CTR1_ADDR (0x208)
667+
#define M2M_PCI_PMON_CTR2_ADDR (0x210)
668+
#define M2M_PCI_PMON_CTR3_ADDR (0x218)
669+
670+
#define PCM_INVALID_DEV_ADDR (~(uint32)0UL)
671+
#define PCM_INVALID_FUNC_ADDR (~(uint32)0UL)
672+
654673
#define Q_P_PCI_PMON_BOX_CTL_ADDR (0x0F4)
655674

656675
#define Q_P_PCI_PMON_CTL3_ADDR (0x0E4)
@@ -847,6 +866,15 @@ struct BecktonUncorePMUCNTCTLRegister
847866
#define IIO_MSR_PMON_CTL_CH_MASK(x) ((x) << 36ULL)
848867
#define IIO_MSR_PMON_CTL_FC_MASK(x) ((x) << 44ULL)
849868

869+
#define M2M_PCI_PMON_CTL_EVENT(x) ((x) << 0)
870+
#define M2M_PCI_PMON_CTL_UMASK(x) ((x) << 8)
871+
#define M2M_PCI_PMON_CTL_RST (1 << 17)
872+
#define M2M_PCI_PMON_CTL_EDGE_DET (1 << 18)
873+
#define M2M_PCI_PMON_CTL_OV_EN (1 << 20)
874+
#define M2M_PCI_PMON_CTL_EN (1 << 22)
875+
#define M2M_PCI_PMON_CTL_INVERT (1 << 23)
876+
#define M2M_PCI_PMON_CTL_THRESH(x) ((x) << 24ULL)
877+
850878
#define UCLK_FIXED_CTL_OV_EN (1 << 20)
851879
#define UCLK_FIXED_CTL_EN (1 << 22)
852880

0 commit comments

Comments
 (0)