> -----Original Message----- > From: [email protected] <[email protected]> > Sent: 21 July 2026 15:29 > To: [email protected] > Cc: Tamar Christina <[email protected]>; [email protected]; > [email protected]; [email protected]; Kyrylo Tkachov > <[email protected]> > Subject: [PATCH] aarch64: Limit Arm SPE probes to PMU events > > From: Kyrylo Tkachov <[email protected]> > > The autoprofile bootstrap support probes for Arm SPE from gcc/configure, > gcc-auto-profile, and the profile-optimization testsuite support. Each > bare "perf list" scans every event class even though arm_spe is a PMU. > This can make the probe unnecessarily slow on systems with many events. > > Use "perf list pmu" at all three call sites. The PMU event class filter > has long been supported by perf and still reports arm_spe. Stubbed BRBE, > SPE, and fallback paths select the same profiler as before. > > This patch actually saves a few minutes of end-to-end bootstrap time on my > SPE > AArch64 many-core system. > > Ok for trunk?
LGTM. Thanks, Tamar > Thanks, > Kyrill > > gcc/ChangeLog: > > * config/aarch64/gcc-auto-profile: Probe for arm_spe with > "perf list pmu" instead of "perf list". > * configure.ac: Likewise. > * configure: Regenerate. > > gcc/testsuite/ChangeLog: > > * lib/profopt.exp: Likewise. > > Signed-off-by: Kyrylo Tkachov <[email protected]> > --- > gcc/config/aarch64/gcc-auto-profile | 2 +- > gcc/configure | 2 +- > gcc/configure.ac | 2 +- > gcc/testsuite/lib/profopt.exp | 2 +- > 4 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/gcc/config/aarch64/gcc-auto-profile b/gcc/config/aarch64/gcc- > auto-profile > index 8f7502b30e3..6e33047698c 100755 > --- a/gcc/config/aarch64/gcc-auto-profile > +++ b/gcc/config/aarch64/gcc-auto-profile > @@ -45,7 +45,7 @@ if [ "$use_brbe" = true ] ; then > set -x > perf record --inherit -o perf.data -j any,$FLAGS "$@" > set +x > -elif [ -n "$(perf list | grep arm_spe)" ] ; then > +elif [ -n "$(perf list pmu | grep arm_spe)" ]; then > echo >&2 "Info: Using SPE to collect branch profiles" > set -x > perf record --inherit -o perf.data -e arm_spe_0/branch_filter=1/ "$@" > diff --git a/gcc/configure b/gcc/configure > index 8f2ecfcffdc..cf2dfd99235 100755 > --- a/gcc/configure > +++ b/gcc/configure > @@ -35189,7 +35189,7 @@ $as_echo_n "checking AArch64 build supports > SPE profiling for autoprofiledbootst > if test ! -n "$($PERF record -j any,u -o /dev/null /bin/true 2>&1 | grep > "PMU Hardware or event type doesn't support branch stack sampling.")"; > then > AFDO_PROFILER=perf > aarch64_spe_support="using BRBE instead" > - elif test -n "$($PERF list | grep arm_spe)"; then > + elif test -n "$($PERF list pmu | grep arm_spe)"; then > AFDO_PROFILER=perf_spe > aarch64_spe_support=yes > fi > diff --git a/gcc/configure.ac b/gcc/configure.ac > index 030ee373a6a..77ec150c3e2 100644 > --- a/gcc/configure.ac > +++ b/gcc/configure.ac > @@ -7881,7 +7881,7 @@ if test x$PERF != xno; then > if test ! -n "$($PERF record -j any,u -o /dev/null /bin/true 2>&1 | grep > "PMU Hardware or event type doesn't support branch stack sampling.")"; > then > AFDO_PROFILER=perf > aarch64_spe_support="using BRBE instead" > - elif test -n "$($PERF list | grep arm_spe)"; then > + elif test -n "$($PERF list pmu | grep arm_spe)"; then > AFDO_PROFILER=perf_spe > aarch64_spe_support=yes > fi > diff --git a/gcc/testsuite/lib/profopt.exp b/gcc/testsuite/lib/profopt.exp > index 4f3f61958aa..cd80d5e9402 100644 > --- a/gcc/testsuite/lib/profopt.exp > +++ b/gcc/testsuite/lib/profopt.exp > @@ -456,7 +456,7 @@ proc profopt-execute { src } { > set bprefix "afdo." > set compiler [lindex $GCC_UNDER_TEST 0] > set autofdo_version [string trim [lindex [remote_exec target > "$compiler --print-autofdo-gcov-version"] 1] ] > - set profiler_check [string trim [lindex [remote_exec target > "perf --no-pager list | grep arm_spe"] 1]] > + set profiler_check [string trim [lindex [remote_exec target > "perf --no-pager list pmu | grep arm_spe"] 1]] > if {$profiler_check ne ""} { > set profiler "perf_spe" > } else { > -- > 2.50.1 (Apple Git-155)
