Skip to content

Commit 470b62b

Browse files
Implement likwid across all intel + new HBM variables for SPR
1 parent 24cec66 commit 470b62b

60 files changed

Lines changed: 1244 additions & 1446 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/monitor_variable_rename_map.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ types:
2525
intel_hsw_imc: intel_x86_uncore_imc_hsw
2626
intel_bdw_imc: intel_x86_uncore_imc_bdw
2727
intel_skx_imc: intel_x86_uncore_imc_skx
28+
intel_icx_imc: intel_x86_uncore_imc_icx
29+
intel_spr_imc: intel_x86_uncore_imc_spr
2830
intel_snb_cbo: intel_x86_uncore_cbo_snb
2931
intel_ivb_cbo: intel_x86_uncore_cbo_ivb
3032
intel_hsw_cbo: intel_x86_uncore_cbo_hsw
@@ -66,6 +68,8 @@ events:
6668
Bounce: bounce
6769
CAS_READS: dram_cas_reads
6870
CAS_WRITES: dram_cas_writes
71+
HBM_CAS_READS: hbm_cas_reads
72+
HBM_CAS_WRITES: hbm_cas_writes
6973
CPU_CLK_UNHALTED_CORE: cycles_unhalted_core
7074
CPU_CLK_UNHALTED_REF: cycles_unhalted_ref
7175
DCGM_CPU_POWER_LIMIT_W: dcgm_cpu_power_limit_w

monitor/LIKWID_MIGRATION.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# LIKWID PMU migration (Intel)
2+
3+
Intel core and uncore performance counters are collected through **LIKWID PMON**
4+
(`likwid_pmc_adapter.c`, `likwid_uncore_adapter.c`). Native MSR, PCI, and MMIO
5+
programming in legacy `intel_*` collectors has been retired behind thin wrappers.
6+
7+
## CPU detection (`cpuid.c`)
8+
9+
| `processor_t` | CPUID signature |
10+
|---------------|-----------------|
11+
| `CASCADE_LAKE` | `06_55` |
12+
| `SKYLAKE` (client) | `06_4e`, `06_5e` |
13+
| `ICELAKE_SERVER` | `06_6a`, `06_6c` |
14+
| `SAPPHIRE_RAPIDS` | `06_8f` |
15+
16+
## Collector mapping
17+
18+
| `st_name` | LIKWID profile | Notes |
19+
|-----------|----------------|-------|
20+
| `host_cpu_hw` | `likwid_arch_eventset_for_processor()` | Auto-disables `intel_x86_pmc_gpr4/8` when active |
21+
| `intel_x86_rapl` | LIKWID RAPL (`likwid_rapl.c`) | Unchanged |
22+
| `intel_x86_uncore_imc_{snb,ivb,hsw,bdw,skx}` | `MBOX*` / `MDEV*` CAS events | Per-MBOX device rows |
23+
| `intel_x86_uncore_imc_icx` | `MDEV*` DDR bytes | Ice Lake server |
24+
| `intel_x86_uncore_imc_spr` | `MBOX*` + `HBM*` CAS | DDR and HBM on same type |
25+
| `intel_x86_uncore_cbo_*`, `cha_skx`, `qpi_*`, `hau_*`, `r2pci_*` | LIKWID adapter | Auto-disable when no LIKWID event profile |
26+
27+
## Init order
28+
29+
`host_cpu_hw` must begin before uncore collectors so `HPMinit` / `perfmon_init`
30+
run first (`stats_registry.c` ordering).

monitor/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ Small, testable units and daemons are split along these lines (non-exhaustive):
4444
| Archive header / schema suffix / directive class / marks (file mode) | `stats_file_format.c`, `stats_file_format.h` (`stats_file_classify_header_directive`, `stats_file_fprint_mark_multiline`, …); orchestration in `stats_file.c`. |
4545
| RMQ text payloads | `stats_buffer.c` + `stats_buffer_data_append.c` (persistent AMQP; cached `uname` for header + sample lines; batched rows; declare `syslog` INFO in `DEBUG` only). |
4646
| DEBUG shm mirror (`@fast`/`@full` snapshots) | `stats_buffer_debug_shm.c`, `stats_buffer_debug_shm.h` (`DEBUG` builds only). |
47+
| Intel CPUID / generation gating | `cpuid.c`, `intel_cpuid_match.c`, `intel_processor.c` |
48+
| LIKWID core + uncore PMU | `likwid_pmc_adapter.c`, `likwid_uncore_adapter.c`, `likwid_uncore_profiles.c` |
49+
50+
Intel PMU collection uses **LIKWID only** on x86 (see [LIKWID_MIGRATION.md](LIKWID_MIGRATION.md)).
51+
Detected generations include Cascade Lake (`06_55`), Ice Lake server (`06_6a`/`06_6c`),
52+
and Sapphire Rapids (`06_8f`), with SPR DDR+HBM uncore keys (`dram_*`, `hbm_*`).
4753

4854
## Two-tier collection (fast/slow) and sparse rows
4955

monitor/configure.ac

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,15 @@ case "$host_cpu" in
102102
x86_64|i?86) is_x86=true ;;
103103
esac
104104

105+
likwid=false
106+
dcgm_checked=false
107+
CPU_COUNTER_BACKEND_CPPFLAG=""
108+
MONITOR_ARCH_CPPFLAG=""
109+
110+
if test "x$hardware" != "xtrue"; then
111+
cpu_counter_backend="none"
112+
AC_MSG_NOTICE([CPU counter backend: disabled (--disable-hardware)])
113+
else
105114
if test "x$cpu_counter_backend" = "xauto"; then
106115
if test "x$is_x86" = "xtrue"; then
107116
cpu_counter_backend="likwid"
@@ -139,11 +148,7 @@ if test "x$cpu_counter_backend" = "xlikwid"; then
139148
esac
140149
fi
141150
fi
142-
AM_CONDITIONAL([LIKWID], [test x$likwid = xtrue])
143-
AM_CONDITIONAL([CPU_BACKEND_LIKWID], [test x$cpu_counter_backend = xlikwid])
144-
AM_CONDITIONAL([CPU_BACKEND_DCGM], [test x$cpu_counter_backend = xdcgm])
145151

146-
dcgm_checked=false
147152
if test "x$cpu_counter_backend" = "xdcgm"; then
148153
if test "x$enable_all_static" = xyes; then
149154
save_LIBS=$LIBS
@@ -168,9 +173,14 @@ if test "x$cpu_counter_backend" = "xdcgm"; then
168173
dcgm_checked=true
169174
CPU_COUNTER_BACKEND_CPPFLAG="-DMONITOR_CPU_BACKEND_DCGM"
170175
MONITOR_ARCH_CPPFLAG=""
171-
else
176+
elif test "x$cpu_counter_backend" = "xlikwid"; then
172177
CPU_COUNTER_BACKEND_CPPFLAG="-DMONITOR_CPU_BACKEND_LIKWID"
173178
fi
179+
180+
if test "x$hardware" = "xtrue"; then
181+
AC_MSG_NOTICE([CPU counter backend: ${cpu_counter_backend} (host_cpu=${host_cpu})])
182+
fi
183+
fi
174184
AC_SUBST([CPU_COUNTER_BACKEND_CPPFLAG])
175185

176186
AC_ARG_WITH([monitor-arch],
@@ -207,7 +217,11 @@ case "$host_cpu" in
207217
esac
208218
AM_CONDITIONAL([MONITOR_ARCH_ARM], [test x$monitor_arch_arm = xtrue])
209219

210-
AC_MSG_NOTICE([CPU counter backend: ${cpu_counter_backend} (host_cpu=${host_cpu})])
220+
AM_CONDITIONAL([LIKWID], [test x$likwid = xtrue])
221+
AM_CONDITIONAL([CPU_BACKEND_LIKWID],
222+
[test x$hardware = xtrue -a x$cpu_counter_backend = xlikwid])
223+
AM_CONDITIONAL([CPU_BACKEND_DCGM],
224+
[test x$hardware = xtrue -a x$cpu_counter_backend = xdcgm])
211225

212226
AC_ARG_ENABLE([infiniband],
213227
[ --enable-infiniband Enable Infiniband support (default is true)],
@@ -432,6 +446,30 @@ AS_IF([test "x$with_systemduserunitdir" != "xno"],
432446
[AC_SUBST([systemduserunitdir], [$with_systemduserunitdir])])
433447
AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemduserunitdir" != "xno"])
434448

449+
MONITOR_FEATURE_CPPFLAGS=""
450+
if test "x$hardware" = "xtrue"; then
451+
MONITOR_FEATURE_CPPFLAGS="$MONITOR_FEATURE_CPPFLAGS -DMONITOR_WITH_HARDWARE"
452+
fi
453+
if test "x$infiniband" = "xtrue"; then
454+
MONITOR_FEATURE_CPPFLAGS="$MONITOR_FEATURE_CPPFLAGS -DMONITOR_WITH_INFINIBAND"
455+
fi
456+
if test "x$lustre" = "xtrue"; then
457+
MONITOR_FEATURE_CPPFLAGS="$MONITOR_FEATURE_CPPFLAGS -DMONITOR_WITH_LUSTRE"
458+
fi
459+
if test "x$gpu" = "xtrue"; then
460+
MONITOR_FEATURE_CPPFLAGS="$MONITOR_FEATURE_CPPFLAGS -DMONITOR_WITH_GPU"
461+
fi
462+
if test "x$amd_gpu" = "xtrue"; then
463+
MONITOR_FEATURE_CPPFLAGS="$MONITOR_FEATURE_CPPFLAGS -DMONITOR_WITH_AMD_GPU"
464+
fi
465+
if test "x$opa" = "xtrue"; then
466+
MONITOR_FEATURE_CPPFLAGS="$MONITOR_FEATURE_CPPFLAGS -DMONITOR_WITH_OPA"
467+
fi
468+
if test "x$monitor_arch_arm" = "xtrue"; then
469+
MONITOR_FEATURE_CPPFLAGS="$MONITOR_FEATURE_CPPFLAGS -DMONITOR_HOST_IS_ARM"
470+
fi
471+
AC_SUBST([MONITOR_FEATURE_CPPFLAGS])
472+
435473
AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile])
436474
AC_OUTPUT
437475

monitor/scripts/cross_compile_test.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,6 @@ foreign_monitor_cfg_args() {
10481048
local args=(
10491049
--disable-all-static
10501050
--with-systemduserunitdir=no
1051-
--with-cpu-counter-backend=auto
10521051
--disable-gpu
10531052
--disable-amd-gpu
10541053
--disable-infiniband
@@ -1058,7 +1057,10 @@ foreign_monitor_cfg_args() {
10581057

10591058
# Under emulation, /proc/cpuinfo may reflect host details. Keep x86 deterministic.
10601059
if is_x86_triplet "${target}"; then
1061-
args+=(--with-monitor-arch=intel)
1060+
args+=(--with-monitor-arch=intel --with-cpu-counter-backend=auto)
1061+
else
1062+
# Non-x86 foreign smoke has no LIKWID and usually no libdcgm in the sysroot.
1063+
args+=(--disable-hardware)
10621064
fi
10631065
printf '%s\n' "${args[@]}"
10641066
}

monitor/src/Makefile.am

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ hpcperfstatsd_CPPFLAGS = \
3131
-DSTATS_LOCK_PATH=\"$(STATS_LOCK_PATH)\" \
3232
-DJOBID_FILE_PATH=\"$(JOBID_FILE_PATH)\" \
3333
@CPU_COUNTER_BACKEND_CPPFLAG@ \
34+
@MONITOR_FEATURE_CPPFLAGS@ \
3435
@METRIC_PROFILER_CPPFLAG@ \
3536
@METRIC_PROFILER_BACKEND_CPPFLAG@
3637

@@ -59,6 +60,10 @@ hpcperfstatsd_SOURCES = \
5960
collect_tier.c \
6061
cpuid.h \
6162
cpuid.c \
63+
intel_cpuid_match.h \
64+
intel_cpuid_match.c \
65+
intel_processor.h \
66+
intel_processor.c \
6267
daemonize.h \
6368
daemonize.c \
6469
monitor_log.h \
@@ -200,6 +205,8 @@ TYPES += \
200205
intel_bdw_cbo.c \
201206
intel_bdw_hau.c \
202207
intel_bdw_imc.c \
208+
intel_icx_imc.c \
209+
intel_spr_imc.c \
203210
intel_bdw_qpi.c \
204211
intel_bdw_r2pci.c \
205212
intel_hsw_cbo.c \
@@ -259,7 +266,15 @@ hpcperfstatsd_SOURCES += \
259266
likwid_pmc_adapter.h \
260267
likwid_pmc_adapter.c \
261268
likwid_arch_map.h \
262-
likwid_arch_map.c
269+
likwid_arch_map.c \
270+
likwid_uncore_adapter.h \
271+
likwid_uncore_adapter.c \
272+
likwid_uncore_profiles.h \
273+
likwid_uncore_profiles.c \
274+
intel_skx_imc.h \
275+
intel_icx_imc.h \
276+
intel_spr_imc.h \
277+
intel_snb_imc.h
263278
endif
264279

265280
if INFINIBAND

monitor/src/cpu_counter_metrics_likwid_begin.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "cpu_counter_metrics_likwid_begin.h"
1414

1515
#ifndef MONITOR_CPU_BACKEND_DCGM
16+
#include "cpuid.h"
1617
#include "likwid_pmc_adapter.h"
1718
#include "likwid_arch_map.h"
1819

@@ -22,7 +23,8 @@ int likwid_backend_begin(struct stats_type *type)
2223
{
2324
(void)type;
2425
if (likwid_pmc_adapter_init(nr_cpus) == 0 &&
25-
likwid_pmc_adapter_setup_events(likwid_arch_eventset()) == 0) {
26+
likwid_pmc_adapter_setup_events(
27+
likwid_arch_eventset_for_processor(processor, n_pmcs)) == 0) {
2628
g_likwid_ready = 1;
2729
return 0;
2830
}

monitor/src/cpuid.c

Lines changed: 5 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "trace.h"
1010
#include "path_open_fail_once.h"
1111
#include "cpuid.h"
12+
#include "intel_cpuid_match.h"
1213

1314
#if defined(__i386__) || defined(__x86_64__)
1415

@@ -48,52 +49,10 @@ processor_t signature(int *n_pmcs) {
4849
*n_pmcs = (eax >> 8) & 0xFF;
4950
TRACE("Number of PMCs = %d\n", *n_pmcs);
5051

51-
if (strncmp(sig, "06_1a", 5) == 0 ||
52-
strncmp(sig, "06_1e", 5) == 0 ||
53-
strncmp(sig, "06_2e", 5) == 0) {
54-
TRACE("Nehalem %s\n", sig);
55-
return NEHALEM;
56-
}
57-
58-
if (strncmp(sig, "06_25", 5) == 0 ||
59-
strncmp(sig, "06_2c", 5) == 0 ||
60-
strncmp(sig, "06_2f", 5) == 0) {
61-
TRACE("Westmere %s\n", sig);
62-
return WESTMERE;
63-
}
64-
65-
if (strncmp(sig, "06_3a", 5) == 0 ||
66-
strncmp(sig, "06_3e", 5) == 0) {
67-
TRACE("Ivy Bridge %s\n", sig);
68-
return IVYBRIDGE;
69-
}
70-
71-
if (strncmp(sig, "06_2a", 5) == 0 ||
72-
strncmp(sig, "06_2d", 5) == 0) {
73-
TRACE("Sandy Bridge %s\n", sig);
74-
return SANDYBRIDGE;
75-
}
76-
77-
if (strncmp(sig, "06_3c", 5) == 0 ||
78-
strncmp(sig, "06_45", 5) == 0 ||
79-
strncmp(sig, "06_46", 5) == 0 ||
80-
strncmp(sig, "06_3f", 5) == 0) {
81-
TRACE("Haswell %s\n", sig);
82-
return HASWELL;
83-
}
84-
85-
if (strncmp(sig, "06_3d", 5) == 0 ||
86-
strncmp(sig, "06_47", 5) == 0 ||
87-
strncmp(sig, "06_4f", 5) == 0) {
88-
TRACE("Broadwell %s %d\n", sig);
89-
return BROADWELL;
90-
}
91-
92-
if (strncmp(sig, "06_55", 5) == 0 ||
93-
strncmp(sig, "06_4e", 5) == 0 ||
94-
strncmp(sig, "06_5e", 5) == 0) {
95-
TRACE("Skylake %s\n", sig);
96-
return SKYLAKE;
52+
rc = intel_cpuid_sig_to_processor(vendor, sig);
53+
if (rc != (processor_t)-1) {
54+
TRACE("Intel processor sig %s -> %d\n", sig, (int)rc);
55+
return rc;
9756
}
9857
}
9958
else if (strncmp(vendor, "AuthenticAMD", 12) == 0) {

monitor/src/cpuid.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ typedef enum {
88
NEHALEM, WESTMERE,
99
SANDYBRIDGE, IVYBRIDGE,
1010
HASWELL, BROADWELL,
11-
SKYLAKE
11+
SKYLAKE,
12+
CASCADE_LAKE,
13+
ICELAKE_SERVER,
14+
SAPPHIRE_RAPIDS
1215
} processor_t;
1316

1417
// Return 1 for true and 0 for false

monitor/src/intel_4pmc3.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include "intel_pmc3.h"
1515
#include "intel_pmc3_core.h"
16+
#include "cpu_counter_metrics_likwid_begin.h"
1617
#include "stats.h"
1718
#include "trace.h"
1819
#include "msr_io.h"
@@ -62,6 +63,10 @@ static void intel_4pmc3_collect(struct stats_type *type)
6263

6364
static int intel_4pmc3_begin(struct stats_type *type)
6465
{
66+
if (cpu_counter_metrics_likwid_ready()) {
67+
type->st_enabled = 0;
68+
return -1;
69+
}
6570
return intel_pmc3_core_begin_if_pmcs(type, 4);
6671
}
6772

0 commit comments

Comments
 (0)