Skip to content

Commit c51d487

Browse files
committed
[Runtime] Add TVM_DLL to threading backend funcs
This PR adds the TVM_DLL attribute to the functions in `threading_backend.h` to make it work with Windows packaging.
1 parent 4b7d78d commit c51d487

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

include/tvm/runtime/threading_backend.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@ class ThreadGroup {
7676
* `worker_callback` will only be called for values >= 1. This
7777
* allows use of the main thread as a worker.
7878
*/
79-
ThreadGroup(int num_workers, std::function<void(int)> worker_callback,
80-
bool exclude_worker0 = false);
81-
~ThreadGroup();
79+
TVM_DLL ThreadGroup(int num_workers, std::function<void(int)> worker_callback,
80+
bool exclude_worker0 = false);
81+
TVM_DLL ~ThreadGroup();
8282

8383
/*!
8484
* \brief Blocks until all non-main threads in the pool finish.
8585
*/
86-
void Join();
86+
TVM_DLL void Join();
8787

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

112112
private:
113113
Impl* impl_;
@@ -116,22 +116,22 @@ class ThreadGroup {
116116
/*!
117117
* \brief Platform-agnostic no-op.
118118
*/
119-
void Yield();
119+
TVM_DLL void Yield();
120120
/*!
121121
* \return the maximum number of effective workers for this system.
122122
*/
123-
int MaxConcurrency();
123+
TVM_DLL int MaxConcurrency();
124124
/*!
125125
* \brief Setting the maximum number of available cores.
126126
*/
127-
void SetMaxConcurrency(int value);
127+
TVM_DLL void SetMaxConcurrency(int value);
128128
/*!
129129
* \brief Reset the threads in the pool. All current threads are destroyed and
130130
* new ones are created.
131131
*
132132
* Note that this does nothing when openmp is used.
133133
*/
134-
void ResetThreadPool();
134+
TVM_DLL void ResetThreadPool();
135135

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

152152
} // namespace threading
153153

0 commit comments

Comments
 (0)