Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move DepKind to rustc_query_system and define it as u16 #115920

Merged
merged 1 commit into from
Sep 22, 2023

Conversation

Zoxc
Copy link
Contributor

@Zoxc Zoxc commented Sep 17, 2023

This moves the DepKind type to rustc_query_system where it's defined with an inner u16 field. This decouples it from rustc_middle and is a step towards letting other crates define dep kinds. It also allows some type parameters to be removed. The DepKind trait is replaced with a Deps trait. That's used when some operations or information about dep kinds which is unavailable in rustc_query_system are still needed.

r? @cjgillot

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Sep 17, 2023
@rustbot
Copy link
Collaborator

rustbot commented Sep 17, 2023

Some changes occurred to the core trait solver

cc @rust-lang/initiative-trait-system-refactor

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@cjgillot
Copy link
Contributor

@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 Sep 18, 2023
@bors
Copy link
Contributor

bors commented Sep 18, 2023

⌛ Trying commit aa95dcf with merge 30aebb4...

bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 18, 2023
Move `DepKind` to `rustc_query_system` and define it as `u16`

This moves the `DepKind` type to `rustc_query_system` where it's defined with an inner `u16` field. This decouples it from `rustc_middle` and is a step towards letting other crates define dep kinds. It also allows some type parameters to be removed. The `DepKind` trait is replaced with a `Deps` trait. That's used when some operations or information about dep kinds which is unavailable in `rustc_query_system` are still needed.

r? `@cjgillot`
@bors
Copy link
Contributor

bors commented Sep 18, 2023

☀️ Try build successful - checks-actions
Build commit: 30aebb4 (30aebb459167c051915f5c9ad08126ef72870ce4)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (30aebb4): comparison URL.

Overall result: ❌ regressions - no action needed

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.7% [0.6%, 0.7%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
4.9% [1.1%, 11.4%] 12
Improvements ✅
(primary)
-2.0% [-2.0%, -1.9%] 2
Improvements ✅
(secondary)
-2.6% [-6.6%, -0.8%] 7
All ❌✅ (primary) -2.0% [-2.0%, -1.9%] 2

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.4% [-1.6%, -1.1%] 5
Improvements ✅
(secondary)
-2.6% [-2.8%, -2.4%] 3
All ❌✅ (primary) -1.4% [-1.6%, -1.1%] 5

Binary size

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

Bootstrap: 633.305s -> 632.869s (-0.07%)
Artifact size: 317.99 MiB -> 317.96 MiB (-0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 18, 2023
Copy link
Contributor

@cjgillot cjgillot left a comment

Choose a reason for hiding this comment

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

Does this refactor open the way to move ty::tls to rustc_query_system?
That would almost completely remove the need for trait Deps.

compiler/rustc_middle/src/dep_graph/mod.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/dep_graph/dep_node.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/dep_graph/dep_node.rs Outdated Show resolved Hide resolved
Comment on lines 97 to 105
const DEP_KIND_NULL: DepKind;
const DEP_KIND_RED: DepKind;
const DEP_KIND_MAX: u16;
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you doc-comment those?

Comment on lines 97 to 101
const DEP_KIND_NULL: DepKind;
const DEP_KIND_RED: DepKind;
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we make those associated constants on DepKind with values 0 and 1, and have rustc_middle check the consistency?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it makes sense to delay dealing with these until multiple crates can define dep kinds.

@Zoxc
Copy link
Contributor Author

Zoxc commented Sep 18, 2023

Does this refactor open the way to move ty::tls to rustc_query_system?

Not very cleanly as you'd have to swap TyCtxt with a pointer.

@bors
Copy link
Contributor

bors commented Sep 21, 2023

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

@cjgillot
Copy link
Contributor

r=me after rebase

@Zoxc
Copy link
Contributor Author

Zoxc commented Sep 21, 2023

Rebased.

@cjgillot
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Sep 21, 2023

📌 Commit 1806efe has been approved by cjgillot

It is now in the queue for this repository.

@bors bors 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-review Status: Awaiting review from the assignee but also interested parties. labels Sep 21, 2023
@bors
Copy link
Contributor

bors commented Sep 21, 2023

⌛ Testing commit 1806efe with merge fcb7961...

bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 21, 2023
Move `DepKind` to `rustc_query_system` and define it as `u16`

This moves the `DepKind` type to `rustc_query_system` where it's defined with an inner `u16` field. This decouples it from `rustc_middle` and is a step towards letting other crates define dep kinds. It also allows some type parameters to be removed. The `DepKind` trait is replaced with a `Deps` trait. That's used when some operations or information about dep kinds which is unavailable in `rustc_query_system` are still needed.

r? `@cjgillot`
@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@bors
Copy link
Contributor

bors commented Sep 21, 2023

💔 Test failed - checks-actions

@bors bors 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 Sep 21, 2023
@cjgillot
Copy link
Contributor

@bors retry

@bors bors 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-review Status: Awaiting review from the assignee but also interested parties. labels Sep 21, 2023
@bors
Copy link
Contributor

bors commented Sep 22, 2023

⌛ Testing commit 1806efe with merge b757318...

@bors
Copy link
Contributor

bors commented Sep 22, 2023

☀️ Test successful - checks-actions
Approved by: cjgillot
Pushing b757318 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 22, 2023
@bors bors merged commit b757318 into rust-lang:master Sep 22, 2023
11 checks passed
@rustbot rustbot added this to the 1.74.0 milestone Sep 22, 2023
@Zoxc Zoxc deleted the depkind-u16 branch September 22, 2023 03:52
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (b757318): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

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

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
4.3% [1.8%, 6.1%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.0% [-6.8%, -1.2%] 11
All ❌✅ (primary) - - 0

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.6% [-1.6%, -1.6%] 1
Improvements ✅
(secondary)
-2.1% [-2.2%, -2.1%] 2
All ❌✅ (primary) -1.6% [-1.6%, -1.6%] 1

Binary size

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

Bootstrap: 633.396s -> 631.519s (-0.30%)
Artifact size: 317.61 MiB -> 317.47 MiB (-0.04%)

@lcnr lcnr removed the WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) label Sep 29, 2023
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. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

7 participants