Gentoo Archives: gentoo-dev

From: Rich Freeman <rich0@g.o>
To: gentoo-dev <gentoo-dev@l.g.o>
Subject: Re: [gentoo-dev] Re: LTO use in the tree
Date: Sun, 27 Apr 2014 23:08:20
Message-Id: CAGfcS_=1e-OEeO-sqW+CyuffE-Wtiv32PJmDcSiZK_dwQ-Q4ig@mail.gmail.com
In Reply to: Re: [gentoo-dev] Re: LTO use in the tree by Joshua Kinard
1 On Sun, Apr 27, 2014 at 6:56 PM, Joshua Kinard <kumba@g.o> wrote:
2 >
3 > My curiosity, as I have not attempted LTO yet on any machine, is what are
4 > the RAM requirements? Is it a hard limit, wherein the compiler simply fails
5 > if there isn't enough RAM, or does it just start hitting swap real hard?
6
7 It just allocates RAM, and the OS does the rest. I've seen it invoke
8 the OOM killer. That was back when I only had 8GB of RAM. Now I have
9 16GB and I only need to disable LTO on the really big packages.
10
11 Of course, if you set an appropriate ulimit then the process will just
12 terminate more gracefully. I'd highly recommend doing just that if
13 you have a lot of swap available.
14
15 > Those of us using older archs where the RAM is limited might have to be more
16 > cautious w/ LTO. I.e., my SGI O2 maxes right now at 512MB. It can go to
17 > 1GB if the odd memory/PROM issue is ever worked out. But 512MB is it for
18 > now, so what are my odds of successfully using LTO on that?
19
20 About zero. Well, I'm sure it will work fine for hello.c, especially
21 if you eliminate any function calls inside of it.
22
23 >
24 > Especially if LTO helps to reduce the final binary size, that's less data
25 > being shuffled around main memory and the CPU caches, which, although means
26 > slower compile times, might hake such a machine a bit snippier. Though, I
27 > dread how long GCC will take to build itself w/ LTO. The O2 already needs
28 > ~18hrs for 4.8. I haven't tried 4.9 on it yet.
29
30 Yeah, good luck with that... :)
31
32 I'd be curious as to what you find. You can always try it out by
33 picking a small package and doing a CFLAGS=foo emerge bar. Be sure to
34 only use -j1 -flto=1 as well.
35
36 Rich

Replies

Subject Author
Re: [gentoo-dev] Re: LTO use in the tree Joshua Kinard <kumba@g.o>