This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: AutoFDO profile toolchain is open-sourced
- From: Dehao Chen <dehao at google dot com>
- To: Ilya Palachev <i dot palachev at samsung dot com>
- Cc: Diego Novillo <dnovillo at google dot com>, GCC Development <gcc at gcc dot gnu dot org>, David Li <davidxl at google dot com>, Jan Hubicka <hubicka at ucw dot cz>, Sebastian Pop <sebpop at gmail dot com>, Vyacheslav Barinov <v dot barinov at samsung dot com>
- Date: Tue, 21 Apr 2015 08:42:42 -0700
- Subject: Re: AutoFDO profile toolchain is open-sourced
- Authentication-results: sourceware.org; auth=none
- References: <CAO2gOZWydpiBXb=1QDyCRt-ybDieqy8X4S_+uRZk2Y2v+cFdYQ at mail dot gmail dot com> <5523ED98 dot 8080007 at samsung dot com> <CAFk3UF8To5Qcz8NN5rUF3z6j8CCg_89A+62P=1U9YrtbZ5=mLg at mail dot gmail dot com> <20150410203927 dot GA18980 at atrey dot karlin dot mff dot cuni dot cz> <552E1613 dot 2040405 at samsung dot com> <5536278E dot 3090706 at samsung dot com> <CAD_=9DQEqCqzyBKT8nZ1_uEt5gU589hSpLiOHUqLXKctJTaVHA at mail dot gmail dot com> <553653CA dot 9070009 at samsung dot com>
On Tue, Apr 21, 2015 at 6:42 AM, Ilya Palachev <i.palachev@samsung.com> wrote:
> 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?
You can use dump_gcov to show a text version of the profile dump and
check if the profile data makes sense. If your program is just a very
tight single loop, the current implementation in trunk may not yield
good results because it does not have discriminator support. Try the
google-4_9 branch instead.
Dehao
>
>
> --
> Best regards,
> Ilya Palachev