@@ -102,33 +102,28 @@ To use the tool, you will need to provide some external dependencies:
102102- Compiled LLVM toolchain, with the ` llvm-profdata ` binary. Optionally, if you want to use BOLT,
103103 the ` llvm-bolt ` and
104104 ` merge-fdata ` binaries have to be available in the toolchain.
105- - Downloaded [ Rust benchmark suite] .
106105
107- These dependencies are provided to ` opt-dist ` by an implementation of the [ ` Environment ` ] trait. You
108- can either implement the trait for your custom environment, by providing paths to these dependencies
109- in its methods, or reuse one of the existing implementations (currently, there is an implementation
110- for Linux and Windows). If you want your environment to support BOLT, return ` true ` from
111- the ` supports_bolt ` method.
106+ These dependencies are provided to ` opt-dist ` by an implementation of the [ ` Environment ` ] struct.
107+ It specifies directories where will the PGO/BOLT pipeline take place, and also external dependencies
108+ like Python or LLVM.
112109
113- Here is an example of how can ` opt-dist ` be used with the default Linux environment (it assumes that
114- you execute the following commands on a Linux system):
110+ Here is an example of how can ` opt-dist ` be used locally (outside of CI):
115111
1161121 . Build the tool with the following command:
117113 ``` bash
118114 ./x build tools/opt-dist
119115 ```
120- 2. Run the tool with the ` PGO_HOST ` environment variable set to the 64-bit Linux target :
116+ 2. Run the tool with the ` local ` mode and provide necessary parameters :
121117 ` ` ` bash
122- PGO_HOST=x86_64-unknown-linux-gnu ./build/host/stage0-tools-bin/opt-dist
118+ ./build/host/stage0-tools-bin/opt-dist local \
119+ --target-triple < target> \ # select target, e.g. "x86_64-unknown-linux-gnu"
120+ --checkout-dir <path> \ # path to rust checkout, e.g. "."
121+ --llvm-dir <path> \ # path to built LLVM toolchain, e.g. "/foo/bar/llvm/install"
122+ -- python3 x.py dist # pass the actual build command
123123 ` ` `
124- Note that the default Linux environment expects several hardcoded paths to exist:
125- - ` /checkout` should contain a checkout of the Rust compiler repository that will be compiled.
126- - ` /rustroot` should contain the compiled LLVM toolchain (containing BOLT).
127- - A Python 3 interpreter should be available under the ` python3` binary.
128- - ` /tmp/rustc-perf` should contain a downloaded checkout of the Rust benchmark suite.
124+ You can run ` --help` to see further parameters that you can modify.
129125
130- You can modify ` LinuxEnvironment ` (or implement your own) to override these paths.
126+ [ ` Environment ` ]: https://github.com/rust-lang/rust/blob/ee451f8faccf3050c76cdcd82543c917b40c7962/src/tools/opt-dist/src/environment.rs#L5
131127
132- [` Environment` ]: https://github.com/rust-lang/rust/blob/65e468f9c259749c210b1ae8972bfe14781f72f1/src/tools/opt-dist/src/environment/mod.rs#L8-L70
133-
134- [Rust benchmark suite]: https://github.com/rust-lang/rustc-perf
128+ > Note: if you want to run the actual CI pipeline, instead of running ` opt-dist` locally,
129+ > you can execute ` DEPLOY=1 src/ci/docker/run.sh dist-x86_64-linux` .
0 commit comments