Skip to content

bootstrap: add --snapshot-sources argument - #165402

Draft
scrabsha wants to merge 2 commits into
rust-lang:mainfrom
scrabsha:bootstrap/add-dash-dash-snapshot-sources
Draft

scrabsha wants to merge 2 commits into
rust-lang:mainfrom
scrabsha:bootstrap/add-dash-dash-snapshot-sources

Conversation

@scrabsha

@scrabsha scrabsha commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ this needs to be reworked as described in #165402 (comment) ⚠️

we had a "how can we make perf work easier?" discussion recently and we agreed that being able to compare per-line instruction count across multiple revisions was very useful, but that having to deal with multiple checkouts of rust-lang/rust was tedious.

this PR makes things a bit easier by adding a --snapshot-sources <NAME> argument to bootstrap that copies all the sources needed to build a stage2 compiler to build/snapshot-<NAME> and compiles everything from here, with a new build directory.

the second commit of this PR makes the rustc-perf output directory shared between the snapshots and the "main" build directory. i think it makes sense to share this directory in particular because having a shared database makes it easy to compare higher-level metrics (such as total instruction count), however i'm not too attached to it.

in a later PR, i will make it such that the snapshot name can be populated with the hash of the current revision. i did not do it in now because i need to investigate Git vs Jujutsu behavior differences first.

@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 Nov 3, 2026
@scrabsha
scrabsha force-pushed the bootstrap/add-dash-dash-snapshot-sources branch 3 times, most recently from c7f01c2 to 9116c56 Compare November 3, 2026 13:03
@scrabsha

scrabsha commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

r? jdonszelmann

@scrabsha
scrabsha marked this pull request as ready for review November 3, 2026 14:42
@rustbot

rustbot commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

jdonszelmann is currently at their maximum review capacity.
They may take a while to respond.

@rustbot

rustbot commented Nov 3, 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.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 3, 2026
@scrabsha

scrabsha commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

cc @jieyouxu

@scrabsha
scrabsha force-pushed the bootstrap/add-dash-dash-snapshot-sources branch from 9116c56 to a62a628 Compare November 3, 2026 15:46
@rust-log-analyzer

This comment has been minimized.

@jieyouxu jieyouxu self-assigned this Nov 4, 2026
@scrabsha
scrabsha force-pushed the bootstrap/add-dash-dash-snapshot-sources branch from a62a628 to c1bd61d Compare November 4, 2026 07:56
@rust-log-analyzer

This comment has been minimized.

@Kobzol

Kobzol commented Nov 5, 2026

Copy link
Copy Markdown
Member

This looks like a pretty big hack, tbh 😅 What I used to do when I was benchmarking a lot is to snapshot the built rustc toolchain instead (the thing you can run rustup toolchain link on, i.e. build/<host>/stage1).

If I understand it correctly, if you use a profiler on such a snapshotted toolchain directory, it will then associate source lines with the main rustc checkout, so it will not be synchronized with the snapshotted toolchains. Can't we somehow build the toolchain in a way so that it includes its source files at the time of the build, and let the profiler refer to that? IIRC the built toolchain directories already include some source symlinks. Maybe we could just materialize those links, so that they are frozen in time?

@jieyouxu

jieyouxu commented Nov 6, 2026

Copy link
Copy Markdown
Member

Since you work with rustc-perf more... r? Kobzol

@rustbot rustbot assigned Kobzol and unassigned jdonszelmann and jieyouxu Nov 6, 2026
@rustbot

rustbot commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

Kobzol is not on the review rotation at the moment.
They may take a while to respond.

@scrabsha

scrabsha commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Can't we somehow build the toolchain in a way so that it includes its source files at the time of the build, and let the profiler refer to that?

I agree that it would be much better, but have no idea how to do that or where to look at to figure it out. I'm going to draft this PR and figure something out next week!

@scrabsha
scrabsha marked this pull request as draft November 6, 2026 08:55
@rustbot rustbot 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-review Status: Awaiting review from the assignee but also interested parties. labels Nov 6, 2026
@rust-bors

rust-bors Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #166507) made this pull request unmergeable. Please resolve the merge conflicts by rebasing.

This branch has not been deployed

No deployments
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