[PATCH] D86905: Flush bitcode incrementally for LTO output

Eugene Leviant via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 2 01:53:02 PDT 2020


evgeny777 added a comment.

> Our case is a bit different. Given a 512M incremental flush threshold, I tested an LTO built that outputs a 5G bitcode file. The BackpatchWord is called 16,613,927 times, among which only 12 needs disk seek. Plus, each access visits 4-8 bytes on a page, and all visited pages are far away from each other. It is likely that the pages are not cached, and need to load anyway, and after a load, our code does not access enough data on a page to 'cancel' the page fault cost. So its cost could be very similar to seek.

It seems that you're trying to implement your own I/O caching. I don't understand why you're not letting OS to do this for you. For instance on systems with larger amount of memory (I have 64 GB on my home PC, typical build server may have even more) mmap will buffer all your 5G bc file in memoy and then write it back to disk without any seek operations (which are costly on traditional HDD).

> Give the above and that mmap support is different across systems, the seek based approach seems fine.

LLVM has `FileOutputBuffer` class which abstracts underlying OS differences. LLVM lld.lld linker uses it for output file generation


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86905/new/

https://reviews.llvm.org/D86905



More information about the llvm-commits mailing list