Skip to content

Conversation

@Zoxc
Copy link
Contributor

@Zoxc Zoxc commented Feb 2, 2026

This removes generics from DepGraph by predefining some properties of dep kinds in rustc_query_system. DEP_KIND_NULL, DEP_KIND_RED, DEP_KIND_SIDE_EFFECT and DEP_KIND_ANON_ZERO_DEPS get their indices assigned in rustc_query_system and the bits needed to encode dep kinds is also hardcoded there. These are checked later in rustc_middle.

read_index, assert_ignored and with_ignore are redefined on DepContext to avoid manual passing of the Deps type.

@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 Feb 2, 2026
@rust-log-analyzer

This comment has been minimized.

@Zoxc Zoxc force-pushed the dep-graph-rem-gen branch from 26d91f0 to b15eeea Compare February 2, 2026 05:33
@rust-log-analyzer

This comment has been minimized.

@Zoxc Zoxc force-pushed the dep-graph-rem-gen branch from b15eeea to 057eced Compare February 2, 2026 05:44
@rust-log-analyzer

This comment has been minimized.

@Zoxc Zoxc force-pushed the dep-graph-rem-gen branch 2 times, most recently from 4316c71 to e481572 Compare February 2, 2026 08:36
@Zoxc
Copy link
Contributor Author

Zoxc commented Feb 2, 2026

@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 Feb 2, 2026
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 2, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 2, 2026

☀️ Try build successful (CI)
Build commit: 1f642ee (1f642eeae16567707264119f787cef8c5546ff24, parent: a60d12cbccfbeaf153f3cecb90454aa696ea4b3b)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (1f642ee): comparison URL.

Overall result: ❌ regressions - 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.2% [0.2%, 0.3%] 6
Regressions ❌
(secondary)
0.4% [0.2%, 0.5%] 9
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.2% [0.2%, 0.3%] 6

Max RSS (memory usage)

Results (primary -1.3%)

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

Cycles

Results (primary 8.9%, secondary 1.1%)

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

mean range count
Regressions ❌
(primary)
8.9% [2.1%, 16.3%] 12
Regressions ❌
(secondary)
5.7% [5.7%, 5.7%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.5% [-3.5%, -3.5%] 1
All ❌✅ (primary) 8.9% [2.1%, 16.3%] 12

Binary size

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

Bootstrap: 473.737s -> 471.042s (-0.57%)
Artifact size: 397.70 MiB -> 397.78 MiB (0.02%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Feb 2, 2026
@Zoxc
Copy link
Contributor Author

Zoxc commented Feb 2, 2026

@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 Feb 2, 2026
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 2, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 2, 2026

💔 Test for c718310 failed: CI

@rust-bors

This comment has been minimized.

@Zoxc Zoxc force-pushed the dep-graph-rem-gen branch from e481572 to 3ebaa8b Compare February 3, 2026 23:24
@Zoxc
Copy link
Contributor Author

Zoxc commented Feb 4, 2026

@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 Feb 4, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 4, 2026

☀️ Try build successful (CI)
Build commit: 3bc6aa4 (3bc6aa4a93660ead71a27b267705ece987ff1e49, parent: 1d05e3c131d7181eb3df1a8c261f43135c99200d)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (3bc6aa4): comparison URL.

Overall result: ❌ regressions - 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.2%, 0.3%] 6
Regressions ❌
(secondary)
0.3% [0.0%, 0.5%] 15
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.0% [-0.1%, -0.0%] 2
All ❌✅ (primary) 0.3% [0.2%, 0.3%] 6

Max RSS (memory usage)

Results (secondary 2.4%)

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

Cycles

Results (primary -2.1%, secondary -1.7%)

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)
4.5% [4.1%, 4.8%] 2
Improvements ✅
(primary)
-2.1% [-2.1%, -2.1%] 1
Improvements ✅
(secondary)
-4.8% [-6.3%, -3.6%] 4
All ❌✅ (primary) -2.1% [-2.1%, -2.1%] 1

Binary size

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

Bootstrap: 476.238s -> 472.74s (-0.73%)
Artifact size: 397.76 MiB -> 397.85 MiB (0.02%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 4, 2026
@Zalathar
Copy link
Member

Zalathar commented Feb 4, 2026

I'm surprised to see a perf difference at all.

Perhaps removing the generics has accidentally resulted in less inlining, and we would need some inlining attributes to compensate?

Comment on lines +93 to +107
/// This must match the use of the define_dep_nodes! macro.
#[repr(u16)]
enum BuiltinDepKinds {
/// We use this for most things when incr. comp. is turned off.
Null,

/// We use this to create a forever-red node.
Red,

/// We use this to create a side effect node.
SideEffect,

/// We use this to create the anon node with zero dependencies.
AnonZeroDeps,
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: Perhaps we could match exhaustively on this enum in the downstream-crate assertions, to statically double-check that we've asserted on all of the constants that actually need to match.

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) perf-regression Performance regression. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants