tvm
Classes | Functions
tvm::runtime::threading Namespace Reference

Classes

class  ThreadGroup
 A platform-agnostic abstraction for managing a collection of thread pool threads. More...
 

Functions

void Yield ()
 Platform-agnostic no-op. More...
 
int MaxConcurrency ()
 
void SetMaxConcurrency (int value)
 Setting the maximum number of available cores. More...
 
void ResetThreadPool ()
 Reset the threads in the pool. All current threads are destroyed and new ones are created. More...
 
void Configure (tvm::runtime::threading::ThreadGroup::AffinityMode mode, int nthreads, std::vector< unsigned int > cpus)
 Configuring the CPU affinity mode for the working threads. More...
 
int32_t NumThreads ()
 Get the number of threads being used by the TVM runtime. More...
 

Function Documentation

◆ Configure()

void tvm::runtime::threading::Configure ( tvm::runtime::threading::ThreadGroup::AffinityMode  mode,
int  nthreads,
std::vector< unsigned int >  cpus 
)

Configuring the CPU affinity mode for the working threads.

Parameters
modeThe preferred CPU type (1 = big, -1 = little, -2 = kSpecifyOneCorePerThread, -3 = kSpecifyThreadShareAllCore).
nthreadsThe number of threads to use (0 = use all).
cpusA list of CPUs is used to set the 'cpu affinity' for the worker threads.
Examples
/workspace/include/tvm/runtime/threading_backend.h.

◆ MaxConcurrency()

int tvm::runtime::threading::MaxConcurrency ( )
Returns
the maximum number of effective workers for this system.
Examples
/workspace/include/tvm/runtime/threading_backend.h.

◆ NumThreads()

int32_t tvm::runtime::threading::NumThreads ( )

Get the number of threads being used by the TVM runtime.

Returns
The number of threads used.
Examples
/workspace/include/tvm/runtime/threading_backend.h.

◆ ResetThreadPool()

void tvm::runtime::threading::ResetThreadPool ( )

Reset the threads in the pool. All current threads are destroyed and new ones are created.

Note that this does nothing when openmp is used.

Examples
/workspace/include/tvm/runtime/threading_backend.h.

◆ SetMaxConcurrency()

void tvm::runtime::threading::SetMaxConcurrency ( int  value)

Setting the maximum number of available cores.

Examples
/workspace/include/tvm/runtime/threading_backend.h.

◆ Yield()

void tvm::runtime::threading::Yield ( )

Platform-agnostic no-op.

Examples
/workspace/include/tvm/runtime/threading_backend.h.