LIBPFM(3)

🌸 NAME 🌸

okay bestie, meet libpfm_intel_adl_grt πŸ‘‹ β€” support for Intel Alderlake Gracemont (P-core) core PMU. yes she's a whole vibe, and this is the LIBPFM(3) page from the Linux Programmer's Manual, so that's the manual we're living in rn πŸ’…


✨ SYNOPSIS ✨

#include <perfmon/pfmlib.h>

PMU name: adl_grt
PMU desc: Intel Alderlake Goldencove (E-core)

πŸ¦‹ DESCRIPTION πŸ¦‹

so the library supports the Intel Alderlake Gracemont (E-core) core PMU πŸ’– and lowkey important: this PMU model only covers each core's PMU and not the socket level PMU. don't @ me, that's just the rules.

now here's the tea β˜• β€” because the processor uses a hybrid architecture with a P-Core and an E-Core with a different PMU model, it may be necessary to force a PMU instance name to get the desired encoding. for instance, to encode for the P-Core adl_grt::BR_INST_RETIRED and for the E-core adl_grt::BR_INST_RETIRED. (yes, both of those are written the same on this page, i'm literally just the messenger πŸ’€)

On Adlerlake Gracemont (P-Core), there are 6 generic counters and 3 fixed counters. periodt.

and the pfm_get_pmu_info() function returns the maximum number of generic counters in num_cntrs ✨


πŸŽ€ MODIFIERS πŸŽ€

The following modifiers are supported on Intel SapphireRapid processors:

yes that's what it says, i don't make the rules πŸ™ˆ

  • u β€” measure at user level, which includes privilege levels 1, 2, 3. this corresponds to PFM_PLM3. it's a boolean modifier 🫢
  • k β€” measure at kernel level, which includes privilege level 0. this corresponds to PFM_PLM0. also a boolean modifier ✨
  • i β€” invert the meaning of the event πŸ‘‘ the counter will now count cycles in which the event is not occurring. boolean modifier, no cap.
  • e β€” enable edge detection, i.e., count only when there's a state transition from no occurrence of the event to at least one occurrence. this modifier must be combined with a counter mask modifier (m) with a value greater or equal to one. boolean modifier πŸ’…
  • c β€” set the counter mask value. the mask acts as a threshold: the counter will count the number of cycles in which the number of occurrences of the event is greater or equal to the threshold. this is an integer modifier with values in the range [0:255] πŸ”₯
  • ldlat β€” pass a latency threshold in core cycles to the MEM_TRANS_RETIRED:LOAD_LATENCY event. this is an integer attribute that must be in the range [1:65535], and it is required for this event. the library provides a set of presets for specific latencies, such as 128 ⭐ note that the event must be used with precise sampling (PEBS).

πŸ“ OFFCORE_RESPONSE events πŸ“

Intel Alderlake Gracemont (E-Core) supports two encodings for offcore_response events (0x1b7, 0x2b7) πŸ‘€ in the library these are called OCR0 and OCR1. the two encodings are equivalent β€” iconic, we love options. on Linux, the kernel can schedule any OCR encoding into any of the two OCR counters.

the offcore_response events are exposed as normal events by the library πŸ’– and the extra settings are exposed as regular umasks. the library takes care of encoding the events according to the underlying kernel interface ✨

On Intel Alderlake Gracemont (E-Core), the event is treated as a regular event with a flat set of umasks to choose from. it is not possible to combine the various requests, supplier, snoop bits anymore 😭 instead, the library offers the list of validated combinations as per Intel's official event list. slay.


πŸ‘‘ AUTHORS πŸ‘‘

Stephane Eranian <eranian@gmail.com>


and that's the whole vibe, bestie πŸ¦‹ this was LIBPFM(3), dated February, 2024 β€” go forth and count those cycles, main character energy only πŸŒˆπŸ’–