public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Document how to build PGO-optimized GCC version
@ 2022-12-28  5:36 Alexander Zaitsev
  2022-12-28  5:48 ` Andrew Pinski
  2022-12-28  7:22 ` NightStrike
  0 siblings, 2 replies; 4+ messages in thread
From: Alexander Zaitsev @ 2022-12-28  5:36 UTC (permalink / raw)
  To: gcc

[-- Attachment #1: Type: text/plain, Size: 904 bytes --]

Hello.

We are using GCC for our C++ projects. Our projects are huge, commit 
rate is quite huge, so our CI workers are always busy (so as any other 
CI workers, honestly). Since we want to increase build speed, one of the 
option is to optimize the compiler itself. Sounds like a good case for PGO.

Clang has the infrastructure for building the Clang itself with PGO: 
https://llvm.org/docs/HowToBuildWithPGO.html . I have tried to find 
something like that for GCC but with no success.

My proposal is:

  * add support for building PGO-optimized GCC into the GCC build
    infrastructure
  * add documentation to the GCC site, how to build GCC with PGO
    optimizations
  * (if GCC community provides prebuilt gcc binaries) use PGO for the
    prebuilt binaries. E.g. Clang and rustc already uses this approach.

Any feedback is appreciated.

Thanks in advance!

-- 
Best regards,
Alexander Zaitsev

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Document how to build PGO-optimized GCC version
  2022-12-28  5:36 Document how to build PGO-optimized GCC version Alexander Zaitsev
@ 2022-12-28  5:48 ` Andrew Pinski
  2022-12-28  8:57   ` Martin Liška
  2022-12-28  7:22 ` NightStrike
  1 sibling, 1 reply; 4+ messages in thread
From: Andrew Pinski @ 2022-12-28  5:48 UTC (permalink / raw)
  To: Alexander Zaitsev; +Cc: gcc

On Tue, Dec 27, 2022 at 9:38 PM Alexander Zaitsev <zamazan4ik@tut.by> wrote:
>
> Hello.
>
> We are using GCC for our C++ projects. Our projects are huge, commit
> rate is quite huge, so our CI workers are always busy (so as any other
> CI workers, honestly). Since we want to increase build speed, one of the
> option is to optimize the compiler itself. Sounds like a good case for PGO.
>
> Clang has the infrastructure for building the Clang itself with PGO:
> https://llvm.org/docs/HowToBuildWithPGO.html . I have tried to find
> something like that for GCC but with no success.
>
> My proposal is:
>
>   * add support for building PGO-optimized GCC into the GCC build
>     infrastructure
>   * add documentation to the GCC site, how to build GCC with PGO
>     optimizations

It is already there, see the last section of
https://gcc.gnu.org/install/build.html (Building with profile
feedback).  It has been included in GCC and documented since June
2003.
https://gcc.gnu.org/r0-50361-g8f231b5d874dcb .

>   * (if GCC community provides prebuilt gcc binaries) use PGO for the
>     prebuilt binaries. E.g. Clang and rustc already uses this approach.

GCC community does not provide prebuilt gcc binaries for a few
different reasons.
But distros do provide more recent prebuilt binaries, you could ask
them to build using PGO (some do already I think).

Thanks,
Andrew Pinski

>
> Any feedback is appreciated.
>
> Thanks in advance!
>
> --
> Best regards,
> Alexander Zaitsev

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Document how to build PGO-optimized GCC version
  2022-12-28  5:36 Document how to build PGO-optimized GCC version Alexander Zaitsev
  2022-12-28  5:48 ` Andrew Pinski
@ 2022-12-28  7:22 ` NightStrike
  1 sibling, 0 replies; 4+ messages in thread
From: NightStrike @ 2022-12-28  7:22 UTC (permalink / raw)
  To: Alexander Zaitsev; +Cc: gcc

[-- Attachment #1: Type: text/plain, Size: 1813 bytes --]

On Wed, Dec 28, 2022, 00:37 Alexander Zaitsev <zamazan4ik@tut.by> wrote:

> Hello.
>
> We are using GCC for our C++ projects. Our projects are huge, commit
> rate is quite huge, so our CI workers are always busy (so as any other
> CI workers, honestly). Since we want to increase build speed, one of the
> option is to optimize the compiler itself. Sounds like a good case for PGO.
>
> Clang has the infrastructure for building the Clang itself with PGO:
> https://llvm.org/docs/HowToBuildWithPGO.html . I have tried to find
> something like that for GCC but with no success.
>
> My proposal is:
>
>   * add support for building PGO-optimized GCC into the GCC build
>     infrastructure
>   * add documentation to the GCC site, how to build GCC with PGO
>     optimizations
>   * (if GCC community provides prebuilt gcc binaries) use PGO for the
>     prebuilt binaries. E.g. Clang and rustc already uses this approach.
>
> Any feedback is appreciated.
>
> Thanks in advance!
>
> --
> Best regards,
> Alexander Zaitsev
>

I would wager that you would get more bang for your buck out of 1) building
a more recent gcc yourself instead of using whatever comes packaged, and 2)
building with march=native for each processor type you run on. Not that PGO
won't help, of course it will since you are building the same software
repeatedly, but my personal experience doing the exact same thing is that I
saw a 50% performance improvement from just from that, and it's rather
trivial to do if your infrastructure is homogeneous (mine was a many node
compute cluster). The next biggest bottleneck for me was IO, because the
project this was for when compiling was very file intensive.

Anyway, just some alternative suggestions, since there's already a response
giving you what you asked for. Feel free to ignore me :)

>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Document how to build PGO-optimized GCC version
  2022-12-28  5:48 ` Andrew Pinski
@ 2022-12-28  8:57   ` Martin Liška
  0 siblings, 0 replies; 4+ messages in thread
From: Martin Liška @ 2022-12-28  8:57 UTC (permalink / raw)
  To: Andrew Pinski, Alexander Zaitsev; +Cc: gcc

On 12/28/22 06:48, Andrew Pinski via Gcc wrote:
> But distros do provide more recent prebuilt binaries, you could ask
> them to build using PGO (some do already I think).

Yes, I can confirm that the openSUSE gccX pacakges utlize both PGO and LTO during
the compiler bootstrap. So, you can use:
https://software.opensuse.org/package/gcc12

What compiler version and the architecture are you interested in?

Cheers,
Martin

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-12-28  8:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-28  5:36 Document how to build PGO-optimized GCC version Alexander Zaitsev
2022-12-28  5:48 ` Andrew Pinski
2022-12-28  8:57   ` Martin Liška
2022-12-28  7:22 ` NightStrike

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).