build-pgo.sh: instrument with the same LTO settings as the final build - #14279
Merged
Merged
Conversation
sylvestre
force-pushed
the
pgo-match-lto-instrumented
branch
from
August 30, 2026 14:57
c82e66b to
62aabd7
Compare
|
Binary size comparison: |
|
GNU testsuite comparison: |
The instrumented binary was built with LTO off and 16 codegen units, but the profile is consumed by a fat-LTO build. Inlining runs before instrumentation, so the counters describe a different call graph: the mismatched profile covers 4098 functions where the matched one covers 1883. The result was a profile that made several utils slower than no PGO at all: wc -w regressed 57% (+21.7% instructions, all in uu_wc::process_chunk). With the instrumented build matched to the final one, wc -w is back to parity and PGO gives cat -n -29%, uniq -c -27%, nl -26%, fold -22%, sort -18%, sort -n -17%, wc -15%, sort -k -11%. Build time goes from 1m56s to 2m58s.
Record what the LTO mismatch cost and why the existing function-count check does not catch it, and add measured per-utility gains to the performance page.
sylvestre
force-pushed
the
pgo-match-lto-instrumented
branch
from
August 30, 2026 17:14
62aabd7 to
2195b97
Compare
sylvestre
marked this pull request as ready for review
August 30, 2026 19:53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The instrumented binary was built with LTO off and 16 codegen units, but the profile is consumed by a fat-LTO build. Inlining runs before instrumentation, so the counters describe a different call graph: the mismatched profile covers 4098 functions where the matched one covers 1883.
The result was a profile that made several utils slower than no PGO at all: wc -w regressed 57% (+21.7% instructions, all in uu_wc::process_chunk).
With the instrumented build matched to the final one, wc -w is back to parity and PGO gives cat -n -29%, uniq -c -27%, nl -26%, fold -22%, sort -18%, sort -n -17%, wc -15%, sort -k -11%. Build time goes from 1m56s to 2m58s.