Gentoo Archives: gentoo-dev

From: Joshua Kinard <kumba@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Re: LTO use in the tree
Date: Sun, 27 Apr 2014 23:14:51
Message-Id: 535D8F62.1030905@gentoo.org
In Reply to: Re: [gentoo-dev] Re: LTO use in the tree by Rich Freeman
1 On 04/27/2014 19:08, Rich Freeman wrote:
2 > On Sun, Apr 27, 2014 at 6:56 PM, Joshua Kinard <kumba@g.o> wrote:
3 >>
4 >> My curiosity, as I have not attempted LTO yet on any machine, is what are
5 >> the RAM requirements? Is it a hard limit, wherein the compiler simply fails
6 >> if there isn't enough RAM, or does it just start hitting swap real hard?
7 >
8 > It just allocates RAM, and the OS does the rest. I've seen it invoke
9 > the OOM killer. That was back when I only had 8GB of RAM. Now I have
10 > 16GB and I only need to disable LTO on the really big packages.
11 >
12 > Of course, if you set an appropriate ulimit then the process will just
13 > terminate more gracefully. I'd highly recommend doing just that if
14 > you have a lot of swap available.
15
16 My favourite, starting long compiles on slow boxen, only to wake up to
17 discover they failed in the final five minutes of the build over something
18 as trite as low memory :)
19
20
21 >> Those of us using older archs where the RAM is limited might have to be more
22 >> cautious w/ LTO. I.e., my SGI O2 maxes right now at 512MB. It can go to
23 >> 1GB if the odd memory/PROM issue is ever worked out. But 512MB is it for
24 >> now, so what are my odds of successfully using LTO on that?
25 >
26 > About zero. Well, I'm sure it will work fine for hello.c, especially
27 > if you eliminate any function calls inside of it.
28
29 About zero? So, some floating point value infinitely between 0 and 1? Hmm,
30 maybe I'll try it once I get my SGI Octane to boot Linux again.
31
32
33 >>
34 >> Especially if LTO helps to reduce the final binary size, that's less data
35 >> being shuffled around main memory and the CPU caches, which, although means
36 >> slower compile times, might hake such a machine a bit snippier. Though, I
37 >> dread how long GCC will take to build itself w/ LTO. The O2 already needs
38 >> ~18hrs for 4.8. I haven't tried 4.9 on it yet.
39 >
40 > Yeah, good luck with that... :)
41 >
42 > I'd be curious as to what you find. You can always try it out by
43 > picking a small package and doing a CFLAGS=foo emerge bar. Be sure to
44 > only use -j1 -flto=1 as well.
45
46 O2 only has one CPU, so it's always -j1. SMP on my other MIPS machines
47 doesn't work yet (either Linux isn't supported, or I haven't debugged SMP
48 code yet).
49
50 --
51 Joshua Kinard
52 Gentoo/MIPS
53 kumba@g.o
54 4096R/D25D95E3 2011-03-28
55
56 "The past tempts us, the present confuses us, the future frightens us. And
57 our lives slip away, moment by moment, lost in that vast, terrible in-between."
58
59 --Emperor Turhan, Centauri Republic

Replies

Subject Author
Re: [gentoo-dev] Re: LTO use in the tree "C. Bergström" <cbergstrom@×××××××××.com>