Analytic counters and events
The PAI facility provides counters for specific analytic instructions.
Listing the analytic counters
# perf list pmu | grep pai_ext
pai_ext/NNPA_SMALLBATCH/ [Kernel PMU event]
pai_ext/NNPA_LARGEDIM/ [Kernel PMU event]
pai_ext/NNPA_SMALLTENSOR/ [Kernel PMU event]
pai_ext/NNPA_1MFRAME/ [Kernel PMU event]
pai_ext/NNPA_2GFRAME/ [Kernel PMU event]
pai_ext/NNPA_ACCESSEXCEPT/ [Kernel PMU event]
pai_ext/NNPA_ADD/ [Kernel PMU event]
pai_ext/NNPA_ALL/ [Kernel PMU event]
pai_ext/NNPA_AVGPOOL2D/ [Kernel PMU event]
...
For more information about these counters, see z/Architecture® Principles of Operation, SA22-7832 for your hardware system. This reference manual uses hyphens (-) instead of underscore characters (_) in the counter names.
From Linux®, the counters are accessed through the
perf_pai_ext
device driver. This device driver is compiled into the kernel. Apart
from the hardware-supplied PAI counters, the perf_pai_ext
device driver provides
the NNPA_ALL
counter, which contains the sum of all PAI counters for analytic
instructions.
You can list all available analytic counters by listing the sysfs attributes at
/sys/devices/pai_ext/events. For example, counter
NNPA_AVGPOOL2D
is represented as
/sys/devices/pai_ext/events/NNPA_AVGPOOL2D.
Mapping names, event numbers, and counter numbers for analytic counters
The sysfs representation of a counter at /sys/devices/pai_ext/events
contains the counter's event number in hexadecimal notation. Subtract 0x1800
from
the event number to obtain the counter number.
0x1810
.# cat /sys/devices/pai_ext/events/NNPA_AVGPOOL2D
event=0x1810
Hence, the counter number is 0x1810 - 0x1800 = 0x10
in
hexadecimal notation, or 16 in decimal notation.