Skip to content

Conversation

@keith
Copy link
Member

@keith keith commented Jun 5, 2020

Previously if -num-threads was passed as 1, this would still use the
parallel codepath, but with only a single thread.

This is analogous to this swift-driver change swiftlang/swift-driver#117

@CodaFi
Copy link
Contributor

CodaFi commented Jun 5, 2020

I rather like shouldPerformIRGenerationInParallel being the predicate name here. Otherwise, LGTM.

Previously if `-num-threads` was passed as 1, this would still use the
parallel codepath, but with only a single thread.
@keith keith force-pushed the ks/irgen-count branch from eedd07e to b85e79e Compare June 5, 2020 19:27
@keith
Copy link
Member Author

keith commented Jun 5, 2020

Me too, fixed!

@keith
Copy link
Member Author

keith commented Jun 5, 2020

cc @eeckstein

@slavapestov
Copy link
Contributor

Should we instead get rid of single-threaded mode altogether?

@CodaFi
Copy link
Contributor

CodaFi commented Jun 5, 2020

@swift-ci smoke test

@keith
Copy link
Member Author

keith commented Jun 5, 2020

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)

@keith
Copy link
Member Author

keith commented Jun 6, 2020

I think I fixed that case #32216 happy to strip out the entire single threaded codepath here if that's what folks want instead!

@eeckstein
Copy link
Contributor

@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".

@slavapestov
Copy link
Contributor

@eeckstein Is there any actual difference between the single-threaded path, and multi-threaded with num_threads==1? If not, can we get rid of the single-threaded mode?

@eeckstein
Copy link
Contributor

@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.

@keith
Copy link
Member Author

keith commented Jun 9, 2020

What's the need for that difference?

@eeckstein
Copy link
Contributor

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.

@keith
Copy link
Member Author

keith commented Jun 9, 2020

Thanks for the context!

@keith keith closed this Jun 9, 2020
@keith keith deleted the ks/irgen-count branch June 9, 2020 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants