PGO not only for own code but for D runtime & Phobos too?
Jon Degenhardt
jond at noreply.com
Fri Oct 4 17:58:42 UTC 2019
On Friday, 4 October 2019 at 08:55:33 UTC, Robert M. Münch wrote:
> On 2019-10-03 16:01:19 +0000, Jon Degenhardt said:
>
>> I did a study of LTO and PGO on the combined application and
>> libraries (druntime & phobos). It's available here:
>> https://github.com/eBay/tsv-utils/blob/master/docs/lto-pgo-study.md.
>
> Thanks a lot, very interesting.
>
> How did you include druntime & phobos into your app code build
> environment? What about extended compile times?
>
> I'm wondering what would the best dev process look like when
> doing such a overall LTO+PGO optimization.
I'm not quite sure what the best build process would look like.
For the tsv utilities I put the build steps in make files, but
its rather clunky and may not work well for larger projects. I
don't have it working with dub. There appears to be a nice
opportunity for dub to make the basic cases easier.
For the tsv apps the build steps are relatively easy, as
individually they are small code bases and have no external
dependencies. With the LDC 1.9 release the LTO build part became
very easy. The LTO versions of druntime and phobos are shipped
with the pre-built binaries, so the LTO part is a couple of
compiler switches ('ldc2 -flto=thin
-defaultlib=phobos2-ldc-lto,druntime-ldc-lto' see:
https://github.com/ldc-developers/ldc/releases/tag/v1.9.0 for
details).
For PGO I added custom build steps in the makefile, mostly
following the steps described in Johan Engelen's blog post:
https://johanengelen.github.io/ldc/2016/07/15/Profile-Guided-Optimization-with-LDC.html
I did create a very simple app built with LTO & PGO using dub,
including external dependencies here:
https://github.com/jondegenhardt/dcat-perf. The dub.json file is
short enough you'll be able to read it and see the basic steps it
takes. Despite that the dub.json file is short, I found it rather
tricky to get correct.
--Jon
More information about the Digitalmars-d
mailing list