[gcc r17-2774] aarch64: Limit Arm SPE probes to PMU events
Kyrylo Tkachov via Gcc-cvs <[email protected]> Wed, 29 Jul 2026 05:45:28 +0000 (GMT)
| Newsgroups | gmane.comp.gcc.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://gcc.gnu.org/g:908c597d32ed4670d5d9b6b1706a786a9f95da05 commit r17-2774-g908c597d32ed4670d5d9b6b1706a786a9f95da05 Author: Kyrylo Tkachov <[email protected]> Date: Mon Jul 6 06:12:21 2026 -0700 aarch64: Limit Arm SPE probes to PMU events 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. 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]> Diff: --- 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 8f7502b30e36..6e33047698c8 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 a9cf7ab081a3..eea63c9721cb 100755 --- a/gcc/configure +++ b/gcc/configure @@ -35231,7 +35231,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 5d315a115910..585762271363 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -7892,7 +7892,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 4f3f61958aa5..cd80d5e94025 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 {