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

Remove OneThread #116185

Merged
merged 1 commit into from
Jan 20, 2024
Merged

Remove OneThread #116185

merged 1 commit into from
Jan 20, 2024

Conversation

Zoxc
Copy link
Contributor

@Zoxc Zoxc commented Sep 26, 2023

This removes OneThread by switching incr_comp_session over to RwLock.

@rustbot
Copy link
Collaborator

rustbot commented Sep 26, 2023

r? @cjgillot

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added 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. labels Sep 26, 2023
@petrochenkov
Copy link
Contributor

It would be good to have the motivation written out explicitly for changes like this.

Why was OneThread used previously? Why can RwLock be used now instead? What changed?

@cjgillot cjgillot 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 Sep 27, 2023
@Zoxc
Copy link
Contributor Author

Zoxc commented Sep 30, 2023

Both OneThread and RwLock are fine for incr_comp_session, but the other uses of OneThread are removed, so switching incr_comp_session over to RwLock allows its removal.

@cjgillot
Copy link
Contributor

This OneThread encodes that only the main thread is supposed to change the directory. In practice, only 2 functions are allowed to do that, called directly from rustc_interface.
Can we do better and move incr_comp_session out of Session?
Perhaps into rustc_interface::queries::Queries?

@bjorn3
Copy link
Member

bjorn3 commented Sep 30, 2023

That would be nice. More mutable state has been moved out of Session recently and I have a PR pending to remove another bit of mutable state in Session.

@bjorn3
Copy link
Member

bjorn3 commented Sep 30, 2023

One thing however is that I would also like to be able to finalize the incremental session from within a codegen backend. The (experimental) jit mode of cg_clif never returns control back to rustc_interface after codegen has ended. It directly runs the program and exits. This means incremental compilation is currently broken with the jit mode. For the regular jit mode it would technically be possible to move execution to CodegenBackend::link using global mutable state in a thread local, but that won't work for the (even more experimental) lazy jit mode which needs the TyCtxt to remain available all the way till the end to allow codegening new functions on the fly.

@bors
Copy link
Contributor

bors commented Oct 13, 2023

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

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Jan 9, 2024

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

@Zoxc
Copy link
Contributor Author

Zoxc commented Jan 18, 2024

@rustbot ready

This OneThread encodes that only the main thread is supposed to change the directory

That's not actually an invariant though.

@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 Jan 18, 2024
@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 Jan 20, 2024
@bors
Copy link
Contributor

bors commented Jan 20, 2024

⌛ Trying commit 63446d0 with merge c8e6073...

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 20, 2024
Remove `OneThread`

This removes `OneThread` by switching `incr_comp_session` over to `RwLock`.
@bors
Copy link
Contributor

bors commented Jan 20, 2024

☀️ Try build successful - checks-actions
Build commit: c8e6073 (c8e607340856c8692c43cb00c4ebfd09a78c98a9)

1 similar comment
@bors
Copy link
Contributor

bors commented Jan 20, 2024

☀️ Try build successful - checks-actions
Build commit: c8e6073 (c8e607340856c8692c43cb00c4ebfd09a78c98a9)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (c8e6073): comparison URL.

Overall result: no relevant changes - 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 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)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.2% [-4.4%, -1.1%] 3
All ❌✅ (primary) - - 0

Cycles

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

Binary size

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

Bootstrap: 663.584s -> 663.307s (-0.04%)
Artifact size: 308.31 MiB -> 308.32 MiB (0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 20, 2024
@cjgillot
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jan 20, 2024

📌 Commit 63446d0 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 Jan 20, 2024
@bors
Copy link
Contributor

bors commented Jan 20, 2024

⌛ Testing commit 63446d0 with merge 6745c60...

@bors
Copy link
Contributor

bors commented Jan 20, 2024

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

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 20, 2024
@bors bors merged commit 6745c60 into rust-lang:master Jan 20, 2024
12 checks passed
@rustbot rustbot added this to the 1.77.0 milestone Jan 20, 2024
@Zoxc Zoxc deleted the rem-one-thread branch January 20, 2024 15:37
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (6745c60): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -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
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.7% [-1.7%, -1.7%] 1
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)
1.3% [1.3%, 1.3%] 1
Improvements ✅
(primary)
-2.4% [-2.4%, -2.4%] 1
Improvements ✅
(secondary)
-2.8% [-4.3%, -1.5%] 3
All ❌✅ (primary) -2.4% [-2.4%, -2.4%] 1

Cycles

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

Binary size

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

Bootstrap: 665.464s -> 666.038s (0.09%)
Artifact size: 308.33 MiB -> 308.34 MiB (0.00%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

8 participants