Skip to content

Commit

Permalink
[Runtime] Add TVM_DLL to threading backend funcs (#16630)
Browse files Browse the repository at this point in the history
This PR adds the TVM_DLL attribute to the functions
in `threading_backend.h` to make it work with Windows
packaging.
  • Loading branch information
MasterJH5574 authored Feb 24, 2024
1 parent 2ca8f31 commit 8194b48
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions include/tvm/runtime/threading_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ class ThreadGroup {
* `worker_callback` will only be called for values >= 1. This
* allows use of the main thread as a worker.
*/
ThreadGroup(int num_workers, std::function<void(int)> worker_callback,
bool exclude_worker0 = false);
~ThreadGroup();
TVM_DLL ThreadGroup(int num_workers, std::function<void(int)> worker_callback,
bool exclude_worker0 = false);
TVM_DLL ~ThreadGroup();

/*!
* \brief Blocks until all non-main threads in the pool finish.
*/
void Join();
TVM_DLL void Join();

enum AffinityMode : int {
kBig = 1,
Expand All @@ -106,8 +106,8 @@ class ThreadGroup {
*
* \return The number of workers to use.
*/
int Configure(AffinityMode mode, int nthreads, bool exclude_worker0,
std::vector<unsigned int> cpus = {});
TVM_DLL int Configure(AffinityMode mode, int nthreads, bool exclude_worker0,
std::vector<unsigned int> cpus = {});

private:
Impl* impl_;
Expand All @@ -116,22 +116,22 @@ class ThreadGroup {
/*!
* \brief Platform-agnostic no-op.
*/
void Yield();
TVM_DLL void Yield();
/*!
* \return the maximum number of effective workers for this system.
*/
int MaxConcurrency();
TVM_DLL int MaxConcurrency();
/*!
* \brief Setting the maximum number of available cores.
*/
void SetMaxConcurrency(int value);
TVM_DLL void SetMaxConcurrency(int value);
/*!
* \brief 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.
*/
void ResetThreadPool();
TVM_DLL void ResetThreadPool();

/*!
* \brief Configuring the CPU affinity mode for the working threads.
Expand All @@ -147,7 +147,7 @@ TVM_DLL void Configure(tvm::runtime::threading::ThreadGroup::AffinityMode mode,
* \brief Get the number of threads being used by the TVM runtime
* \returns The number of threads used.
*/
int32_t NumThreads();
TVM_DLL int32_t NumThreads();

} // namespace threading

Expand Down

0 comments on commit 8194b48

Please sign in to comment.