LLVM 20.0.0git
|
This tells how a thread pool will be used. More...
#include "llvm/Support/Threading.h"
Public Member Functions | |
unsigned | compute_thread_count () const |
Retrieves the max available threads for the current strategy. | |
void | apply_thread_strategy (unsigned ThreadPoolNum) const |
Assign the current thread to an ideal hardware CPU or NUMA node. | |
std::optional< unsigned > | compute_cpu_socket (unsigned ThreadPoolNum) const |
Finds the CPU socket where a thread should go. | |
Public Attributes | |
unsigned | ThreadsRequested = 0 |
bool | UseHyperThreads = true |
bool | Limit = false |
This tells how a thread pool will be used.
Definition at line 116 of file Threading.h.
void llvm::ThreadPoolStrategy::apply_thread_strategy | ( | unsigned | ThreadPoolNum | ) | const |
Assign the current thread to an ideal hardware CPU or NUMA node.
In a multi-socket system, this ensures threads are assigned to all CPU sockets. ThreadPoolNum
represents a number bounded by [0, compute_thread_count()).
std::optional< unsigned > llvm::ThreadPoolStrategy::compute_cpu_socket | ( | unsigned | ThreadPoolNum | ) | const |
Finds the CPU socket where a thread should go.
Returns 'std::nullopt' if the thread shall remain on the actual CPU socket.
unsigned llvm::ThreadPoolStrategy::compute_thread_count | ( | ) | const |
Retrieves the max available threads for the current strategy.
This accounts for affinity masks and takes advantage of all CPU sockets.
Definition at line 41 of file Threading.cpp.
Referenced by llvm::SingleThreadExecutor::SingleThreadExecutor().
bool llvm::ThreadPoolStrategy::Limit = false |
Definition at line 130 of file Threading.h.
Referenced by llvm::optimal_concurrency().
unsigned llvm::ThreadPoolStrategy::ThreadsRequested = 0 |
Definition at line 122 of file Threading.h.
Referenced by llvm::get_threadpool_strategy(), llvm::hardware_concurrency(), llvm::heavyweight_hardware_concurrency(), and llvm::optimal_concurrency().
Definition at line 126 of file Threading.h.
Referenced by llvm::heavyweight_hardware_concurrency().