Skip to content

Commit

Permalink
Auto merge of rust-lang#95724 - Kobzol:ci-update-rustc-perf, r=nnethe…
Browse files Browse the repository at this point in the history
…rcote

CI: update `rustc-perf` version used in CI and also the corresponding PGO benchmarks

The old version was from May 2021. The `rustc-perf` benchmarks have seen a significant overhaul recently, so let's see if the new benchmarks can improve PGO performance.
  • Loading branch information
bors committed Apr 9, 2022
2 parents 4bb685e + 49efa23 commit 399dd80
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ COPY host-x86_64/dist-x86_64-linux/build-clang.sh /tmp/
RUN ./build-clang.sh
ENV CC=clang CXX=clang++

ENV PERF_COMMIT 1e19fc4c6168d2f7596e512f42f358f245d8f09d
# rustc-perf version from 2022-04-05
ENV PERF_COMMIT 04fccd80396f954b339c366e30221f4bd52c5e03
RUN curl -LS -o perf.zip https://github.com/rust-lang/rustc-perf/archive/$PERF_COMMIT.zip && \
unzip perf.zip && \
mv rustc-perf-$PERF_COMMIT rustc-perf && \
Expand Down
19 changes: 12 additions & 7 deletions src/ci/pgo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
set -euxo pipefail

# Compile several crates to gather execution PGO profiles.
# Arg0 => builds (Debug, Opt)
# Arg1 => runs (Full, IncrFull, All)
# Arg0 => profiles (Debug, Opt)
# Arg1 => scenarios (Full, IncrFull, All)
# Arg2 => crates (syn, cargo, ...)
gather_profiles () {
cd /checkout/obj
Expand All @@ -27,10 +27,10 @@ gather_profiles () {
profile_local \
eprintln \
/checkout/obj/build/$PGO_HOST/stage2/bin/rustc \
Test \
--builds $1 \
--id Test \
--profiles $1 \
--cargo /checkout/obj/build/$PGO_HOST/stage0/bin/cargo \
--runs $2 \
--scenarios $2 \
--include $3

cd /checkout/obj
Expand Down Expand Up @@ -64,7 +64,10 @@ RUSTC=/checkout/obj/build/$PGO_HOST/stage0/bin/rustc \
RUSTC_BOOTSTRAP=1 \
/checkout/obj/build/$PGO_HOST/stage0/bin/cargo build -p collector

gather_profiles "Debug,Opt" "Full" "syn,cargo,serde,ripgrep,regex,clap-rs,hyper-2"
# Here we're profiling LLVM, so we only care about `Debug` and `Opt`, because we want to stress
# codegen. We also profile some of the most prolific crates.
gather_profiles "Debug,Opt" "Full" \
"syn-1.0.89,cargo-0.60.0,serde-1.0.136,ripgrep-13.0.0,regex-1.5.5,clap-3.1.6,hyper-0.14.18"

# Merge the profile data we gathered for LLVM
# Note that this uses the profdata from the clang we used to build LLVM,
Expand All @@ -83,8 +86,10 @@ python3 ../x.py build --target=$PGO_HOST --host=$PGO_HOST \
--stage 2 library/std \
--rust-profile-generate=/tmp/rustc-pgo

# Here we're profiling the `rustc` frontend, so we also include `Check`.
# The benchmark set includes various stress tests that put the frontend under pressure.
gather_profiles "Check,Debug,Opt" "All" \
"externs,ctfe-stress-4,inflate,cargo,token-stream-stress,match-stress-enum"
"externs,ctfe-stress-4,cargo-0.60.0,token-stream-stress,match-stress,tuple-stress"

# Merge the profile data we gathered
./build/$PGO_HOST/llvm/bin/llvm-profdata \
Expand Down

0 comments on commit 399dd80

Please sign in to comment.