View previous topic :: View next topic |
Author |
Message |
papu l33t
Joined: 25 Jan 2008 Posts: 729 Location: Sota algun pi o alzina...
|
Posted: Sun Aug 18, 2024 9:01 pm Post subject: Does gcc support thinlto? |
|
|
hi,
I am not sure if gcc have thinLTO like clang has,
if yes , are there same level of performance between gcc and clang with thin?
COMMON_FLAGS="-O2 -pipe -march=native -flto=thin"
COMMON_FLAGS="-O2 -pipe -march=native -flto"
thanks _________________ --so ~amd64 & openrc --cpu 7700 non-x --ram 2x16GB --gpu RX 470 |
|
Back to top |
|
|
krumpf Apprentice
Joined: 15 Jul 2018 Posts: 187
|
Posted: Sun Aug 18, 2024 9:12 pm Post subject: |
|
|
From GCC flto documentation :
Quote: | -flto[=n]
If you specify the optional n, the optimization and code generation done at link time is executed in parallel using n parallel jobs by utilizing an installed make program.
[…]
Use -flto=auto to use GNU make’s job server, if available, or otherwise fall back to autodetection of the number of CPU threads present in your system. |
Afaik, there's no thinlto in gcc, it's specific to clang.
If you want to get better lto performance when using gcc, try to install and setup the mold linker. _________________ Dragon Princess Music Games Heroes and villains |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22619
|
Posted: Sun Aug 18, 2024 9:21 pm Post subject: |
|
|
gcc supports -ffat-lto-objects and -fno-fat-lto-objects, where the latter would seem to be the "thin" variant. Per info gcc, no-fat is default on targets with linker plugin support. |
|
Back to top |
|
|
papu l33t
Joined: 25 Jan 2008 Posts: 729 Location: Sota algun pi o alzina...
|
Posted: Sun Aug 18, 2024 9:30 pm Post subject: |
|
|
krumpf wrote: | From GCC flto documentation :
Quote: | -flto[=n]
If you specify the optional n, the optimization and code generation done at link time is executed in parallel using n parallel jobs by utilizing an installed make program.
[…]
Use -flto=auto to use GNU make’s job server, if available, or otherwise fall back to autodetection of the number of CPU threads present in your system. |
Afaik, there's no thinlto in gcc, it's specific to clang.
If you want to get better lto performance when using gcc, try to install and setup the mold linker. |
ok, thanks! _________________ --so ~amd64 & openrc --cpu 7700 non-x --ram 2x16GB --gpu RX 470 |
|
Back to top |
|
|
Perfect Gentleman Veteran
Joined: 18 May 2014 Posts: 1255
|
Posted: Mon Aug 19, 2024 12:15 am Post subject: |
|
|
afaik, mold doesn't support LTO itself, it translates LTO to bfd/lld. So there is no any speed improvement with mold when using LTO. |
|
Back to top |
|
|
sam_ Developer
Joined: 14 Aug 2020 Posts: 1949
|
Posted: Mon Aug 19, 2024 12:45 am Post subject: |
|
|
mold has plugin support and can handle gcc LTO by itself. Curiously, the maintainer of mold is the same person who rejected such plugin support for lld a few years ago.
You can easily verify this by running:
Code: |
echo 'int main() { __builtin_printf("hello\n"); }' | gcc -x c - -flto -fuse-ld=mold -Wl,-v -Wl,--trace
|
|
|
Back to top |
|
|
sam_ Developer
Joined: 14 Aug 2020 Posts: 1949
|
Posted: Mon Aug 19, 2024 12:51 am Post subject: |
|
|
Hu wrote: | gcc supports -ffat-lto-objects and -fno-fat-lto-objects, where the latter would seem to be the "thin" variant. Per info gcc, no-fat is default on targets with linker plugin support. |
Yes, this matches my understanding.
Now, one question is whether GCC could implement the same style of partitioning as Clang to speed things up, but there are trade-offs associated with that (namely worse optimisation). There are other differences in how they implement LTO (the amount of information to stream, representing that, and so on) but it's not about thin-vs-not. GCC is also working on incremental LTO, not that it's much use for ebuilds. |
|
Back to top |
|
|
|