about summary refs log tree commit diff
path: root/src/ci/docker
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-10-10 06:18:58 +0000
committerbors <bors@rust-lang.org>2022-10-10 06:18:58 +0000
commit8dfb40722da197e77a33a19eb9d3fd6512831341 (patch)
tree0b1f5c3ab12887e2a7b42986175b2b5ed068646c /src/ci/docker
parente495b37c9a301d776a7bd0c72d5c4a202e159032 (diff)
parentcc475f5ef2988e9db2e3ce07bd4abd4d4975f3e7 (diff)
downloadrust-8dfb40722da197e77a33a19eb9d3fd6512831341.tar.gz
rust-8dfb40722da197e77a33a19eb9d3fd6512831341.zip
Auto merge of #94381 - Kobzol:llvm-bolt, r=Mark-Simulacrum
Use BOLT in CI to optimize LLVM

This PR adds an optimization step in the Linux `dist` CI pipeline that uses [BOLT](https://github.com/llvm/llvm-project/tree/main/bolt) to optimize the `libLLVM.so` library built by boostrap.

Steps:
- [x] Use LLVM 15 as a bootstrap compiler and use it to build BOLT
- [x] Compile LLVM with support for relocations (`-DCMAKE_SHARED_LINKER_FLAGS="-Wl,-q"`)
- [x] Gather profile data using instrumented LLVM
- [x] Apply profile to LLVM that has already been PGOfied
- [x] Run with BOLT profiling on more benchmarks
- [x] Decide on the order of optimization (PGO -> BOLT?)
- [x] Decide how we should get `bolt` (currently we use the host `bolt`)
- [x] Clean up

The latest perf results can be found [here](https://github.com/rust-lang/rust/pull/94381#issuecomment-1258269440). The current CI build time with BOLT applied is around 1h 55 minutes.
Diffstat (limited to 'src/ci/docker')
-rwxr-xr-xsrc/ci/docker/host-x86_64/dist-x86_64-linux/build-clang.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ci/docker/host-x86_64/dist-x86_64-linux/build-clang.sh b/src/ci/docker/host-x86_64/dist-x86_64-linux/build-clang.sh
index fa780e1e45e..9abfd4e9731 100755
--- a/src/ci/docker/host-x86_64/dist-x86_64-linux/build-clang.sh
+++ b/src/ci/docker/host-x86_64/dist-x86_64-linux/build-clang.sh
@@ -22,7 +22,7 @@ INC="/rustroot/include:/usr/include"
 
 # We need compiler-rt for the profile runtime (used later to PGO the LLVM build)
 # but sanitizers aren't currently building. Since we don't need those, just
-# disable them.
+# disable them. BOLT is used for optimizing LLVM.
 hide_output \
     cmake ../llvm \
       -DCMAKE_C_COMPILER=/rustroot/bin/gcc \
@@ -36,7 +36,7 @@ hide_output \
       -DLLVM_INCLUDE_BENCHMARKS=OFF \
       -DLLVM_INCLUDE_TESTS=OFF \
       -DLLVM_INCLUDE_EXAMPLES=OFF \
-      -DLLVM_ENABLE_PROJECTS="clang;lld;compiler-rt" \
+      -DLLVM_ENABLE_PROJECTS="clang;lld;compiler-rt;bolt" \
       -DC_INCLUDE_DIRS="$INC"
 
 hide_output make -j$(nproc)