On 11/09/2023 09.25, Helmut Grohne wrote:
It also is unclear how it affects reproducible builds since such builds depend on the performance characteristics of the system performing the build.
It is worth noting that the performance (execution time) of a build-system does not matter for profiling, so it is possible to achieve reproducible builds with PGO enabled. It is just hard.
See https://build.opensuse.org/request/show/499887linked in https://github.com/bmwiedemann/theunreproduciblepackage/tree/master/pgo
In that gzip patch we even had to hide the name of the temporary file from gzip to not get variations from a 'tolower' call that would be optimized for different amounts of upper/lower-case letters.
Parallel builds and variations in ordering are also problematic, because some of the performance-counter-logic in gcc is not commutative, so running A and B calls produces different results from first calling B and then A.
With all that said, in openSUSE we also have a %do_profiling value to disable PGO for gcc, python and some others, because these profiling runs are too large to make deterministic.
Ciao Bernhard M.