Skip to content

Commit e5732a2

Browse files
committed
Auto merge of #97110 - Kobzol:pgo-pid-in-profile, r=lqd
Add PID to PGO profile data filename After experimenting with PGO, it looks like the generated profile data files can be sometimes overwritten if there is a race condition, because multiple `rustc` processes are usually invoked in parallel by `cargo`. Adding the PID to the resulting profile filename pattern makes sure that the profiles will be stored in separate files. This generates ~20 GiB more space on disk on the CI run, but that seems harmless (?). Merging the profiles is not a bottleneck, the perf. run took the same amount of time as usually (~1h 24m). r? `@lqd`
2 parents a084b7a + 19a3558 commit e5732a2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/ci/pgo.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,11 @@ python3 ../x.py build --target=$PGO_HOST --host=$PGO_HOST \
8282

8383
# Here we're profiling the `rustc` frontend, so we also include `Check`.
8484
# The benchmark set includes various stress tests that put the frontend under pressure.
85-
gather_profiles "Check,Debug,Opt" "All" \
85+
# The profile data is written into a single filepath that is being repeatedly merged when each
86+
# rustc invocation ends. Empirically, this can result in some profiling data being lost.
87+
# That's why we override the profile path to include the PID. This will produce many more profiling
88+
# files, but the resulting profile will produce a slightly faster rustc binary.
89+
LLVM_PROFILE_FILE=/tmp/rustc-pgo/default_%m_%p.profraw gather_profiles "Check,Debug,Opt" "All" \
8690
"externs,ctfe-stress-4,cargo-0.60.0,token-stream-stress,match-stress,tuple-stress"
8791

8892
# Merge the profile data we gathered

0 commit comments

Comments
 (0)