Originally posted by Michael
View Post
Announcement
Collapse
No announcement yet.
GCC 10 Link-Time Optimization Benchmarks On AMD Threadripper
Collapse
X
-
-
From the gcc docs:
-fwhole-program
Assume that the current compilation unit represents the whole program being compiled. All public functions and variables with the exception of main and those merged by attribute externally_visible become static functions and in effect are optimized more aggressively by interprocedural optimizers.
This option should not be used in combination with -flto. Instead relying on a linker plugin should provide safer and more precise information.
- Likes 4
Comment
-
As far as I know, -fwhole-program works best when the entire program fits into a single source file/compilation unit. In theory, a benchmark like Himeno should benefit from it, but the results obtained here show otherwise. Odd.
Instead of using -flto in conjunction with -fwhole-program, I would suggest replacing -fwhole-program with -flto-partition=none (possible values are none/one/1to1/balanced/max), which would disable WHOPR/partitioned LTO and switch to full LTO.
I suppose one could also accelerate the benchmarks measuring compilation time by using -flto=n, which would parallelize the linking process when using WHOPR.
Comment
-
For compile time you need -flto=$CPUCOUNT (or -flto=jobserver and CC=-gcc)
Fat objects should also already be disabled. So the main difference is the compiling in parallel. It shouldn't be that much slower than normal building, it just uses a metric shit-ton more memory.
Comment
-
Originally posted by set135This is what I have been using on Gentoo for many years, for all but a few packages:
CFLAGS=-march=native -O2 -pipe -fno-stack-protector -flto=4 -fuse-linker-plugin
CXXFLAGS=$CFLAGS
LDFLAGS=-Wl,-flto=4 $CFLAGS
My goal was primarily to reduce executable size, and just to see how it works, so it is interesting to see some benchmarks.
Comment
-
Originally posted by archsway View PostMesa seems to benefit quite a bit from LTO.
Add this to the meson command:
Code:-Db_lto=true
Comment
Comment