This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: AutoFDO profile toolchain is open-sourced


On 21.04.2015 14:57, Diego Novillo wrote:
>From the autofdo page: https://github.com/google/autofdo

[ ... ]
Inputs:

--profile: PERF_PROFILE collected using linux perf (with last branch record).
In order to collect this profile, you will need to have an Intel CPU that
have last branch record (LBR) support. You also need to have your linux
kernel configured with LBR support. To profile:
# perf record -c PERIOD -e EVENT -b -o perf.data -- ./command
EVENT is refering to BR_INST_RETIRED:TAKEN if available. For some
architectures, BR_INST_EXEC:TAKEN also works.
[ ... ]

The important one for autofdo is -b. It asks perf to use LBR registers
for branch tracking (assuming your architecture supports it).

Thanks! It worked. Now big programs produce big gcov files. Sorry for this confusing message.

But why create_gcov does not inform about that (no branch events were found)? It creates empty gcov file and says nothing :(

Moreover, in the mentioned README it is said that perf should also be executed with option -e BR_INST_RETIRED:TAKEN.
I tried to add it but perf said that

   invalid or unsupported event: 'BR_INST_RETIRED:TAKEN'
   Run 'perf list' for a list of valid events

For my architecture x86_64 the perf list contains

   $ sudo perf list | grep -i br
      branch-instructions OR branches                    [Hardware event]
      branch-misses                                      [Hardware event]
      branch-loads                                       [Hardware
   cache event]
      branch-load-misses                                 [Hardware
   cache event]
      branch-instructions OR cpu/branch-instructions/    [Kernel PMU event]
      branch-misses OR cpu/branch-misses/                [Kernel PMU event]
      mem:<addr>[:access] [Hardware breakpoint]
      syscalls:sys_enter_brk                             [Tracepoint event]
      syscalls:sys_exit_brk                              [Tracepoint event]

There is no BR_INST_RETIRED:TAKEN there. Do you use some specific configuration of perf for that?

However, I tried to use option "-e branch-instructions". Before that the following error was obtained:

   E0421 15:57:39.308374 11551 perf_parser.cc:210] Mapped 50% of
   samples, expected at least 95%

and now it disappeared (because of option "-e branch-instructions").

Though, the performance decreases after adding option "-fauto-profile=file.gcov" or "-fprofile-use=file.gcov" to the list of compiler options.
The program becomes 10% slower than before.
Can you explain that? Maybe I should configure perf so that it will be able to collect events BR_INST_RETIRED:TAKEN ? How can it be done?

--
Best regards,
Ilya Palachev


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]