Profile Guided Optimization (PGO)

Eric Myhre hash at
Tue Jun 21 18:16:37 UTC 2022

I vaguely recall having a conversation about PGO with an engineer from 
Huawei (iirc) at an RB summit several years ago.  I think we came to 
that same idea -- of AOT determination and simply storing it -- fairly 
quickly; and came to no further ideas after prolonged thought.

And though it's tangential to many of our typical interests (e.g. 
security, etc) in reproducible builds, ISTM that treating PGO info as 
"source" and version controlling it should be treated as rather 
obviously correct anyway.  Surely anyone chasing performance 
optimization is also making sure they do so consistently, and thus doing 
some sort of prolonged tracking and graphing, and such a person would 
have very little leverage scored out of all that effort if they couldn't 
actually point to what changed when, right?

On 6/21/22 19:11, David A. Wheeler wrote:
> Profile Guided Optimization (PGO) can make it challenging to generate reproducible builds.
> Some options are listed here:
> It'd be great if other options existed.
> One idea: What about having the profile built ahead-of-time, and recorded in the source tree?
> That probably has to be recorded separately for different architectures.
> It might not be too bad to include it in the "source code" as long as it cannot affect
> the actual semantics (only the performance). That is obviously annoying, but it's
> also annoying to lose a nontrivial amount of performance?
> Thoughts? Does anyone have any better ideas for making PGO reproducible?
> Thanks.
> --- David A. Wheeler

On 6/21/22 19:56, Orians, Jeremiah (DTMB) wrote:
> It'll solve the reproducible problem but introduce a bootstrapping problem for how those files
> were generated in the first place.

FWIW, this seems sorta fine to me.

As long as a build path exists which _doesn't_ require the PGO AOT 
snapshot info to build successfully.

But that seems unlikely to rot, doesn't it?

More information about the rb-general mailing list