LLVM 22.0.0git
Public Member Functions | Public Attributes | List of all members
llvm::ThreadPoolStrategy Class Reference

This tells how a thread pool will be used. More...

#include "llvm/Support/Threading.h"

Public Member Functions

  Retrieves the max available threads for the current strategy.
LLVM_ABI void  apply_thread_strategy (unsigned ThreadPoolNum) const
  Assign the current thread to an ideal hardware CPU or NUMA node.
LLVM_ABI std::optional< unsignedcompute_cpu_socket (unsigned ThreadPoolNum) const
  Finds the CPU socket where a thread should go.

Public Attributes

bool  Limit = false
bool  UseJobserver = false
  If true, the thread pool will attempt to coordinate with a GNU Make jobserver, acquiring a job slot before processing a task.

Detailed Description

This tells how a thread pool will be used.

Definition at line 115 of file Threading.h.

Member Function Documentation

◆  apply_thread_strategy()

LLVM_ABI 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()).

References LLVM_ABI.

◆  compute_cpu_socket()

LLVM_ABI 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.

◆  compute_thread_count()

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 42 of file Threading.cpp.

Referenced by llvm::SingleThreadExecutor::SingleThreadExecutor().

Member Data Documentation

◆  Limit

bool llvm::ThreadPoolStrategy::Limit = false

Definition at line 129 of file Threading.h.

Referenced by llvm::optimal_concurrency().

◆  ThreadsRequested

unsigned llvm::ThreadPoolStrategy::ThreadsRequested = 0

Definition at line 121 of file Threading.h.

Referenced by llvm::get_threadpool_strategy(), llvm::hardware_concurrency(), llvm::heavyweight_hardware_concurrency(), llvm::jobserver_concurrency(), and llvm::optimal_concurrency().

◆  UseHyperThreads

bool llvm::ThreadPoolStrategy::UseHyperThreads = true

Definition at line 125 of file Threading.h.

Referenced by llvm::heavyweight_hardware_concurrency().

◆  UseJobserver

bool llvm::ThreadPoolStrategy::UseJobserver = false

If true, the thread pool will attempt to coordinate with a GNU Make jobserver, acquiring a job slot before processing a task.

If no jobserver is found in the environment, this is ignored.

Definition at line 149 of file Threading.h.

Referenced by llvm::jobserver_concurrency().


The documentation for this class was generated from the following files:

Generated on for LLVM by doxygen 1.14.0

AltStyle によって変換されたページ (->オリジナル) /