Page MenuHomePhabricator

[llvm][lldb] Add optimal ThreadPool concurrency
ClosedPublic

Authored by dmantipov on Sep 16 2020, 8:03 AM.

Details

Summary

Add an optimal thread strategy to execute specified amount of tasks. This strategy should prevent us from creating too many threads if we occasionaly have an unexpectedly small amount of tasks.

Diff Detail

Event Timeline

dmantipov created this revision.Sep 16 2020, 8:03 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptSep 16 2020, 8:03 AM
dmantipov requested review of this revision.Sep 16 2020, 8:03 AM

Running on 48-core system, I was pretty surprised to see 48-threads pool when attempting to debug a toy C++ program. So here is a fix.

This sounds like a good idea, but I'd like to get another set of eyes on the llvm part.

aganea accepted this revision.Sep 17 2020, 5:33 AM

Side-note: @dmantipov Could you please use git diff -U99999 when creating patches? This allows reviewers to quickly browse through other parts of the file(s) in Phabricator. That would fix the "Context not available." message.

The patch looks like a quick win on the short term. A better fix would create threads on-the-go as work is being pushed on the queue. An even better fix would be a system-wide thread pool for all LLVM apps. But that would require more effort, especially on testing & maintenance.

LGTM.

This revision is now accepted and ready to land.Sep 17 2020, 5:33 AM

@dmantipov Do you have commit access (which I can encourage you ask here if you're planning further changes) or should I commit this for you?

This revision was landed with ongoing or failed builds.Sep 23 2020, 9:44 AM
This revision was automatically updated to reflect the committed changes.