From 9c8f3d5e7d5ee64ffe5c50a72b087227f2e8f957 Mon Sep 17 00:00:00 2001 From: Andi Kleen Date: Thu, 31 Oct 2024 16:31:02 -0700 Subject: Update gcc-auto-profile / gen_autofdo_event.py - Fix warnings with newer python versions about bad escapes by making all the python string raw. - Add a fallback for using the builtin perf event list if the CPU model number is unknown. - Regenerate the shipped gcc-auto-profile with the changes. contrib/ChangeLog: * gen_autofdo_event.py: Convert strings to raw. Add fallback to using builtin perf event list. gcc/ChangeLog: * config/i386/gcc-auto-profile: Regenerate. --- gcc/config/i386/gcc-auto-profile | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'gcc') diff --git a/gcc/config/i386/gcc-auto-profile b/gcc/config/i386/gcc-auto-profile index 04f7d35..528b34e 100755 --- a/gcc/config/i386/gcc-auto-profile +++ b/gcc/config/i386/gcc-auto-profile @@ -82,17 +82,24 @@ model*:\ 126|\ model*:\ 167|\ model*:\ 140|\ model*:\ 141|\ -model*:\ 143|\ -model*:\ 207|\ model*:\ 106|\ -model*:\ 108) E="cpu/event=0xc4,umask=0x20/p$FLAGS" ;; +model*:\ 108|\ +model*:\ 173|\ +model*:\ 174) E="cpu/event=0xc4,umask=0x20/$FLAGS" ;; model*:\ 134|\ model*:\ 150|\ -model*:\ 156|\ -model*:\ 190) E="cpu/event=0xc4,umask=0xfe/p$FLAGS" ;; +model*:\ 156) E="cpu/event=0xc4,umask=0xfe/p$FLAGS" ;; +model*:\ 143|\ +model*:\ 207) E="cpu/event=0xc4,umask=0x20/p$FLAGS" ;; +model*:\ 190) E="cpu/event=0xc4,umask=0xc0/$FLAGS" ;; +model*:\ 190) E="cpu/event=0xc4,umask=0xfe/$FLAGS" ;; *) + if perf list br_inst_retired | grep -q br_inst_retired.near_taken ; then + E=br_inst_retired.near_taken:p + else echo >&2 "Unknown CPU. Run contrib/gen_autofdo_event.py --all --script to update script." - exit 1 ;; + exit 1 + fi ;; esac set -x if ! perf record -e $E -b "$@" ; then @@ -100,7 +107,7 @@ if ! perf record -e $E -b "$@" ; then # (e.g., in a virtual machine). Trying to run without /p. set +x echo >&2 "Retrying without /p." - E="$(echo "${E}" | sed -e 's/\/p/\//')" + E="$(echo "${E}" | sed -e \'s/\/p/\//\ -e s/:p//)" set -x exec perf record -e $E -b "$@" set +x -- cgit v1.1