-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Only perform parallel ir generation if -num-threads > 1 #32208
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
Conversation
I rather like |
Previously if `-num-threads` was passed as 1, this would still use the parallel codepath, but with only a single thread.
Me too, fixed! |
cc @eeckstein |
Should we instead get rid of single-threaded mode altogether? |
@swift-ci smoke test |
If we want to toss the single threaded pass that seems fine to me. I'm currently debugging an issue where whether or not it's single threaded or multithreaded affects whether or not code coverage data is valid, so it would be nice to know the difference in those doesn't cause issues for other use cases as well (hoping to just fix the root cause of that one) |
I think I fixed that case #32216 happy to strip out the entire single threaded codepath here if that's what folks want instead! |
@keith I already commented in swiftlang/swift-driver#117: Both, a value of "0" and "1" make sense. Sometimes it's useful to test/analyze the multi-module IR generation, but within a single thread. This is purpose of "1". |
@eeckstein Is there any actual difference between the single-threaded path, and multi-threaded with |
@slavapestov Yes, there is. In single-threaded mode (-num-threads = 0) the whole module is IRGen'd into a single LLVM module, whereas in multi-threaded mode (-num-threads >= 1) the module is split into multiple LLVM modules. |
What's the need for that difference? |
Single-threaded compilation was the default originally. When we added multi-threaded compilation we wanted to keep single-threaded compilation in case there is a problem (miscompile, performance degradation, etc.) with multi-threaded compilation. Even now, sometimes when we investigate performance or code size, we are trying with single-threaded compilation to see if a deficiency can be fixed by e.g. a better strategy for module splitting. |
Thanks for the context! |
Previously if
-num-threads
was passed as 1, this would still use theparallel codepath, but with only a single thread.
This is analogous to this swift-driver change swiftlang/swift-driver#117