Skip to content

DepNode use improvements#154076

Merged
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
nnethercote:DepNode-improvements
Mar 24, 2026
Merged

DepNode use improvements#154076
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
nnethercote:DepNode-improvements

Conversation

@nnethercote
Copy link
Contributor

@nnethercote nnethercote commented Mar 19, 2026

View all comments

We can simplify DepNode construction during query execution. Details in individual commits.

r? @Zalathar

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 19, 2026
@nnethercote
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Mar 19, 2026
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 19, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 19, 2026

☀️ Try build successful (CI)
Build commit: bc93a15 (bc93a15a42df606eeda0f7aeaeb1ce878b78320e, parent: fd0c901b00ee1e08a250039cdb90258603497e20)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (bc93a15): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@bors rollup=never
@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.3% [0.1%, 0.6%] 16
Regressions ❌
(secondary)
0.4% [0.1%, 0.6%] 34
Improvements ✅
(primary)
-0.1% [-0.2%, -0.1%] 6
Improvements ✅
(secondary)
-0.2% [-0.3%, -0.0%] 9
All ❌✅ (primary) 0.2% [-0.2%, 0.6%] 22

Max RSS (memory usage)

Results (secondary 1.6%)

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)
1.6% [1.6%, 1.6%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Cycles

Results (primary 2.3%)

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

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

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 481.003s -> 479.861s (-0.24%)
Artifact size: 396.91 MiB -> 394.32 MiB (-0.65%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Mar 19, 2026
@nnethercote nnethercote force-pushed the DepNode-improvements branch from de1e5b3 to 153cb38 Compare March 19, 2026 11:38
@nnethercote
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Mar 19, 2026
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 19, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 19, 2026

☀️ Try build successful (CI)
Build commit: 72bc4f3 (72bc4f34fc2ff517c705dd508412dfaf9acdc25c, parent: 8b86f48958be8c3473c979e0b5504c2d2e0fd4fd)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (72bc4f3): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@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
Improvements ✅
(primary)
-0.1% [-0.2%, -0.1%] 21
Improvements ✅
(secondary)
-0.2% [-0.3%, -0.1%] 21
All ❌✅ (primary) -0.1% [-0.2%, -0.1%] 21

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 480.842s -> 480.293s (-0.11%)
Artifact size: 395.02 MiB -> 394.94 MiB (-0.02%)

@rustbot rustbot removed perf-regression Performance regression. S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Mar 19, 2026
@nnethercote nnethercote force-pushed the DepNode-improvements branch from 153cb38 to dcb3776 Compare March 19, 2026 22:35
@rustbot
Copy link
Collaborator

rustbot commented Mar 19, 2026

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

@nnethercote nnethercote marked this pull request as ready for review March 19, 2026 22:36
@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 Mar 19, 2026
@JonathanBrouwer
Copy link
Contributor

@bors p=4
Scheduling

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Mar 23, 2026
`DepNode` use improvements



We can simplify `DepNode` construction during query execution. Details in individual commits.

r? @Zalathar
@rust-log-analyzer

This comment has been minimized.

@rust-bors rust-bors bot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 23, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 23, 2026

💔 Test for dd56731 failed: CI. Failed job:

@rust-bors rust-bors bot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Mar 23, 2026
@rust-bors

This comment has been minimized.

@rust-bors rust-bors bot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 23, 2026
The call chain for a non-incremental query includes the following
functions:

- execute_query_non_incr_inner (assert!)
- try_execute_query (assert!)
- execute_job_non_incr (assert!)

And likewise for an incremental query:

- execute_query_incr_inner (assert!)
- try_execute_query (assert!)
- execute_job_incr (expect)

That is five distinct functions. Every one of them has an `assert!` or
`expect` call that checks that the dep-graph is/is not enabled as
expected. Three cheers for defensive programming but this feels like
overkill, particularly when `execute_job{,_non_incr,_incr}` each have a
single call site.

This commit removes the assertions in `execute_query_*` and
`try_execute_query`, leaving a check in each of the `execute_job_*`
functions.
Prior to rust-lang#154122 it wasn't used on all paths, so we only computed it
when necessary -- sometimes in `check_if_ensure_can_skip_execution`,
sometimes in one of two places in `execute_job_incr` -- and pass around
`Option<DepNode>` to allow this.

But now it's always used, so this commit makes us compute it earlier,
which simplifies things.
- `check_if_ensure_can_skip_execution` can be made simpler, returning a
  bool and eliminating the need for `EnsureCanSkip`.
- `execute_job_incr` no longer uses two slightly different methods to
  create a `DepNode` (`get_or_insert_with` vs `unwrap_or_else`).
@nnethercote nnethercote force-pushed the DepNode-improvements branch from df76ef0 to 3c7ee98 Compare March 23, 2026 22:04
@nnethercote
Copy link
Contributor Author

I rebased. The CI failure seems spurious?

@bors r=Zalathar

@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 23, 2026

📌 Commit 3c7ee98 has been approved by Zalathar

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 23, 2026
nnethercote added a commit to nnethercote/rust that referenced this pull request Mar 23, 2026
The call chain for a non-incremental query includes the following
functions:

- execute_query_non_incr_inner (assert!)
- try_execute_query (assert!)
- execute_job_non_incr (assert!)

And likewise for an incremental query:

- execute_query_incr_inner (assert!)
- try_execute_query (assert!)
- execute_job_incr (expect)

That is five distinct functions. Every one of them has an `assert!` or
`expect` call that checks that the dep-graph is/is not enabled as
expected. Three cheers for defensive programming but this feels like
overkill, particularly when `execute_job{,_non_incr,_incr}` each have a
single call site.

This commit removes the assertions in `execute_query_*` and
`try_execute_query`, leaving a check in each of the `execute_job_*`
functions.
nnethercote added a commit to nnethercote/rust that referenced this pull request Mar 23, 2026
Prior to rust-lang#154122 it wasn't used on all paths, so we only computed it
when necessary -- sometimes in `check_if_ensure_can_skip_execution`,
sometimes in one of two places in `execute_job_incr` -- and pass around
`Option<DepNode>` to allow this.

But now it's always used, so this commit makes us compute it earlier,
which simplifies things.
- `check_if_ensure_can_skip_execution` can be made simpler, returning a
  bool and eliminating the need for `EnsureCanSkip`.
- `execute_job_incr` no longer uses two slightly different methods to
  create a `DepNode` (`get_or_insert_with` vs `unwrap_or_else`).
@rust-bors

This comment has been minimized.

@rust-bors rust-bors bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 24, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 24, 2026

☀️ Test successful - CI
Approved by: Zalathar
Duration: 3h 15m 49s
Pushing 212b0d4 to main...

@rust-bors rust-bors bot merged commit 212b0d4 into rust-lang:main Mar 24, 2026
12 checks passed
@rustbot rustbot added this to the 1.96.0 milestone Mar 24, 2026
@github-actions
Copy link
Contributor

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 6f22f61 (parent) -> 212b0d4 (this PR)

Test differences

Show 2 test diffs

2 doctest diffs were found. These are ignored, as they are noisy.

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 212b0d480f337082bbe1132d2b62be20e7e61f8a --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. x86_64-msvc-ext3: 1h 41m -> 1h 55m (+13.7%)
  2. dist-apple-various: 1h 36m -> 1h 23m (-13.5%)
  3. x86_64-gnu-distcheck: 2h 5m -> 2h 20m (+11.4%)
  4. dist-x86_64-musl: 2h 3m -> 2h 16m (+10.7%)
  5. i686-gnu-nopt-1: 2h 9m -> 2h 23m (+10.6%)
  6. x86_64-msvc-2: 2h 18m -> 2h 30m (+9.3%)
  7. aarch64-gnu-llvm-21-1: 1h -> 54m 49s (-9.1%)
  8. x86_64-gnu-llvm-22-3: 1h 49m -> 1h 59m (+9.0%)
  9. dist-aarch64-msvc: 1h 36m -> 1h 44m (+8.8%)
  10. i686-gnu-2: 1h 37m -> 1h 46m (+8.7%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (212b0d4): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -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
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.2% [-0.3%, -0.0%] 12
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (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)
3.4% [3.4%, 3.5%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.5% [-3.0%, -2.1%] 3
All ❌✅ (primary) - - 0

Cycles

Results (primary -2.4%, secondary 0.5%)

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

mean range count
Regressions ❌
(primary)
2.2% [1.6%, 2.7%] 2
Regressions ❌
(secondary)
3.5% [3.5%, 3.5%] 1
Improvements ✅
(primary)
-3.7% [-4.8%, -2.3%] 7
Improvements ✅
(secondary)
-2.4% [-2.4%, -2.4%] 1
All ❌✅ (primary) -2.4% [-4.8%, 2.7%] 9

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 485.277s -> 495.299s (2.07%)
Artifact size: 396.91 MiB -> 394.77 MiB (-0.54%)

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

Labels

A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) merged-by-bors This PR was explicitly merged by bors. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants