[build2] LTO and parallelization with build2

Matthew Krupcale mkrupcale at matthewkrupcale.com
Fri Aug 7 13:22:58 UTC 2020

On Fri, Aug 7, 2020 at 4:46 AM Boris Kolpackov <boris at codesynthesis.com> wrote:
> Matthew Krupcale <mkrupcale at matthewkrupcale.com> writes:
> > [...] (by default, m=32) [...]
> CPUs with more than 32 hardware threads are not that uncommon these
> days.

For some reason when I was browsing the GitHub GCC sources, it led me
to look at an older revision of gcc/params.def. lto-partitions default
was bumped to 128[1], and lto-partitions is now set in

In any case, I think that in addition to translating -flto=auto or
-flto=n (with n>N) to -flto=N, where N is the number of available
hardware threads, we may have to also set --param lto-partitions=m,
where m>N. I'm not entirely sure what the right value for m is
compared to the number of threads. m=N+1? m=2*N? For reference, here
is the original discussion on WHOPR partitioning[3].

> In any case, I've added[1] the scheduler API to allocate extra active
> threads.

Oh that was fast.

> What's left is to translate -flto=auto. Would you like to take
> a stab at it? I could give you some pointers if you are interested.

Yeah, I might give it a try this weekend, and pointers are always appreciated.

[1] https://github.com/gcc-mirror/gcc/commit/448af20a27c9a1706712eba8500f5f81f5f6a46d
[2] https://github.com/gcc-mirror/gcc/blob/c3f94f5786a014515c09c7852db228c74adf51e5/gcc/params.opt#L365
[3] http://patchwork.ozlabs.org/comment/152396/

More information about the users mailing list