Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,18 @@ if(EXECUTORCH_BUILD_PTHREADPOOL)
executorch_move_interface_include_directories_to_build_time_only(
pthreadpool_interface
)

if(APPLE)
# Use hidden visibility for pthreadpool on Apple platforms to avoid issues
# with pthreadpool symbols from libtorch_cpu taking precedence over the ones
# from the pthreadpool library statically linked in _portable_lib. The
# pthreadpool public APIs are marked as weak by default on some Apple
# platforms, so setting to hidden visibility works around this by not
# putting the symbol in the indirection table. See
# https://github.com/pytorch/executorch/issues/14321 for more details.
target_compile_options(pthreadpool PRIVATE -fvisibility=hidden)
endif()

install(
TARGETS pthreadpool pthreadpool_interface fxdiv
EXPORT ExecuTorchTargets
Expand Down
2 changes: 2 additions & 0 deletions extension/threadpool/threadpool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ size_t ThreadPool::get_thread_count() const {
}

bool ThreadPool::_unsafe_reset_threadpool(uint32_t new_thread_count) {
ET_LOG(Info, "Resetting threadpool to %u threads.", new_thread_count);

// No need to do anything if the count is same or 0
if (new_thread_count == get_thread_count() || new_thread_count == 0) {
return true;
Expand Down
Loading