-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Stop considering moved-out locals when computing auto traits for generators (rebased) #128846
base: master
Are you sure you want to change the base?
Conversation
These tests are identical to the ones without drop-track prefix, so remove.
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Stop considering moved-out locals when computing auto traits for generators (rebased) This PR revives rust-lang#112279. I wanted to reopen this to gauge `@cjgillot's` thoughts about this, since it's been a while since `-Zdrop-tracking-mir` has landed. If this PR looks OK, I can flesh it out and write up an FCP report -- I think this is a T-types FCP, since this has to do with the types that are considered live for auto traits, and doesn't otherwise affect the layout of coroutines. Open questions: * **"Why do we require storage to be live if the locals is not initialized?"** (rust-lang#112279 (comment)) * I agree that we should eventually fix the storage analysis for coroutines, but this seems like a problem that can be fixed after we fix witnesses for *the purposes of traits* here. * As far as I could tell, fixing the problem of moved locals for *storage* would require insertion of additional `StorageDead` statements, or would require further entangling the type system with the operational semantics in ways that T-opsem seemed uncomfortable with [when I asked](https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/Inserting.20.60StorageDrop.60.20after.20unconditional.20moves). cc `@RalfJung` * Relevant: rust-lang/unsafe-code-guidelines#188 Fixes rust-lang#128095 Fixes rust-lang#94067 r? `@cjgillot`
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (7093781): comparison URL. Overall result: ❌ regressions - ACTION NEEDEDBenchmarking 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. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)Results (primary 4.2%, secondary -1.0%)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.
CyclesResults (secondary 3.3%)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.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 761.822s -> 762.913s (0.14%) |
I think we should eat the perf cost of the analysis. I'm happy to write up an FCP report for this if someone would like to actually review the changes. |
It was initially a design goal to have the witness types and the runtime transform use the same code. To ensure that they don't diverge and that we don't introduce unsoundness. On this particular change, why can't apply it to the runtime transform too? |
@@ -725,6 +727,10 @@ struct LivenessInfo { | |||
/// Which locals are live across any suspension point. | |||
saved_locals: CoroutineSavedLocals, | |||
|
|||
/// Which locals are live *and* initialized across any suspension point. | |||
/// A local that is live but is not initialized does not need to accounted in auto trait checking. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your friendly neighborhood spell checker 😁
/// A local that is live but is not initialized does not need to accounted in auto trait checking. | |
/// A local that is live but is not initialized does not need to be accounted for in auto trait checking. |
@cjgillot: I'm not totally sure if I'm understanding what you're asking for. 🤔 Are you saying that we shouldn't just be using this for auto trait coroutine witnesses, but also we should use whether a variable is uninitialized to make it so that we don't even store it across await points? If so, I'm not totally sure that would be sound, given that we don't have a |
What I'm asking is to have the same logic for both the types and runtime. The core idea behind type witnesses is to list the types which will appear in the runtime representation. If the types and runtime have the same logic, we can be confident that whatever happens between both analyses, we will have something consistent. For instance, we could perform the runtime transform after some opts, and be happy with it. If we have different analyses, I fear we will have to prove each time that we have that consistency, which will be hard. So my question is: what would it take to make your PR sourd for the runtime transform. Do I make sense? |
This PR revives #112279. I wanted to reopen this to gauge @cjgillot's thoughts about this, since it's been a while since
-Zdrop-tracking-mir
has landed.If this PR looks OK, I can flesh it out and write up an FCP report -- I think this is a T-types FCP, since this has to do with the types that are considered live for auto traits, and doesn't otherwise affect the layout of coroutines.
Open questions:
StorageDead
statements, or would require further entangling the type system with the operational semantics in ways that T-opsem seemed uncomfortable with when I asked. cc @RalfJungFixes #128095
Fixes #94067
Fixes #129325
r? @cjgillot