Revision tags: llvmorg-10.0.0, llvmorg-10.0.0-rc6, llvmorg-10.0.0-rc5, llvmorg-10.0.0-rc4, llvmorg-10.0.0-rc3 |
|
#
b25fc412 |
| 15-Feb-2020 |
Alexandre Ganea <alexandre.ganea@ubisoft.com> |
[Support] In tests, fix warning: variable ‘Threads’ set but not used
|
#
8404aeb5 |
| 14-Feb-2020 |
Alexandre Ganea <alexandre.ganea@ubisoft.com> |
[Support] On Windows, ensure hardware_concurrency() extends to all CPU sockets and all NUMA groups
The goal of this patch is to maximize CPU utilization on multi-socket or high core count systems, s
[Support] On Windows, ensure hardware_concurrency() extends to all CPU sockets and all NUMA groups
The goal of this patch is to maximize CPU utilization on multi-socket or high core count systems, so that parallel computations such as LLD/ThinLTO can use all hardware threads in the system. Before this patch, on Windows, a maximum of 64 hardware threads could be used at most, in some cases dispatched only on one CPU socket.
== Background == Windows doesn't have a flat cpu_set_t like Linux. Instead, it projects hardware CPUs (or NUMA nodes) to applications through a concept of "processor groups". A "processor" is the smallest unit of execution on a CPU, that is, an hyper-thread if SMT is active; a core otherwise. There's a limit of 32-bit processors on older 32-bit versions of Windows, which later was raised to 64-processors with 64-bit versions of Windows. This limit comes from the affinity mask, which historically is represented by the sizeof(void*). Consequently, the concept of "processor groups" was introduced for dealing with systems with more than 64 hyper-threads.
By default, the Windows OS assigns only one "processor group" to each starting application, in a round-robin manner. If the application wants to use more processors, it needs to programmatically enable it, by assigning threads to other "processor groups". This also means that affinity cannot cross "processor group" boundaries; one can only specify a "preferred" group on start-up, but the application is free to allocate more groups if it wants to.
This creates a peculiar situation, where newer CPUs like the AMD EPYC 7702P (64-cores, 128-hyperthreads) are projected by the OS as two (2) "processor groups". This means that by default, an application can only use half of the cores. This situation could only get worse in the years to come, as dies with more cores will appear on the market.
== The problem == The heavyweight_hardware_concurrency() API was introduced so that only *one hardware thread per core* was used. Once that API returns, that original intention is lost, only the number of threads is retained. Consider a situation, on Windows, where the system has 2 CPU sockets, 18 cores each, each core having 2 hyper-threads, for a total of 72 hyper-threads. Both heavyweight_hardware_concurrency() and hardware_concurrency() currently return 36, because on Windows they are simply wrappers over std::thread::hardware_concurrency() -- which can only return processors from the current "processor group".
== The changes in this patch == To solve this situation, we capture (and retain) the initial intention until the point of usage, through a new ThreadPoolStrategy class. The number of threads to use is deferred as late as possible, until the moment where the std::threads are created (ThreadPool in the case of ThinLTO).
When using hardware_concurrency(), setting ThreadCount to 0 now means to use all the possible hardware CPU (SMT) threads. Providing a ThreadCount above to the maximum number of threads will have no effect, the maximum will be used instead. The heavyweight_hardware_concurrency() is similar to hardware_concurrency(), except that only one thread per hardware *core* will be used.
When LLVM_ENABLE_THREADS is OFF, the threading APIs will always return 1, to ensure any caller loops will be exercised at least once.
Differential Revision: https://reviews.llvm.org/D71775
show more ...
|
Revision tags: llvmorg-10.0.0-rc2, llvmorg-10.0.0-rc1, llvmorg-11-init, llvmorg-9.0.1, llvmorg-9.0.1-rc3, llvmorg-9.0.1-rc2, llvmorg-9.0.1-rc1 |
|
#
7207dae5 |
| 18-Nov-2019 |
Simon Pilgrim <llvm-dev@redking.me.uk> |
Fix uninitialized variable warning. NFC.
|
Revision tags: llvmorg-9.0.0, llvmorg-9.0.0-rc6, llvmorg-9.0.0-rc5, llvmorg-9.0.0-rc4, llvmorg-9.0.0-rc3, llvmorg-9.0.0-rc2, llvmorg-9.0.0-rc1, llvmorg-10-init, llvmorg-8.0.1, llvmorg-8.0.1-rc4, llvmorg-8.0.1-rc3, llvmorg-8.0.1-rc2, llvmorg-8.0.1-rc1, llvmorg-8.0.0, llvmorg-8.0.0-rc5, llvmorg-8.0.0-rc4, llvmorg-8.0.0-rc3, llvmorg-7.1.0, llvmorg-7.1.0-rc1, llvmorg-8.0.0-rc2, llvmorg-8.0.0-rc1 |
|
#
2946cd70 |
| 19-Jan-2019 |
Chandler Carruth <chandlerc@gmail.com> |
Update the file headers across all of the LLVM projects in the monorepo to reflect the new license.
We understand that people may be surprised that we're moving the header entirely to discuss the ne
Update the file headers across all of the LLVM projects in the monorepo to reflect the new license.
We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach.
Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository.
llvm-svn: 351636
show more ...
|
Revision tags: llvmorg-7.0.1, llvmorg-7.0.1-rc3, llvmorg-7.0.1-rc2, llvmorg-7.0.1-rc1, llvmorg-7.0.0, llvmorg-7.0.0-rc3, llvmorg-7.0.0-rc2, llvmorg-7.0.0-rc1, llvmorg-6.0.1, llvmorg-6.0.1-rc3 |
|
#
9b8b0794 |
| 13-Jun-2018 |
Zachary Turner <zturner@google.com> |
Revert "Enable ThreadPool to queue tasks that return values."
This is failing to compile when LLVM_ENABLE_THREADS is false, and the fix is not immediately obvious, so reverting while I look into it.
Revert "Enable ThreadPool to queue tasks that return values."
This is failing to compile when LLVM_ENABLE_THREADS is false, and the fix is not immediately obvious, so reverting while I look into it.
llvm-svn: 334658
show more ...
|
#
1b76a128 |
| 13-Jun-2018 |
Zachary Turner <zturner@google.com> |
Enable ThreadPool to support tasks that return values.
Previously ThreadPool could only queue async "jobs", i.e. work that was done for its side effects and not for its result. It's useful occasion
Enable ThreadPool to support tasks that return values.
Previously ThreadPool could only queue async "jobs", i.e. work that was done for its side effects and not for its result. It's useful occasionally to queue async work that returns a value. From an API perspective, this is very intuitive. The previous API just returned a shared_future<void>, so all we need to do is make it return a shared_future<T>, where T is the type of value that the operation returns.
Making this work required a little magic, but ultimately it's not too bad. Instead of keeping a shared queue<packaged_task<void()>> we just keep a shared queue<unique_ptr<TaskBase>>, where TaskBase is a class with a pure virtual execute() method, then have a templated derived class that stores a packaged_task<T()>. Everything else works out pretty cleanly.
Differential Revision: https://reviews.llvm.org/D48115
llvm-svn: 334643
show more ...
|
Revision tags: llvmorg-6.0.1-rc2, llvmorg-6.0.1-rc1, llvmorg-5.0.2, llvmorg-5.0.2-rc2, llvmorg-5.0.2-rc1, llvmorg-6.0.0, llvmorg-6.0.0-rc3, llvmorg-6.0.0-rc2, llvmorg-6.0.0-rc1, llvmorg-5.0.1, llvmorg-5.0.1-rc3, llvmorg-5.0.1-rc2, llvmorg-5.0.1-rc1, llvmorg-5.0.0, llvmorg-5.0.0-rc5, llvmorg-5.0.0-rc4, llvmorg-5.0.0-rc3, llvmorg-5.0.0-rc2, llvmorg-5.0.0-rc1, llvmorg-4.0.1, llvmorg-4.0.1-rc3, llvmorg-4.0.1-rc2, llvmorg-4.0.1-rc1, llvmorg-4.0.0, llvmorg-4.0.0-rc4, llvmorg-4.0.0-rc3, llvmorg-4.0.0-rc2, llvmorg-4.0.0-rc1 |
|
#
17d266bc |
| 13-Jan-2017 |
Malcolm Parsons <malcolm.parsons@gmail.com> |
Remove unused lambda captures. NFC
llvm-svn: 291916
|
Revision tags: llvmorg-3.9.1, llvmorg-3.9.1-rc3, llvmorg-3.9.1-rc2, llvmorg-3.9.1-rc1 |
|
#
0f0d5d8f |
| 28-Nov-2016 |
Davide Italiano <davide@freebsd.org> |
[ThreadPool] Rollback recent changes until I figure out the breakage.
llvm-svn: 288018
|
#
3ea0bfa7 |
| 28-Nov-2016 |
Davide Italiano <davide@freebsd.org> |
[ThreadPool] Simplify the interface. NFCI.
The callers don't use the return value. Found by Michael Spencer.
llvm-svn: 288016
|
Revision tags: llvmorg-3.9.0, llvmorg-3.9.0-rc3, llvmorg-3.9.0-rc2 |
|
#
0d955d0b |
| 11-Aug-2016 |
David Majnemer <david.majnemer@gmail.com> |
Use the range variant of find instead of unpacking begin/end
If the result of the find is only used to compare against end(), just use is_contained instead.
No functionality change is intended.
ll
Use the range variant of find instead of unpacking begin/end
If the result of the find is only used to compare against end(), just use is_contained instead.
No functionality change is intended.
llvm-svn: 278433
show more ...
|
Revision tags: llvmorg-3.9.0-rc1 |
|
#
aa77fa00 |
| 05-Jun-2016 |
Eli Friedman <eli.friedman@gmail.com> |
Fix deadlock in ThreadPool unittest.
(Yes, this only deadlocks on a computer with a single core; I'm using a virtual machine.)
llvm-svn: 271855
|
Revision tags: llvmorg-3.8.1, llvmorg-3.8.1-rc1, llvmorg-3.8.0, llvmorg-3.8.0-rc3, llvmorg-3.8.0-rc2, llvmorg-3.8.0-rc1 |
|
#
fa4e4747 |
| 19-Dec-2015 |
Mehdi Amini <mehdi.amini@apple.com> |
ThreadPool unittests: do not hold mutex when calling condition_variable:notify()
From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 256111
|
#
3791e3d7 |
| 19-Dec-2015 |
Vedant Kumar <vsk@apple.com> |
[unittests] ThreadPool: Remove redundant loop, NFC
llvm-svn: 256097
|
#
2cf75338 |
| 19-Dec-2015 |
Vedant Kumar <vsk@apple.com> |
[unittests] ThreadPool: Guard updates to MainThreadReady
llvm-svn: 256096
|
#
0129fca1 |
| 19-Dec-2015 |
Mehdi Amini <mehdi.amini@apple.com> |
ThreadPool unittest: reimplement concurrency test, deterministically this time.
Follow-up to r256056.
From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 256087
|
#
bae92fdb |
| 18-Dec-2015 |
Teresa Johnson <tejohnson@google.com> |
Remove possibility of failures to due race in ThreadPool unittest
Remove all checks that required main thread to run faster than tasks in ThreadPool, and yields which are now unnecessary. This shoul
Remove possibility of failures to due race in ThreadPool unittest
Remove all checks that required main thread to run faster than tasks in ThreadPool, and yields which are now unnecessary. This should fix some bot failures.
llvm-svn: 256056
show more ...
|
#
4b8d75b5 |
| 15-Dec-2015 |
Mehdi Amini <mehdi.amini@apple.com> |
Mark ThreadPool unittests as unsupported on PowerPC64
Bots are crashing unexpectingly, see: https://llvm.org/bugs/show_bug.cgi?id=25829
From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 255633
|
#
942e52c7 |
| 15-Dec-2015 |
Mehdi Amini <mehdi.amini@apple.com> |
ThreadPool unittest: add a rough mechanism to mark UNSUPPORTED on a given platform
From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 255632
|
#
f064d622 |
| 15-Dec-2015 |
Teresa Johnson <tejohnson@google.com> |
Fix template parameter pack handling in ThreadPool
Fixes passing of template parameter pack via std::forward and add unittest.
llvm-svn: 255617
|
#
33a7ea4b |
| 15-Dec-2015 |
Mehdi Amini <mehdi.amini@apple.com> |
Add a C++11 ThreadPool implementation in LLVM
This is a very simple implementation of a thread pool using C++11 thread. It accepts any std::function<void()> for asynchronous execution. Individual ta
Add a C++11 ThreadPool implementation in LLVM
This is a very simple implementation of a thread pool using C++11 thread. It accepts any std::function<void()> for asynchronous execution. Individual task can be synchronize using the returned future, or the client can block on the full queue completion.
In case LLVM is configured with Threading disabled, it falls back to sequential execution using std::async with launch:deferred.
This is intended to support parallelism for ThinLTO processing in linker plugin, but is generic enough for any other uses.
This is a recommit of r255444 ; trying to workaround a bug in the MSVC 2013 standard library. I think I was hit by:
http://connect.microsoft.com/VisualStudio/feedbackdetail/view/791185/std-packaged-task-t-where-t-is-void-or-a-reference-class-are-not-movable
Recommit of r255589, trying to please g++ as well.
Differential Revision: http://reviews.llvm.org/D15464
From: mehdi_amini <mehdi_amini@91177308-0d34-0410-b5e6-96231b3b80d8> llvm-svn: 255593
show more ...
|
#
ef0ef286 |
| 15-Dec-2015 |
Mehdi Amini <mehdi.amini@apple.com> |
Add a C++11 ThreadPool implementation in LLVM
This is a very simple implementation of a thread pool using C++11 thread. It accepts any std::function<void()> for asynchronous execution. Individual ta
Add a C++11 ThreadPool implementation in LLVM
This is a very simple implementation of a thread pool using C++11 thread. It accepts any std::function<void()> for asynchronous execution. Individual task can be synchronize using the returned future, or the client can block on the full queue completion.
In case LLVM is configured with Threading disabled, it falls back to sequential execution using std::async with launch:deferred.
This is intended to support parallelism for ThinLTO processing in linker plugin, but is generic enough for any other uses.
This is a recommit of r255444 ; trying to workaround a bug in the MSVC 2013 standard library. I think I was hit by:
http://connect.microsoft.com/VisualStudio/feedbackdetail/view/791185/std-packaged-task-t-where-t-is-void-or-a-reference-class-are-not-movable
Differential Revision: http://reviews.llvm.org/D15464
From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 255589
show more ...
|
#
396abbb6 |
| 12-Dec-2015 |
Mehdi Amini <mehdi.amini@apple.com> |
Add a C++11 ThreadPool implementation in LLVM
This is a very simple implementation of a thread pool using C++11 thread. It accepts any std::function<void()> for asynchronous execution. Individual ta
Add a C++11 ThreadPool implementation in LLVM
This is a very simple implementation of a thread pool using C++11 thread. It accepts any std::function<void()> for asynchronous execution. Individual task can be synchronize using the returned future, or the client can block on the full queue completion.
In case LLVM is configured with Threading disabled, it falls back to sequential execution using std::async with launch:deferred.
This is intended to support parallelism for ThinLTO processing in linker plugin, but is generic enough for any other uses.
Differential Revision: http://reviews.llvm.org/D15464
From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 255444
show more ...
|