Skip to content

build-pgo.sh: instrument with the same LTO settings as the final build - #14279

Merged
sylvestre merged 2 commits into
uutils:mainfrom
sylvestre:pgo-match-lto-instrumented
Aug 30, 2026
Merged

sylvestre merged 2 commits into
uutils:mainfrom
sylvestre:pgo-match-lto-instrumented

Conversation

@sylvestre

Copy link
Copy Markdown
Contributor

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.

@sylvestre
sylvestre force-pushed the pgo-match-lto-instrumented branch from c82e66b to 62aabd7 Compare August 30, 2026 14:57
@github-actions

Copy link
Copy Markdown

Binary size comparison:

Individual binary size comparison VS main (threshold: >=5% AND >=4 KB).

Total size of compared binaries: 152.18 MB (+1004 KB, +0.65%)

Significant per-binary changes:
  comm     1.12 MB ->    2.33 MB  (+1.21 MB, +107.29%)

@github-actions

github-actions Bot commented Aug 30, 2026 •

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/tail/retry (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/tail/symlink (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/printf/printf-surprise is now passing!

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
sylvestre force-pushed the pgo-match-lto-instrumented branch from 62aabd7 to 2195b97 Compare August 30, 2026 17:14
@sylvestre
sylvestre marked this pull request as ready for review August 30, 2026 19:53
Copilot AI lite review requested due to automatic review settings August 30, 2026 19:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@sylvestre
sylvestre merged commit 112dd10 into uutils:main Aug 30, 2026
97 of 98 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants