[LLVMdev] [RFC] Less memory and greater maintainability for debug info IR

Sean Silva chisophugis at gmail.com
Sat Oct 18 10:27:24 PDT 2014

On Fri, Oct 17, 2014 at 6:04 PM, Duncan P. N. Exon Smith <
dexonsmith at apple.com> wrote:

> > On Oct 17, 2014, at 3:54 PM, Sean Silva <chisophugis at gmail.com> wrote:
> >
> > this seems like the classic situation where the someone comes to you
> asking for X, but what they really want is a solution to underlying problem
> Y, for which the best solution, once you actually analyze Y, is Z.
> On the contrary, I came into this expecting to work with Eric on
> parallelizing the backend, but consistently found that callback-based
> RAUW traffic for metadata took almost as much CPU.

Derp. My bad. It would be nice in the future if you communicated this
better in the OP. In the OP it sounds like you are doing this solely for
memory, since there is no mention of CPU time or the excessive
callback-based RAUW traffic.

> Since debug info IR is at the heart of the RAUW bottleneck, I looked
> into its memory layout (it's a hog).  I started working on PR17891
> because, besides improving the memory usage, the plan promised to
> greatly reduce the number of nodes (indirectly reducing RAUW traffic).
> In the context of `llvm-lto`, "stage 1" knocked memory usage down from
> ~5GB to ~3GB -- but didn't reduce the number of nodes.

Please put these numbers in context. In the OP you were talking about
15.3GB peak for llvm-lto. Why is ~5GB now the peak? Also in the OP, the
theoretical improvement, out of 15.3GB, was 2GB after stage 4. How are you
getting 2GB improvement out of ~5GB with only stage 1?

>   Before starting
> stages "2" and "3", I counted nodes and operands to find which to tackle
> first.  Unfortunately, our need to reference local variables and line
> table entries directly from the IR-proper limits our ability to refactor
> the schema, and those are the nodes we have the most of.
> This work will drop debug info memory usage in `llvm-lto` further, from
> ~3GB down to ~1GB.  It's also a big step toward improving debug info
> maintainability.
> More importantly (for me), it enables us to refactor uniquing models and
> reorder serialization and linking to design away debug info RAUW
> traffic -- assuming switching to use-lists doesn't drop it off the
> profile.
> Regarding "the bigger problem" of LTO memory usage, I expect to see more
> than a 2GB drop from this work due to the nature of metadata uniquing
> and expiration.  I'm not motivated to quantify it, since even a 2GB drop
> -- when combined with a first-class IR and the RAUW-related speedup --
> is motivation enough.
> There's a lot of work left to do in LTO -- once I've finished this, I
> plan to look for another bottleneck.  Not sure if I'll tackle memory
> usage or performance.
> As Bob suggested, please feel free to join the party!  Less work for me
> to do later.

I'm planning on it.

-- Sean Silva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141018/fd53e8a9/attachment.html>

More information about the llvm-dev mailing list