[all-commits] [llvm/llvm-project] 0caf0c: [llvm-profgen] Support creating profiles of arbitr...

Tim Creech via All-commits all-commits at lists.llvm.org
Sun Jul 21 00:04:48 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0caf0c93e759816663af52e8632d1c3953dbc715
      https://github.com/llvm/llvm-project/commit/0caf0c93e759816663af52e8632d1c3953dbc715
  Author: Tim Creech <timothy.m.creech at intel.com>
  Date:   2024-07-21 (Sun, 21 Jul 2024)

  Changed paths:
    A llvm/test/tools/llvm-profgen/Inputs/cmov_3.perfbin
    A llvm/test/tools/llvm-profgen/Inputs/cmov_3.perfscript
    A llvm/test/tools/llvm-profgen/Inputs/ip-duplication.perfscript
    A llvm/test/tools/llvm-profgen/Inputs/noprobe-skid.perfscript
    A llvm/test/tools/llvm-profgen/event-filtering.test
    A llvm/test/tools/llvm-profgen/iponly-nodupfactor.test
    A llvm/test/tools/llvm-profgen/iponly.test
    M llvm/tools/llvm-profgen/PerfReader.cpp
    M llvm/tools/llvm-profgen/ProfileGenerator.cpp

  Log Message:
  -----------
  [llvm-profgen] Support creating profiles of arbitrary events (#99026)

This change introduces two options which may be used to create profiles
of arbitrary PMU events.

1. `--leading-ip-only` provides a simple sample-IP-based profile mode.
This is not useful for building a profile of execution frequency, but it
is useful for building new types of profiles.

   For example, to build a profile of unpredictable branches:

perf record -b -e branch-misses:upp -o perf.data ... llvm-profgen
--perfdata perf.data --leading-ip-only ...

2. `--perf-event=event` enables the creation of a profile concerned with
a specific event or set of events. The names given should match the
"event" field as emitted by perf-script(1).

This option has two spellings: `--perf-event` and `--perf-events`. The
plural spelling accepts a comma-separated list. The singular spelling
appends a single event name to the set of events which will be used.
This is meant to accommodate event names containing commas.

Combined, these options allow generating multiple kinds of profiles from
a single `perf record` collection. For example, to generate both
execution frequency and branch mispredict profiles:

perf record -c 1000003 -b -e
br_inst_retired.near_taken:upp,br_misp_retired.all_branches:upp ...
llvm-profgen --output execution.prof
--perf-event=br_inst_retired.near_taken:upp ...
llvm-profgen --leading-ip-only --output unpredictable.prof
--perf-event=br_misp_retired.all_branches:upp ...

These additions are in support of more general HWPGO[^1], allowing
feedback from a wider range of hardware events.

[^1]:
https://llvm.org/devmtg/2024-04/slides/TechnicalTalks/Xiao-EnablingHW-BasedPGO.pdf

---------

Co-authored-by: Tim Creech <tcreech at tcreech.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list