Skip to content

Commit ee0267c

Browse files
committed
Update on "[Executorch][threadpool] Add "private" method to reset num threads in threadpool"
This diff introduces new API to reset threadpool. This will be short-lived features. It is needed atm because we dont have a) a way to use only a subset of threads to distribute work in the threadpool and b) API to create threadpool of custom size and pass such a threadpool to backends like delegtes, cusotm ops, optimized cpu op lib etc. Differential Revision: [D54766070](https://our.internmc.facebook.com/intern/diff/D54766070/) [ghstack-poisoned]
2 parents f872d04 + 6855cca commit ee0267c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

backends/xnnpack/threadpool/threadpool.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ size_t ThreadPool::get_thread_count() const {
4545
}
4646

4747
bool ThreadPool::_unsafe_reset_threadpool(uint32_t new_thread_count) {
48-
// No need to do anything if the count is same
49-
if (new_thread_count == get_thread_count()) {
48+
// No need to do anything if the count is same or 0
49+
if (new_thread_count == get_thread_count() || new_thread_count == 0) {
5050
return true;
5151
}
5252

0 commit comments

Comments
 (0)