forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing pthreadpool symbol conflict issue. (pytorch#33869)
Summary: Mainly renaming pthread_create of C2, the only one referred internally in NNPACK, that is conflicting, to pthread_create_c2. Removed 2 other conflicting symbols that are not used internally at all. Pointing XNNPACK to original repo instead of the fork. Copy pasted the new interface and implementation to caff2/utils/threadpool, so that for internal builds we compile against this. When threadpool is unified this will be removed. Pull Request resolved: pytorch#33869 Differential Revision: D20140580 Pulled By: kimishpatel fbshipit-source-id: de70df0af9c7d6bc065e85ede0e1c4dd6a9e6be3
- Loading branch information
1 parent
85b1c45
commit 0e52627
Showing
13 changed files
with
1,517 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include <caffe2/utils/threadpool/pthreadpool.h> | ||
#include <caffe2/utils/threadpool/ThreadPoolMobile.h> | ||
#include <caffe2/utils/threadpool/ThreadPoolXNNPACK.h> | ||
#include <memory> | ||
|
||
namespace caffe2 { | ||
|
||
// Will be unified. | ||
pthreadpool_t xnnpack_threadpool() { | ||
// Depending on internal implemenation vs. OSS we will link against pthreadpool_create_xnnpack | ||
// or pthreadpool_create. This is only temporary. It will be unified soon. | ||
#ifdef USE_INTERNAL_THREADPOOL_IMPL | ||
static std::unique_ptr<pthreadpool, decltype(&pthreadpool_destroy_xnnpack)> | ||
threadpool(pthreadpool_create_xnnpack(getDefaultNumThreads()), pthreadpool_destroy_xnnpack); | ||
#else | ||
static std::unique_ptr<pthreadpool, decltype(&pthreadpool_destroy)> | ||
threadpool(pthreadpool_create(getDefaultNumThreads()), pthreadpool_destroy); | ||
#endif | ||
return threadpool.get(); | ||
} | ||
|
||
} // namespace caffe2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#pragma once | ||
// Creating a separate .h/.cc file for creating threadpool for XNNPACK | ||
// to avoid touching existing internal builds. | ||
// When we unify threadpools this should all go away. | ||
namespace caffe2 { | ||
pthreadpool_t xnnpack_threadpool(); | ||
} // namespace caffe2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.