summary refs log tree commit diff
path: root/src/doc/rustc-dev-guide
diff options
context:
space:
mode:
authorJakub Beránek <berykubik@gmail.com>2023-09-21 18:33:41 +0200
committerGitHub <noreply@github.com>2023-09-22 01:33:41 +0900
commit73f589b05a935aa7f28f1bb605ab014091574cd4 (patch)
treea3131ac701fc3307a25c7b5d4676073366206c06 /src/doc/rustc-dev-guide
parent7531db2e9a15a7f30405e8e88aaa9b489b6ff204 (diff)
downloadrust-73f589b05a935aa7f28f1bb605ab014091574cd4.tar.gz
rust-73f589b05a935aa7f28f1bb605ab014091574cd4.zip
Modify build instructions for optimized build (#1795)
Diffstat (limited to 'src/doc/rustc-dev-guide')
-rw-r--r--src/doc/rustc-dev-guide/src/building/optimized-build.md33
1 files changed, 14 insertions, 19 deletions
diff --git a/src/doc/rustc-dev-guide/src/building/optimized-build.md b/src/doc/rustc-dev-guide/src/building/optimized-build.md
index ee33b059216..1e1136b91b3 100644
--- a/src/doc/rustc-dev-guide/src/building/optimized-build.md
+++ b/src/doc/rustc-dev-guide/src/building/optimized-build.md
@@ -102,33 +102,28 @@ To use the tool, you will need to provide some external dependencies:
 - Compiled LLVM toolchain, with the `llvm-profdata` binary. Optionally, if you want to use BOLT,
   the `llvm-bolt` and
   `merge-fdata` binaries have to be available in the toolchain.
-- Downloaded [Rust benchmark suite].
 
-These dependencies are provided to `opt-dist` by an implementation of the [`Environment`] trait. You
-can either implement the trait for your custom environment, by providing paths to these dependencies
-in its methods, or reuse one of the existing implementations (currently, there is an implementation
-for Linux and Windows). If you want your environment to support BOLT, return `true` from
-the `supports_bolt` method.
+These dependencies are provided to `opt-dist` by an implementation of the [`Environment`] struct.
+It specifies directories where will the PGO/BOLT pipeline take place, and also external dependencies
+like Python or LLVM.
 
-Here is an example of how can `opt-dist` be used with the default Linux environment (it assumes that
-you execute the following commands on a Linux system):
+Here is an example of how can `opt-dist` be used locally (outside of CI):
 
 1. Build the tool with the following command:
     ```bash
     ./x build tools/opt-dist
     ```
-2. Run the tool with the `PGO_HOST` environment variable set to the 64-bit Linux target:
+2. Run the tool with the `local` mode and provide necessary parameters:
     ```bash
-    PGO_HOST=x86_64-unknown-linux-gnu ./build/host/stage0-tools-bin/opt-dist
+    ./build/host/stage0-tools-bin/opt-dist local \
+      --target-triple <target> \ # select target, e.g. "x86_64-unknown-linux-gnu"
+      --checkout-dir <path>    \ # path to rust checkout, e.g. "."
+      --llvm-dir <path>        \ # path to built LLVM toolchain, e.g. "/foo/bar/llvm/install"
+      -- python3 x.py dist       # pass the actual build command
     ```
-   Note that the default Linux environment expects several hardcoded paths to exist:
-    - `/checkout` should contain a checkout of the Rust compiler repository that will be compiled.
-    - `/rustroot` should contain the compiled LLVM toolchain (containing BOLT).
-    - A Python 3 interpreter should be available under the `python3` binary.
-    - `/tmp/rustc-perf` should contain a downloaded checkout of the Rust benchmark suite.
+    You can run `--help` to see further parameters that you can modify.
 
-You can modify `LinuxEnvironment` (or implement your own) to override these paths.
+[`Environment`]: https://github.com/rust-lang/rust/blob/ee451f8faccf3050c76cdcd82543c917b40c7962/src/tools/opt-dist/src/environment.rs#L5
 
-[`Environment`]: https://github.com/rust-lang/rust/blob/65e468f9c259749c210b1ae8972bfe14781f72f1/src/tools/opt-dist/src/environment/mod.rs#L8-L70
-
-[Rust benchmark suite]: https://github.com/rust-lang/rustc-perf
+> Note: if you want to run the actual CI pipeline, instead of running `opt-dist` locally,
+> you can execute `DEPLOY=1 src/ci/docker/run.sh dist-x86_64-linux`.