[PATCH] D69582: Let clang driver support parallel jobs

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 4 13:28:13 PST 2020


yaxunl marked an inline comment as done.
yaxunl added inline comments.


================
Comment at: clang/lib/Driver/Compilation.cpp:332
+    if (!Next) {
+      std::this_thread::yield();
       continue;
----------------
aganea wrote:
> In addition to what @thakis said above, yielding here is maybe not a good idea. This causes the process to spin, and remain in the OS' active process list, which uselessly eats cpu cycles. This can become significant over the course of several minutes of compilation.
> 
> Here's a //tiny// example of what happens when threads are waiting for something to happen:
> (the top parts yields frequently; the bottom part does not yield - see D68820)
> {F10592208}
> 
> You would need here to go through a OS primitive that suspends the process until at least one job in the pool completes. On Windows this can be achieved through `WaitForMultipleObjects()` or I/O completion ports like provided by @thakis. You can take a look at `Compilation::executeJobs()` in D52193 and further down the line, `WaitMany()` which waits for at least one job/process to complete.
Sorry for the delay.

If D52193 is commited, I will probably only need some minor change to support parallel compilation for HIP. Therefore I hope D52193 could get committed soon.

I am wondering what is the current status of D52193 and what is blocking it. Is there any chance to get it commited soon?

Thanks.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69582/new/

https://reviews.llvm.org/D69582





More information about the cfe-commits mailing list