-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Import SourceFile
s from crate before decoding foreign Span
#92175
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 694cc860db597055044b55e35e074a9f5304e8d0 with merge b03e9a396b02e7285c97d453d8c0d59c7fd4d43e... |
☀️ Try build successful - checks-actions |
Queued b03e9a396b02e7285c97d453d8c0d59c7fd4d43e with parent e100ec5, future comparison URL. |
Finished benchmarking commit (b03e9a396b02e7285c97d453d8c0d59c7fd4d43e): comparison url. Summary: This change led to very large relevant mixed results 🤷 in compiler performance.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. 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 led 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 |
I think the 'improvement' is just due to the fact that that benchmark was previously broken. |
I'm tempted to r+ this but the performance regression doesn't look too good. A CrateNum is encoded as a 16-byte stable hash, if I remember correctly. It's not unexpected that adding 16 bytes to each encoded span would show up in benchmarks.
|
Fixes rust-lang#92163 Fixes rust-lang#92014 When writing to the incremental cache, we encode all `Span`s we encounter, regardless of whether or not their `SourceFile` comes from the local crate, or from a foreign crate. When we decode a `Span`, we use the `StableSourceFileId` we encoded to locate the matching `SourceFile` in the current session. If this id corresponds to a `SourceFile` from another crate, then we need to have already imported that `SourceFile` into our current session. This usually happens automatically during resolution / macro expansion, when we try to resolve definitions from other crates. In certain cases, however, we may try to load a `Span` from a transitive dependency without having ever imported the `SourceFile`s from that crate, leading to an ICE. This PR fixes the issue by calling `imported_source_files()` when we encounter a `SourceFile` with a foreign `CrateNum`. This ensures that all `SourceFile`s from that crate are imported into the current session.
694cc86
to
d922092
Compare
@michaelwoerister: Thanks, I didn't notice that. I've updated the PR to use the already-decoded |
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit d922092 with merge 529fa20023160e522151496a1a7fffc7b07261d1... |
☀️ Try build successful - checks-actions |
Queued 529fa20023160e522151496a1a7fffc7b07261d1 with parent 489296d, future comparison URL. |
Finished benchmarking commit (529fa20023160e522151496a1a7fffc7b07261d1): comparison url. Summary: This change led to very large relevant improvements 🎉 in compiler performance.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. 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 led to changes in compiler perf. @bors rollup=never |
@michaelwoerister It looks like your suggested fixed the perf regression entirely! |
@michaelwoerister Do you think this is now good to merge? A large number of people are hitting this on the latest nightly. |
📌 Commit d922092 has been approved by |
☀️ Test successful - checks-actions |
Finished benchmarking commit (984a6bf): comparison url. Summary: This change led to very large relevant improvements 🎉 in compiler performance.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression |
# Objective - Nightly checks where disabled because of a bug in Rust - Dependency checks are failing because of a new duplicate ## Solution - Now that rust-lang/rust#92175 has been merged, re-enable nightly checks - Add the new duplicate dependency to the known list - Removed `Inflector` dependency as it's not used anymore Co-authored-by: François <8672791+mockersf@users.noreply.github.com>
I'm glad the alternative approach worked out. |
Fixes #92163
Fixes #92014
When writing to the incremental cache, we encode all
Span
swe encounter, regardless of whether or not their
SourceFile
comes from the local crate, or from a foreign crate.
When we decode a
Span
, we use theStableSourceFileId
we encodedto locate the matching
SourceFile
in the current session. If thisid corresponds to a
SourceFile
from another crate, then we need tohave already imported that
SourceFile
into our current session.This usually happens automatically during resolution / macro expansion,
when we try to resolve definitions from other crates. In certain cases,
however, we may try to load a
Span
from a transitive dependencywithout having ever imported the
SourceFile
s from that crate, leadingto an ICE.
This PR fixes the issue by enconding the
SourceFile
'sCrateNum
when we encode a
Span
. During decoding, we callimported_source_files()
when we encounter a foreign
CrateNum
, which ensure that allSourceFile
s from that crate are imported into the current session.