mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 16:25:38 +00:00
![Gregory Szorc](/assets/img/avatar_default.png)
The mechanism by which PGO builds are kicked off is kinda wonky. The MOZ_PGO environment variable is recognized by configure and setting it will result in MOZ_PGO being defined in substs. In addition, the build backend (previously client.mk, now Makefile.in) also recognizes MOZ_PGO (from mozconfig or environment) and takes appropriate action. In-tree mozconfigs set MOZ_PGO via mk_add_options. mk_add_options is intended as a mechanism to inject state into client.mk and the make-based build system. In addition, there is code in mozharness (unchanged by this commit) that sets MOZ_PGO if appropriate. A PGO build configuration is different from a non-PGO build configuration. Therefore a make-centric environment variable to control PGO is not ideal. Instead, this should be defined as a configure-time flag and the build invocation should key off that. This commit normalizes in-tree mozconfigs to set MOZ_PGO via ac_add_options and updates the PGO documentation to recommend this method. MozReview-Commit-ID: k6AZyJuXjs --HG-- extra : rebase_source : b1a6348611eba08dd67ec938cca5586fbe8e6910 extra : source : 25c7ebc7c44dd253f421b6de3d0337635d0c99d0
41 lines
1.1 KiB
ReStructuredText
41 lines
1.1 KiB
ReStructuredText
.. _pgo:
|
|
|
|
===========================
|
|
Profile Guided Optimization
|
|
===========================
|
|
|
|
:abbr:`PGO (Profile Guided Optimization)` is the process of adding
|
|
probes to a compiled binary, running said binary, then using the
|
|
run-time information to *recompile* the binary to (hopefully) make it
|
|
faster.
|
|
|
|
How PGO Builds Work
|
|
===================
|
|
|
|
The supported interface for invoking a PGO build is to add ``MOZ_PGO=1`` to
|
|
configure flags and then build. e.g. in your mozconfig::
|
|
|
|
ac_add_options MOZ_PGO=1
|
|
|
|
Then::
|
|
|
|
$ ./mach build
|
|
|
|
This is roughly equivalent to::
|
|
|
|
#. Perform a build with *MOZ_PROFILE_GENERATE=1* and *MOZ_PGO_INSTRUMENTED=1*
|
|
#. Package with *MOZ_PGO_INSTRUMENTED=1*
|
|
#. Performing a run of the instrumented binaries
|
|
#. $ make maybe_clobber_profiledbuild
|
|
#. Perform a build with *MOZ_PROFILE_USE=1*
|
|
|
|
Differences between toolchains
|
|
==============================
|
|
|
|
There are some implementation differences depending on the compiler
|
|
toolchain being used.
|
|
|
|
The *maybe_clobber_profiledbuild* step gets its name because of a
|
|
difference. On Windows, this step merely moves some *.pgc* files around.
|
|
Using GCC or Clang, it is equivalent to a *make clean*.
|