yxsamliu wrote:

> Sorry that I haven't commented earlier but I have only just got around to 
> looking at this in more detail. Although, the parallel functions for 
> `Parallel.cpp` already "batch", I would still be a bit concerned about the 
> overhead for obtaining the job slot. Perhaps like in `ThreadPool.cpp` it 
> should hold onto the job slot whilst there are jobs to be processed? I also 
> see that an exponential back-off is used in `ThreadPool.cpp`. Could this be 
> applicable also to `Parallel.cpp`?

Thanks for the detailed read. You're right. Per-task acquire adds overhead. 
I'll change Parallel.cpp to hold a job slot while there is work. Like 
ThreadPool.cpp does. We'll process tasks in a loop and release the slot when 
the queue is empty. I'll also add exponential backoff when no slot is 
available. That will avoid busy requeue and yield. This keeps behavior the 
same, but cuts overhead.

https://github.com/llvm/llvm-project/pull/145131
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to