build: calibrate PGO collection workloads and fix renderer profile loss#51855
Merged
Conversation
The macOS collection ran the instrumented app sandboxed, and sandboxed child processes fail their exit-time profraw write (LLVM Profile Error: Operation not permitted). Which processes lose is a per-run race; when the web-benchmark renderers lose, the merged profile ships with Blink essentially absent from the hot set (4 DOM functions in the top-50k vs ~400 expected). The 42-x-y and 43-x-y collections both hit this. Use %c continuous mode on Darwin (counters live in an mmap established before sandbox lockdown, no exit-time write needed) and pass --no-sandbox on the macOS collect step like the Linux step already does. The synthetic workloads were also capped by wall time, not work, so their tight loops dominated the count budget: the top 2 blocks held ~10% of all counts, which inflated the global hot threshold and crowded Blink out of the hot set. PGO hotness is a threshold, not a share - a path is hot once it clears ~10^5 counts, and extra volume only distorts the distribution. Cap the loops by iterations (still 2-3 orders of magnitude above the threshold), soft-cap MotionMark at 120s, and spend the reclaimed time on two more Speedometer runs. Add an async-churn workload (250k tiny ops: promise fs, immediates, local socket echoes) so the per-async-operation machinery (AsyncWrap, BaseObject lifecycle, stream plumbing) stays trained now that the heavyweight workloads are capped - their counts ride on async op volume, not loop iterations. Also clean the profraw directory at collection start: stale %m pool files from a previous run silently merge their counters into the new collection. Validated against an instrumented 42-x-y build with the same scripts CI runs: profraw count 9 (renderers lost) -> 23+ with zero write errors; blocks holding 90% of counts 1,710 -> 14,000+; Blink DOM functions in the top-50k 4 -> ~404 (Chrome-profile parity); top-2-block share ~10% -> 2.6%; node serialization paths hot at sane magnitudes (StringBytes::Write 410M, contextBridge marshaling 15M). Co-authored-by: Samuel Attard <sattard@anthropic.com>
MarshallOfSound
approved these changes
Jun 3, 2026
|
No Release Notes |
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.
Backport of #51852
See that PR for details.
Notes: none