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

Inform the solver if evaluation is concurrent #130094

Merged
merged 1 commit into from
Sep 10, 2024

Conversation

workingjubilee
Copy link
Member

Parallel compilation of a program can cause unexpected event sequencing. Inform the solver when this is true so it can skip invalid asserts.

Recommended by @lcnr in #129112 (comment)
Fixes #130089
Fixes #130088
Fixes #129112

r? compiler-errors

@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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Sep 8, 2024
Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

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

I am not certain this is sound; I think the new solver legitimately cannot handle parallel computation yet, but idk lol

r? lcnr

@rustbot rustbot assigned lcnr and unassigned compiler-errors Sep 8, 2024
@lcnr
Copy link
Contributor

lcnr commented Sep 9, 2024

I am not certain this is sound; I think the new solver legitimately cannot handle parallel computation yet, but idk lol

I am fairly confident that overwriting previous cache entries during parallel compilation should not cause issues. We can assert that the results match which should catch any bugs 🤔

@workingjubilee
Copy link
Member Author

It's a nightly feature colliding with a nightly feature, it's not the worst if it explodes.

Copy link
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

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

r=me after fixing the comment

@workingjubilee
Copy link
Member Author

@bors r=lcnr

@bors
Copy link
Contributor

bors commented Sep 9, 2024

📌 Commit 6c6a233 has been approved by lcnr

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 9, 2024
@rust-log-analyzer

This comment has been minimized.

@workingjubilee
Copy link
Member Author

@bors r-

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 9, 2024
@workingjubilee
Copy link
Member Author

LINE NUMBERS
@bors r=lcnr

@bors
Copy link
Contributor

bors commented Sep 9, 2024

📌 Commit 52fc385 has been approved by lcnr

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 9, 2024
@rust-log-analyzer

This comment has been minimized.

@workingjubilee
Copy link
Member Author

...uh.

Parallel compilation of a program can cause unexpected event sequencing.
Inform the solver when this is true so it can skip invalid asserts, then
assert replaced solutions are equal if Some
@workingjubilee
Copy link
Member Author

that doesn't reproduce locally...

@workingjubilee
Copy link
Member Author

@bors r- fine fine I'll actually wait instead of trying to spin three plates at once.

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 9, 2024
@workingjubilee
Copy link
Member Author

...huh.

@bors r=lcnr

@bors
Copy link
Contributor

bors commented Sep 10, 2024

📌 Commit d243c8f has been approved by lcnr

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 10, 2024
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Sep 10, 2024
…, r=lcnr

Inform the solver if evaluation is concurrent

Parallel compilation of a program can cause unexpected event sequencing. Inform the solver when this is true so it can skip invalid asserts.
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 10, 2024
…kingjubilee

Rollup of 14 pull requests

Successful merges:

 - rust-lang#128316 (Stabilize most of `io_error_more`)
 - rust-lang#129473 (use  `download-ci-llvm=true` in the default compiler config)
 - rust-lang#129529 (Add test to build crates used by r-a on stable)
 - rust-lang#129778 (interpret: make typed copies lossy wrt provenance and padding)
 - rust-lang#129981 (Remove `serialized_bitcode` from `LtoModuleCodegen`.)
 - rust-lang#130025 (Also emit `missing_docs` lint with `--test` to fulfil expectations)
 - rust-lang#130040 (unify `llvm-bitcode-linker`, `wasm-component-ld` and llvm-tools logics)
 - rust-lang#130094 (Inform the solver if evaluation is concurrent)
 - rust-lang#130132 ([illumos] enable SIGSEGV handler to detect stack overflows)
 - rust-lang#130146 (bootstrap `naked_asm!` for `compiler-builtins`)
 - rust-lang#130149 (Helper function for formatting with `LifetimeSuggestionPosition`)
 - rust-lang#130152 (adapt a test for llvm 20)
 - rust-lang#130162 (bump download-ci-llvm-stamp)
 - rust-lang#130164 (move some const fn out of the const_ptr_as_ref feature)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 10, 2024
…kingjubilee

Rollup of 11 pull requests

Successful merges:

 - rust-lang#128316 (Stabilize most of `io_error_more`)
 - rust-lang#129473 (use  `download-ci-llvm=true` in the default compiler config)
 - rust-lang#129529 (Add test to build crates used by r-a on stable)
 - rust-lang#129981 (Remove `serialized_bitcode` from `LtoModuleCodegen`.)
 - rust-lang#130094 (Inform the solver if evaluation is concurrent)
 - rust-lang#130132 ([illumos] enable SIGSEGV handler to detect stack overflows)
 - rust-lang#130146 (bootstrap `naked_asm!` for `compiler-builtins`)
 - rust-lang#130149 (Helper function for formatting with `LifetimeSuggestionPosition`)
 - rust-lang#130152 (adapt a test for llvm 20)
 - rust-lang#130162 (bump download-ci-llvm-stamp)
 - rust-lang#130164 (move some const fn out of the const_ptr_as_ref feature)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 10, 2024
…kingjubilee

Rollup of 11 pull requests

Successful merges:

 - rust-lang#128316 (Stabilize most of `io_error_more`)
 - rust-lang#129473 (use  `download-ci-llvm=true` in the default compiler config)
 - rust-lang#129529 (Add test to build crates used by r-a on stable)
 - rust-lang#129981 (Remove `serialized_bitcode` from `LtoModuleCodegen`.)
 - rust-lang#130094 (Inform the solver if evaluation is concurrent)
 - rust-lang#130132 ([illumos] enable SIGSEGV handler to detect stack overflows)
 - rust-lang#130146 (bootstrap `naked_asm!` for `compiler-builtins`)
 - rust-lang#130149 (Helper function for formatting with `LifetimeSuggestionPosition`)
 - rust-lang#130152 (adapt a test for llvm 20)
 - rust-lang#130162 (bump download-ci-llvm-stamp)
 - rust-lang#130164 (move some const fn out of the const_ptr_as_ref feature)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 2859c24 into rust-lang:master Sep 10, 2024
6 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Sep 10, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Sep 10, 2024
Rollup merge of rust-lang#130094 - workingjubilee:concurrency-is-real, r=lcnr

Inform the solver if evaluation is concurrent

Parallel compilation of a program can cause unexpected event sequencing. Inform the solver when this is true so it can skip invalid asserts.
assert!(prev.is_none());
if let Some(prev) = &prev {
assert!(cx.evaluation_is_concurrent());
assert_eq!(cx.get_tracked(&prev.result), origin_result);
Copy link
Contributor

Choose a reason for hiding this comment

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

This allows redundant duplicate work and checks. Ideally the second thread should wait for the first thread to calculate the cached result, but there should be at least a FIXME for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
8 participants