<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Wed, Feb 10, 2016 at 2:42 PM Peter Collingbourne <<a href="mailto:peter@pcc.me.uk">peter@pcc.me.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Fri, Feb 05, 2016 at 05:35:14PM -0800, David Blaikie wrote:<br>
> On Fri, Feb 5, 2016 at 5:04 PM, Peter Collingbourne <<a href="mailto:peter@pcc.me.uk" target="_blank">peter@pcc.me.uk</a>> wrote:<br>
><br>
> > Thanks, I'll look into that. (Though earlier you told me that debug info<br>
> > for types could be extended while walking the IR, so I wouldn't have<br>
> > thought<br>
> > that would have worked.)<br>
> ><br>
> ><br>
> Yeah, had to think about it more - and as I think about it - I'm moderately<br>
> sure type units (which don't include these latent extensions) will be<br>
> pretty close to static. With just the stmt_list relocation in non-fission<br>
> type units which /should/ still be knowable up-front.<br>
<br>
I've implemented a change which does this, and looked at impact on memory<br>
consumption and binary size running "llc" on Chromium's 50 largest (by<br>
bitcode size) translation units. Bottom line: *huge* savings in total memory<br>
consumption, median 17% when compared to before the change, median 7% when<br>
compared to type units disabled.<br>
<br>
(I'm not yet confident that my patch is correct (some of the section sizes<br>
are different and I'll need to double check what's going on there) but I'll<br>
send it out once I'm confident in it.)<br>
<br>
I think we can do better, though. With type units enabled, the size of<br>
.debug_info as a fraction of (.debug_info + .debug_types) is median ~40%,<br>
so I think there's another ~12% that can be saved by avoiding DIE/DIEValue<br>
retention for debug_info, bringing the total to ~30%. I expect numbers with<br>
type units disabled to be in the same ballpark (with type units enabled,<br>
we consume ~25% more space in the object file on .debug_info + .debug_types,<br>
so the proportional savings may be less, but the absolute memory consumption<br>
should be lower). This also roughly lines up with the heap profiler figures<br>
from before.<br>
<br>
My conclusion from all this: I think we should do it, and I think it would<br>
especially help in LTO mode with type units disabled: the type units feature<br>
is redundant with LTO deduplication and would therefore add unnecessary bloat<br>
to object files, which would mean increased memory usage (I measured a ~10%<br>
median increase in memory usage comparing the current type units implementation<br>
against type units disabled -- not an entirely fair comparison, but probably<br>
good enough).<br>
<br>
I have a plan in mind for doing this incrementally: we will start using the<br>
more efficient data structure at the leaves of the DIE tree, and gradually<br>
expand out to the root. You'll see what that looks like once I have my first<br>
patch ready.<br>
<br></blockquote><div><br></div><div>This sounds reasonable and I like the plan as well.</div><div><br></div><div>Thanks for looking into this Peter!</div><div><br></div><div>-eric</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thanks,<br>
--<br>
Peter<br>
</blockquote></div></div>