RFC: support of PGO?
Martin Liška
mliska@suse.cz
Tue Oct 20 09:08:32 GMT 2020
On 10/19/20 1:50 PM, Nick Clifton wrote:
> Hi Martin,
>
>> May I please ping this?
>
> Sorry for not responding earleir.
>
>>> Right now I make the PGO with:
>>>
>>> export C{,XX}FLAGS "-fprofile-generate=/tmp/binutils -O2 -flto"
> [...]
>
>>> Questions I have:
>>> - Would it be possible to integrate PGO into the root Makefile?
>
> Possible yes. But you would need approval from the GDB and GCC
> communities, since we all use the same top level Makefile.
>
> Probably the easiest way to approach this is to create a patch that
> adds a new set of targets to the makefile. Eg "pgo-all" or "pgo-gas".
> Then submit this patch for review.
>
> Maybe there is a way to toggle using pgo (an environment variable
> maybe ?), so that the new targets are not needed. I am not enough
> of a Makefile expert to know if this idea is feasible however.
Hello.
I see quite obstacles to make it happen:
- one needs to run ./configure twice (-fprofile-generate/-fprofile-use) and it seems
that re-configuration is not much supported by binutils
- it's not trivial to fix the failing tests, simply accepting LDFLAGS fixes something,
but breaks other tests
- that means some tools like ld will be actually trained with a failing inputes
- it would make sense to bootstrap bintuils (using gas, ld and other tools) during
build of binutils. Apparently it's only somehow supported as part of GCC's build:
../configure --disable-nls --disable-gdb --disable-gdbserver --enable-bootstrap
configure: error: cannot bootstrap without a compiler
>
>
>>> - Or do you prefer the way I made the PGO?
>
> Your method is definitely the simplest - no changes needed to any
> files. It might be helpful - if the Makefile patching idea is shot
> down - to document this process in eg binutils/README so that other
> contributors can benefit.
>
> Please excuse my ignorance on PGO - but does it work well when changes
> are made to the code base ? For example if I patch gas in some (major) way,
> is it necessary to run the multiple configure-and-build steps that you
> outlined in order to gain the benefits of PGO, or will a simple rebuild,
> using the old profile information, still work ?
It does not work in that case. However, PGO is supposed to be used by package
builds (typically in spec file), where a speed benefit is desired.
Anyway, I'm leaving the attempt for now.
Martin
>
>
>>> - I see quite some failures in ld test-suite:
>
>>> /home/marxin/Programming/binutils/objdir/ld/tmpdir/ld/collect-ld: /tmp/ld1.g2iFBN.ltrans0.ltrans.o: in function `yy_get_previous_state':
>>> /home/marxin/Programming/binutils/objdir/ld/ldlex.c:3527: undefined reference to `__gcov_time_profiler_counter'
>
>>> which means the libiberty built with PGO is missing -fprofile-generate in linker argument.
>>> Can one pass LDFALGS to 'make check'?
>
> Yes - but I suspect that you will find that not all tests honour it.
>
> Cheers
> Nick
>
>
More information about the Binutils
mailing list