Improve query cycle errors for parallel queries#56434
Conversation
src/librustc/ty/query/job.rs
Outdated
There was a problem hiding this comment.
Isn't this early return check cheaper than the contains below?
There was a problem hiding this comment.
We want to return false here if query has already been visited instead of true.
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
michaelwoerister
left a comment
There was a problem hiding this comment.
Thanks, @Zoxc! r=me with the nits addressed.
src/librustc/ty/query/job.rs
Outdated
There was a problem hiding this comment.
This looks like things with no span would be preferred to things with span? Can you make no_span an integer so that one can easier see what's going on?
There was a problem hiding this comment.
Is let no_span = (span == DUMMY_SP) as u8 any better?
There was a problem hiding this comment.
I'd prefer something like:
// Sort span-less queries to the back
let span_cmp = if span == DUMMY_SPAN { 1 } else { 0 };There was a problem hiding this comment.
This shouldn't be committed, I guess.
There was a problem hiding this comment.
I wouldn't mind it too much =P
64673f1 to
57db5ad
Compare
|
@bors r=michaelwoerister |
|
📌 Commit 813b484 has been approved by |
Improve query cycle errors for parallel queries r? @michaelwoerister
Rollup of 7 pull requests Successful merges: - #56000 (Add Armv8-M Mainline targets) - #56250 (Introduce ptr::hash for references) - #56434 (Improve query cycle errors for parallel queries) - #56516 (Replace usages of `..i + 1` ranges with `..=i`.) - #56555 (Send textual profile data to stderr, not stdout) - #56561 (Fix bug in from_key_hashed_nocheck) - #56574 (Fix a stutter in the docs for slice::exact_chunks) Failed merges: r? @ghost
| @@ -1942,8 +1942,12 @@ pub mod tls { | |||
| /// This is a callback from libsyntax as it cannot access the implicit state | |||
| /// in librustc otherwise | |||
| fn span_debug(span: syntax_pos::Span, f: &mut fmt::Formatter<'_>) -> fmt::Result { | |||
There was a problem hiding this comment.
I am confused, isn't this only used at the same time as the TLS TyCtxt is present?
How can with_opt give you None? Did that code change somehow?
There was a problem hiding this comment.
With parallel queries we set this on the worker threads when we create the thread pool. In that case it acts it's more like runtime linking and it will be set when no TyCtxt is around.
There was a problem hiding this comment.
Why not set it at the same time as the TyCtxt TLS?
There was a problem hiding this comment.
We need to set this on all worker threads, which we can easily do when creating the thread pool.
We could put it in ImplicitCtxt, but it would never change, so that would just make queries slower for no reason.
There was a problem hiding this comment.
In that case, can we make it so the debug callbacks are all set globally before entering even the global TyCtxt even without parallel queries?
There was a problem hiding this comment.
Maybe we just need a scoped_thread_local for the CodeMap? I feel like that would probably be a cleaner design.
|
💥 Test timed out |
r? @michaelwoerister