Hello friends,

TL;DR: PGO on MSVC is now opt-in per-source-directory.

Today I landed a patch[1] that significantly lowered the memory usage of
the Visual C++ linker during PGO builds, which has been a consistent
pain point for us. The ever-wonderful Ehsan got in touch with a VC++
program manager at Microsoft who got him in touch with some engineers
who offered some concrete proposals on how to mitigate our problem.

The crux of the workaround is that only source files compiled for PGO
usage (using -GL to enable link-time-codegen on MSVC) contribute
significantly to the linker's memory usage. The Microsoft engineer's
suggestion was to use a tool called pgomgr[2] to dump statistics about
what code is actually being exercised in our profiling scenario (and
thus most able to benefit from the optimizations) and identify code for
which we could disable PGO. After a bit of data-wrangling (details are
in the bug) we decided that the best solution would be to make PGO on
MSVC an opt-in optimization, so I picked an arbitrary threshold and
enabled PGO only in the directories that have significant amounts of
code run in our profiling scenario. Any new directory that needs PGO
enabled will need to have "MSVC_ENABLE_PGO := 1" in its Makefile to turn
it on.

A Try run of this patch showed promising results, significantly lowering
the linker memory usage and not regressing any Talos results. As an
additional bonus it seems to have significantly sped up the build time
for Windows PGO builds.

Longer-term this should buy us more time for a real solution, as new
directories won't automatically contribute to the problem. We heard from
Microsoft that they are working on a 64-to-32-bit cross-toolchain, which
is the only real silver bullet for this problem, but they don't have any
timeline to give us. Hopefully this work buys us enough time for that to
materialize without having to expend significant effort working against
our toolchain or disabling PGO.

Yrs,
-Ted

1. https://bugzilla.mozilla.org/show_bug.cgi?id=871712
2. http://msdn.microsoft.com/en-us/library/2kw46d8w%28v=vs.80%29.aspx

_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to