Skip to content

Introduce new bootstrap config section for PGO configuration#158912

Open
Kobzol wants to merge 4 commits into
rust-lang:mainfrom
Kobzol:bootstrap-pgo-config
Open

Introduce new bootstrap config section for PGO configuration#158912
Kobzol wants to merge 4 commits into
rust-lang:mainfrom
Kobzol:bootstrap-pgo-config

Conversation

@Kobzol

@Kobzol Kobzol commented Jul 7, 2026

Copy link
Copy Markdown
Member

The handling of PGO profiles in bootstrap was a bit messy, we had CLI flags, but those were hardcoded only for rustc and LLVM, and also a separate rust.profile-use/profile-generate options, though I'm not sure if anyone ever used them.

I wanted to generalize this a bit, to allow experimenting with PGO optimizing also other parts of the toolchain (e.g. rustdoc, clippy, cargo). This PR introduces a new [pgo] section in the bootstrap config, which allows specifying PGO profiles using the config file, currently for rustc and LLVM.

It can be also set through the command-line using e.g. --set pgo.rustc.use=/tmp/foo.

Best reviewed commit by commit.

r? @jieyouxu

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Jul 7, 2026
@Kobzol

Kobzol commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 7, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 7, 2026
Introduce new bootstrap config section for PGO configuration
@rust-log-analyzer

This comment has been minimized.

@rust-bors

rust-bors Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 1b53849 failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

@Kobzol

Kobzol commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

@bors try

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 7, 2026
Introduce new bootstrap config section for PGO configuration
@rust-bors

rust-bors Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: f74b2a3 (f74b2a373248202435989c77fcf0ce204e8bd5a5)
Base parent: f10db29 (f10db292a3733b5c67c8da8c7661195ff4b05774)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (f74b2a3): comparison URL.

Overall result: ❌ regressions - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.0% [0.0%, 0.0%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

This perf run didn't have relevant results for this metric.

Cycles

Results (secondary 3.5%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.5% [2.0%, 5.2%] 10
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

Results (primary -0.1%, secondary -0.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.1% [-0.1%, -0.0%] 61
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.0%] 24
All ❌✅ (primary) -0.1% [-0.1%, -0.0%] 61

Bootstrap: 487.206s -> 488.631s (0.29%)
Artifact size: 388.97 MiB -> 388.95 MiB (-0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 7, 2026
@Kobzol Kobzol marked this pull request as ready for review July 7, 2026 18:57
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 7, 2026
@rustbot

rustbot commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

This PR modifies src/bootstrap/src/core/config.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

This PR modifies bootstrap.example.toml.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

This PR changes how LLVM is built. Consider updating src/bootstrap/download-ci-llvm-stamp.

@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jul 7, 2026
@Kobzol Kobzol force-pushed the bootstrap-pgo-config branch from 3fbde4b to 1f6b1d5 Compare July 8, 2026 06:46

@jieyouxu jieyouxu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rust-bors

rust-bors Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 1f6b1d5 has been approved by jieyouxu

It is now in the queue for this repository.

@rust-bors rust-bors Bot added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jul 8, 2026
@rust-bors rust-bors Bot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 8, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 8, 2026
…youxu

Introduce new bootstrap config section for PGO configuration

The handling of PGO profiles in bootstrap was a bit messy, we had CLI flags, but those were hardcoded only for rustc and LLVM, and also a separate `rust.profile-use/profile-generate` options, though I'm not sure if anyone ever used them.

I wanted to generalize this a bit, to allow experimenting with PGO optimizing also other parts of the toolchain (e.g. rustdoc, clippy, cargo). This PR introduces a new `[pgo]` section in the bootstrap config, which allows specifying PGO profiles using the config file, currently for `rustc` and LLVM.

It can be also set through the command-line using e.g. `--set pgo.rustc.use=/tmp/foo`.

Best reviewed commit by commit.

r? @jieyouxu
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 8, 2026
…youxu

Introduce new bootstrap config section for PGO configuration

The handling of PGO profiles in bootstrap was a bit messy, we had CLI flags, but those were hardcoded only for rustc and LLVM, and also a separate `rust.profile-use/profile-generate` options, though I'm not sure if anyone ever used them.

I wanted to generalize this a bit, to allow experimenting with PGO optimizing also other parts of the toolchain (e.g. rustdoc, clippy, cargo). This PR introduces a new `[pgo]` section in the bootstrap config, which allows specifying PGO profiles using the config file, currently for `rustc` and LLVM.

It can be also set through the command-line using e.g. `--set pgo.rustc.use=/tmp/foo`.

Best reviewed commit by commit.

r? @jieyouxu
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 8, 2026
…youxu

Introduce new bootstrap config section for PGO configuration

The handling of PGO profiles in bootstrap was a bit messy, we had CLI flags, but those were hardcoded only for rustc and LLVM, and also a separate `rust.profile-use/profile-generate` options, though I'm not sure if anyone ever used them.

I wanted to generalize this a bit, to allow experimenting with PGO optimizing also other parts of the toolchain (e.g. rustdoc, clippy, cargo). This PR introduces a new `[pgo]` section in the bootstrap config, which allows specifying PGO profiles using the config file, currently for `rustc` and LLVM.

It can be also set through the command-line using e.g. `--set pgo.rustc.use=/tmp/foo`.

Best reviewed commit by commit.

r? @jieyouxu
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 8, 2026
…youxu

Introduce new bootstrap config section for PGO configuration

The handling of PGO profiles in bootstrap was a bit messy, we had CLI flags, but those were hardcoded only for rustc and LLVM, and also a separate `rust.profile-use/profile-generate` options, though I'm not sure if anyone ever used them.

I wanted to generalize this a bit, to allow experimenting with PGO optimizing also other parts of the toolchain (e.g. rustdoc, clippy, cargo). This PR introduces a new `[pgo]` section in the bootstrap config, which allows specifying PGO profiles using the config file, currently for `rustc` and LLVM.

It can be also set through the command-line using e.g. `--set pgo.rustc.use=/tmp/foo`.

Best reviewed commit by commit.

r? @jieyouxu
rust-bors Bot pushed a commit that referenced this pull request Jul 8, 2026
…uwer

Rollup of 25 pull requests

Successful merges:

 - #158871 (add relnotes for 1.97.0)
 - #158968 (stdarch subtree update)
 - #154445 (rustdoc: Represent `--output-format=json` coverage and ir differently)
 - #156370 (Reject linked dylib EII default overrides)
 - #157153 (allow `Allocator`s to be used as `#[global_allocator]`s)
 - #158495 (Rename HAS_CT_PROJECTION to HAS_CONST_ALIAS)
 - #158617 (allow mGCA const arguments to fall back to anon consts)
 - #158645 (Fix splat ICEs and ban it in closures)
 - #158655 (Fix coroutine MIR saved local remapping)
 - #158666 (Carry the `b_offset` inside `BackendRepr::ScalarPair`)
 - #158912 (Introduce new bootstrap config section for PGO configuration)
 - #158920 (Update wasm-component-ld to 0.5.26)
 - #158926 (wrapping_sh* methods: clarify underspecified reference)
 - #158927 (add core test run with `-Zforce-intrinsic-fallback`)
 - #158932 (Do not build the compiler when invoking `x perf compare`)
 - #158937 (Emit the emscripten entry point as `__main_argc_argv`)
 - #151379 (Stabilize `VecDeque::retain_back` from `truncate_front`)
 - #156548 ( Library support for aarch64-unknown-linux-pauthtest target)
 - #158307 (CI job for parallel frontend ui tests)
 - #158347 (Improve generic parameters handling for #[diagnostic::on_const])
 - #158722 (delegation: do not always inherit `ConstArgHasType` predicates)
 - #158741 (Simplify `Option::into_flat_iter` signature)
 - #158807 (Add regression test for CString::clone_into unwind safety)
 - #158862 (Fix the span for parameter suggestion )
 - #158883 (tests: fix enum-match.rs to handle LLVM 23)
@jhpratt

jhpratt commented Jul 8, 2026

Copy link
Copy Markdown
Member

@bors r- #158977 (comment)

failed to parse override `pgo.rustc.generate="C:\a\rust\rust\opt-artifacts\rustc-pgo"`: `invalid escape character in string: `a` at line 1 column 24
Bootstrap failed while executing `build --target x86_64-pc-windows-msvc --host x86_64-pc-windows-msvc --stage 2 library/std --set pgo.rustc.generate="C:\a\rust\rust\opt-artifacts\rustc-pgo"`
Build completed unsuccessfully in 0:00:00
[2026-07-08T23:12:54.979Z INFO  opt_dist::timer] Section `Stage 1 (Rustc PGO) > Build PGO instrumented rustc and LLVM` ended: FAIL (0.35s)`
[2026-07-08T23:12:54.979Z INFO  opt_dist::timer] Section `Stage 1 (Rustc PGO)` ended: FAIL (0.35s)`

@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 8, 2026
@rust-bors

rust-bors Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

This PR was contained in a rollup (#158977), which was unapproved.

View changes since this unapproval

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants