Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

push 2024 01 25 #663

Merged
merged 23 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
51d7f39
Merge pull request #516 from intel-innersource/rdementi-merge-gh-2024…
rdementi Jan 4, 2024
2a0c5e7
Bump microsoft/setup-msbuild from 1.1.3 to 1.3.1
dependabot[bot] Jan 4, 2024
b6c9600
Bump docker/setup-buildx-action from 1.7.0 to 3.0.0
dependabot[bot] Jan 4, 2024
aa565e6
Bump cross-platform-actions/action from 0.21.0 to 0.22.0
dependabot[bot] Jan 4, 2024
ad5d7c9
Bump actions/dependency-review-action from 3.1.4 to 3.1.5
dependabot[bot] Jan 4, 2024
fb3c0b1
make PCM::getMaxNumOfCBoxes more robust
rdementi Jan 10, 2024
78e7235
pcm-numa add -c option, pcm-msr add a few options (#522)
rdementi Jan 15, 2024
f6acbda
refactor cbo uncore pmu code
rdementi Jan 17, 2024
bb57b7f
refactor MDF PMU code
rdementi Jan 17, 2024
64adee9
refactor PCU PMU code
rdementi Jan 18, 2024
16e270f
fixes
rdementi Jan 19, 2024
6a47355
refactor UBOX PMU code
rdementi Jan 19, 2024
7094048
drop unused function
rdementi Jan 19, 2024
ff3a34b
fix llc slice display
rdementi Jan 19, 2024
5f61cdd
code re-formatting
rdementi Jan 19, 2024
d6191f7
add EMR support
rdementi Jan 19, 2024
11fc19f
fix the workflow
rdementi Jan 24, 2024
77b0436
print PCICFG register details
rdementi Jan 24, 2024
304389d
refactor readUncoreCounterValues
rdementi Jan 24, 2024
5f90ef4
pcm-raw: add generic uncore PMU path
rdementi Jan 24, 2024
ba19563
fix BSD build
rdementi Jan 24, 2024
09d4c9e
Merge commit '11fc19f043adc8e33c3d6860384b18f9ba518c57' into push-202…
rdementi Jan 25, 2024
a6e24d9
Merge tag '2024-01-25' into push-2024-01-25
rdementi Jan 25, 2024
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
17 changes: 11 additions & 6 deletions src/cpucounters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5721,6 +5721,16 @@ PCM::ErrorCode PCM::program(const RawPMUConfigs& curPMUConfigs_, const bool sile
{
programCXLDP(events64);
}
else if (strToUncorePMUID(type) != INVALID_PMU_ID)
{
const auto pmu_id = strToUncorePMUID(type);
programUncorePMUs(pmu_id, [&events64, &events, &pmu_id](UncorePMU& pmu)
{
uint64 * eventsIter = (uint64 *)events64;
pmu.initFreeze(UNC_PMON_UNIT_CTL_FRZ_EN);
PCM::program(pmu, eventsIter, eventsIter + (std::min)(events.programmable.size(), (size_t)ServerUncoreCounterState::maxCounters), UNC_PMON_UNIT_CTL_FRZ_EN);
});
}
else
{
std::cerr << "ERROR: unrecognized PMU type \"" << type << "\" when trying to program PMUs.\n";
Expand Down Expand Up @@ -6564,9 +6574,7 @@ ServerUncoreCounterState PCM::getServerUncoreCounterState(uint32 socket)
uint32 refCore = socketRefCore[socket];
TemporalThreadAffinity tempThreadAffinity(refCore);

readUncoreCounterValues(result, socket, CBO_PMU_ID);

readUncoreCounterValues(result, socket, MDF_PMU_ID);
readUncoreCounterValues(result, socket);

for (uint32 stack = 0; socket < iioPMUs.size() && stack < iioPMUs[socket].size() && stack < ServerUncoreCounterState::maxIIOStacks; ++stack)
{
Expand All @@ -6586,11 +6594,8 @@ ServerUncoreCounterState PCM::getServerUncoreCounterState(uint32 socket)
}
}

readUncoreCounterValues(result, socket, UBOX_PMU_ID);
result.UncClocks = getUncoreClocks(socket);

readUncoreCounterValues(result, socket, PCU_PMU_ID);

for (size_t p = 0; p < getNumCXLPorts(socket); ++p)
{
for (int i = 0; i < ServerUncoreCounterState::maxCounters && socket < cxlPMUs.size() && size_t(i) < cxlPMUs[socket][p].first.size(); ++i)
Expand Down
15 changes: 12 additions & 3 deletions src/cpucounters.h
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,15 @@ class PCM_API PCM
UBOX_PMU_ID,
INVALID_PMU_ID
};
private:
std::unordered_map<std::string, int> strToUncorePMUID_ {
};
public:
UncorePMUIDs strToUncorePMUID(const std::string & type) const
{
const auto iter = strToUncorePMUID_.find(type);
return (iter == strToUncorePMUID_.end()) ? INVALID_PMU_ID : (UncorePMUIDs)iter->second;
}
private:
typedef std::unordered_map<int, UncorePMUArrayType> UncorePMUMapType;
// socket -> die -> pmu map -> pmu ref array
Expand Down Expand Up @@ -714,7 +723,7 @@ class PCM_API PCM
}

template <class T>
void readUncoreCounterValues(T& result, const size_t socket, const int pmu_id) const
void readUncoreCounterValues(T& result, const size_t socket) const
{
if (socket < uncorePMUs.size())
{
Expand All @@ -723,9 +732,9 @@ class PCM_API PCM
{
TemporalThreadAffinity tempThreadAffinity(socketRefCore[socket]); // speedup trick for Linux

const auto& pmuIter = uncorePMUs[socket][die].find(pmu_id);
if (pmuIter != uncorePMUs[socket][die].end())
for (auto pmuIter = uncorePMUs[socket][die].begin(); pmuIter != uncorePMUs[socket][die].end(); ++pmuIter)
{
const auto & pmu_id = pmuIter->first;
result.Counters[die][pmu_id].resize(pmuIter->second.size());
for (size_t unit = 0; unit < pmuIter->second.size(); ++unit)
{
Expand Down
28 changes: 28 additions & 0 deletions src/pcm-raw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,8 @@ uint32 numTMAEvents(PCM* m)
return (m->isHWTMAL2Supported() ? 8 : 4);
}

uint32 pmu_type = PCM::INVALID_PMU_ID;

void printTransposed(const PCM::RawPMUConfigs& curPMUConfigs,
PCM* m,
SystemCounterState& SysBeforeState, SystemCounterState& SysAfterState,
Expand Down Expand Up @@ -1719,6 +1721,14 @@ void printTransposed(const PCM::RawPMUConfigs& curPMUConfigs,
[&]() { printUncoreRows([](const uint32 u, const uint32 i, const ServerUncoreCounterState& before, const ServerUncoreCounterState& after) { return getCXLDPCounter(u, i, before, after); }, ServerUncoreCounterState::maxCXLPorts, "CXLDP");
});
}
else if ((pmu_type = m->strToUncorePMUID(type)) != PCM::INVALID_PMU_ID)
{
choose(outputType,
[&]() { printUncoreRows(nullptr, (uint32) m->getMaxNumOfUncorePMUs(pmu_type), type); },
[&]() { printUncoreRows(nullptr, (uint32) m->getMaxNumOfUncorePMUs(pmu_type), type); },
[&]() { printUncoreRows([](const uint32 u, const uint32 i, const ServerUncoreCounterState& before, const ServerUncoreCounterState& after) { return getUncoreCounter(pmu_type, u, i, before, after); }, (uint32)m->getMaxNumOfUncorePMUs(pmu_type), type);
});
}
else
{
std::cerr << "ERROR: unrecognized PMU type \"" << type << "\"\n";
Expand Down Expand Up @@ -2150,6 +2160,24 @@ void print(const PCM::RawPMUConfigs& curPMUConfigs,
}
}
}
else if ((pmu_type = m->strToUncorePMUID(type)) != PCM::INVALID_PMU_ID)
{
for (uint32 s = 0; s < m->getNumSockets(); ++s)
{
for (uint32 unit = 0; unit < m->getMaxNumOfUncorePMUs(pmu_type); ++unit)
{
int i = 0;
for (auto& event : events)
{
choose(outputType,
[s, unit, &type]() { cout << "SKT" << s << type << unit << separator; },
[&event, &i, &type]() { if (event.second.empty()) cout << type << "Event" << i << separator; else cout << event.second << separator; },
[&]() { cout << getUncoreCounter(pmu_type, unit, i, BeforeUncoreState[s], AfterUncoreState[s]) << separator; });
++i;
}
}
}
}
else
{
std::cerr << "ERROR: unrecognized PMU type \"" << type << "\"\n";
Expand Down
44 changes: 38 additions & 6 deletions src/uncore_pmu_discovery.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,37 @@ class UncorePMUDiscovery
}
return "unknown";
};
union PCICFGAddress
{
uint64 raw;
struct {
uint64 offset:12;
uint64 function:3;
uint64 device:5;
uint64 bus:8;
} fields;
std::string getStr() const
{
std::ostringstream out(std::ostringstream::out);
out << std::hex << fields.bus << ":" << fields.device << "." << fields.function << "@" << fields.offset;
out << std::dec;
return out.str();
}
};
static void printHelper(const accessTypeEnum accessType, const uint64 addr)
{
if (accessType == PCICFG)
{
PCICFGAddress Addr;
Addr.raw = addr;
std::cout << " (" << Addr.getStr() << ")";
}
else
{
std::cout << " (-)";
}
std::cout << " with access type " << std::dec << accessTypeStr(accessType);
}
protected:
struct GlobalPMU
{
Expand All @@ -53,9 +84,9 @@ class UncorePMUDiscovery
{
std::cout << "global PMU " <<
" of type " << std::dec << type <<
" globalCtrl: 0x" << std::hex << globalCtrlAddr <<
" with access type " << std::dec << accessTypeStr(accessType) <<
" stride: " << std::dec << stride
" globalCtrl: 0x" << std::hex << globalCtrlAddr;
UncorePMUDiscovery::printHelper((accessTypeEnum)accessType, globalCtrlAddr);
std::cout << " stride: " << std::dec << stride
<< "\n";
}
};
Expand All @@ -77,9 +108,10 @@ class UncorePMUDiscovery
std::cout << "unit PMU " <<
" of type " << std::dec << boxType <<
" ID " << boxID <<
" box ctrl: 0x" << std::hex << boxCtrlAddr <<
" width " << std::dec << bitWidth <<
" with access type " << accessTypeStr(accessType) <<
" box ctrl: 0x" << std::hex << boxCtrlAddr;
UncorePMUDiscovery::printHelper((accessTypeEnum)accessType, boxCtrlAddr);
std::cout <<
" width " << bitWidth <<
" numRegs " << numRegs <<
" ctrlOffset " << ctrlOffset <<
" ctrOffset " << ctrOffset <<
Expand Down
Loading