hardware-counters
counter_sets.sh
#!/bin/bash
# Counter-set rotation for CrayPat on Cirrus (AMD EPYC 9825, Zen 5 "Turin",
# family 26). Only 5 hardware counters fit at once, as on ARCHER2.
#
# DIFFERENCES FROM ARCHER2 (EPYC 7742, Zen 2 "Rome", family 23):
# * Cirrus has NO cray_rapl and NO cray_zenl3 components, so there is no
# PACKAGE_ENERGY / PP0_ENERGY and no UNC_L3_* here. On ARCHER2 those were
# free extras on separate registers. PP0/PACKAGE was believed at the time to
# be the single strongest predictor, which is why it was prioritised; that
# importance figure has since been RETRACTED (docs/modelling.md). Being on a
# separate register is exactly what inflated it, so the collection decision
# was sound even though the inference drawn from it was not, and the
# predictor, so cross-platform models must drop them.
# * The Rome 'mem_bw' and 'stalls' predefined groups do not exist on Turin
# (CounterGroups.amdcpu_fam26modXX defines only 0, 1, fp_stats, default).
# Set D therefore names the underlying DISPATCH_RESOURCE_STALL_CYCLES_1
# sub-events directly; LOAD_QUEUE_RSRC_STALL and STORE_QUEUE_RSRC_STALL
# exist on BOTH platforms, so the load/store stall fractions stay
# comparable. (Rome's FP_REG_FILE_RSRC_STALL is FP_SCHEDULER_RSRC_STALL on
# Turin - a near but not exact equivalent, so it is kept out of the shared
# feature set.)
# * Cirrus adds presets ARCHER2 lacks (L1_DCM, L2_TCM, VEC_INS, FMA_INS),
# used in set C.
#
# Sets A, B, E are byte-identical to the ARCHER2 definitions.
case "$1" in
A) echo "PAPI_FP_OPS,PAPI_FP_INS,PAPI_TOT_INS,PAPI_TOT_CYC" ;;
B) echo "PAPI_L2_DCM,PAPI_L2_DCH,PAPI_L1_DCA,PAPI_L2_DCR,PAPI_TOT_CYC" ;;
C) echo "PAPI_L1_DCM,PAPI_L2_TCM,PAPI_VEC_INS,PAPI_FMA_INS,PAPI_TOT_CYC" ;;
D) echo "DISPATCH_RESOURCE_STALL_CYCLES_1:LOAD_QUEUE_RSRC_STALL,DISPATCH_RESOURCE_STALL_CYCLES_1:STORE_QUEUE_RSRC_STALL,DISPATCH_RESOURCE_STALL_CYCLES_1:FP_SCHEDULER_RSRC_STALL,PAPI_TOT_CYC" ;;
E) echo "PAPI_BR_INS,PAPI_BR_MSP,PAPI_TLB_DM,PAPI_TOT_CYC,PAPI_TOT_INS" ;;
*) echo "usage: $0 {A|B|C|D|E}" >&2; exit 1 ;;
esac