-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Deterministic query cycles for parallel front-end #149849
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
base: main
Are you sure you want to change the base?
Conversation
|
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
|
The job Click to see the possible cause of the failure (guessed by this bot) |
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.
Hi, first of all, thank you for your work on this. I can see a lot has been done to address the issue!
Unable to speak about entire implementation since don't know much about this part, but one note on this particular file: the logic seems a bit unclear to me due to the magic numbers and bit manipulations. Even though the file isn't large, adding a few explanatory comments would be a big help for clarity
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.
Also, we'll need a regression test to check it doesn't ICE with these changes
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Deterministic query cycles for parallel front-end
|
Ok this is surprising |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (306a768): comparison URL. Overall result: ❌ regressions - please read the text belowBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (secondary -1.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 2.2%, secondary 2.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 471.42s -> 474.532s (0.66%) |
It's a bit messy currently, so I will need to tidy things up. Anyway this is a working implementation of parallel query cycle detection. Also I suspect code like saving thread ids in query info is redundant and needs to be removed.
The mechanism is similar to cycle detection in single-threaded mode. From the top active query downwards towards subqueries we traverse the deadlocked query graph until we visit some query a second time, thus finding a cycle. With multi-thread front-end enabled one query may now have more than one active subqueries, aka we used one of parallel interfaces
parallel!,join,par_for_each, etc. As such we have to traverse the "leftmost" active subquery to recover the sequential behavior of these parallel interfaces in single-threaded mode. NewBranchKeysaves into implicit context information about whatjoin(orscope) branch in order we took while executing a query, which we then use inbreak_query_cycle. I reasonably assume only "nesting" functions likejoinandscopeare used to spawn subtasks, but notspawnor something else.However we then have to guarantee the query stack from single-threaded mode is included in the active query graph. This is true for
joinfunctions as their first task will be completed on the same thread and same will be tried for the second task unless stolen which is fine for us. Butscopefunction does not necessary follow this wisdom, and the order of executed tasks there does not seem to be right. TODO: fixscopeFixes #142064
Fixes #142063
Fixes #127971
Probably fixes other issues with query cycles if those aren't fixed already.