Skip to content

Commit 89ebeb0

Browse files
authored
Move threadpool to extension
Differential Revision: D61938189 Pull Request resolved: #4954
1 parent 1ae997c commit 89ebeb0

28 files changed

+36
-34
lines changed

backends/xnnpack/runtime/XNNCompiler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <executorch/backends/xnnpack/runtime/XNNCompiler.h>
1010
#include <executorch/backends/xnnpack/runtime/XNNHeader.h>
1111
#include <executorch/backends/xnnpack/serialization/schema_generated.h>
12-
#include <executorch/backends/xnnpack/threadpool/threadpool.h>
12+
#include <executorch/extension/threadpool/threadpool.h>
1313
#include <executorch/runtime/core/exec_aten/util/scalar_type_util.h>
1414
#include <unordered_map>
1515

backends/xnnpack/targets.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def define_common_targets():
4747
deps = [
4848
third_party_dep("XNNPACK"),
4949
"//executorch/backends/xnnpack/serialization:xnnpack_flatbuffer_header",
50-
"//executorch/backends/xnnpack/threadpool:threadpool",
50+
"//executorch/extension/threadpool:threadpool",
5151
"//executorch/runtime/core/exec_aten/util:tensor_util",
5252
],
5353
# XnnpackBackend.cpp needs to compile with executor as whole

backends/xnnpack/test/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ include(${EXECUTORCH_ROOT}/build/Test.cmake)
2323

2424
set(_test_srcs # We can't put runtime/test_runtime_utils.cpp because we don't
2525
# build aten
26-
runtime/test_xnnexecutor.cpp ../threadpool/threadpool.cpp
27-
../threadpool/threadpool_guard.cpp ../threadpool/test/threadpool_test.cpp
26+
runtime/test_xnnexecutor.cpp
27+
${EXECUTORCH_ROOT}/extension/threadpool/threadpool.cpp
28+
${EXECUTORCH_ROOT}/extension/threadpool/threadpool_guard.cpp
29+
${EXECUTORCH_ROOT}/extension/threadpool/test/threadpool_test.cpp
2830
)
2931

3032
et_cxx_test(

configurations/targets.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def define_common_targets():
2020
runtime.cxx_library(
2121
name = "executor_cpu_optimized",
2222
exported_deps = [
23-
"//executorch/backends/xnnpack/threadpool:threadpool",
23+
"//executorch/extension/threadpool:threadpool",
2424
] + get_all_cpu_backend_targets(),
2525
visibility = [
2626
"//executorch/test/...",

examples/models/llama2/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ if(EXECUTORCH_BUILD_PTHREADPOOL)
147147
list(APPEND link_libraries pthreadpool)
148148
# These 2 source files are included in xnnpack_backend
149149
if(NOT TARGET xnnpack_backend)
150-
list(APPEND _srcs ${XNNPACK_ROOT}/threadpool/threadpool.cpp
151-
${XNNPACK_ROOT}/threadpool/threadpool_guard.cpp
150+
list(APPEND _srcs ${EXECUTORCH_ROOT}/extension/threadpool/threadpool.cpp
151+
${EXECUTORCH_ROOT}/extension/threadpool/threadpool_guard.cpp
152152
)
153153
endif()
154154
list(APPEND _common_include_directories
@@ -159,7 +159,7 @@ endif()
159159
# Extra sources for cpuinfo
160160
if(EXECUTORCH_BUILD_CPUINFO)
161161
list(APPEND link_libraries cpuinfo)
162-
list(APPEND _srcs ${XNNPACK_ROOT}/threadpool/cpuinfo_utils.cpp)
162+
list(APPEND _srcs ${EXECUTORCH_ROOT}/extension/threadpool/cpuinfo_utils.cpp)
163163
list(APPEND _common_include_directories
164164
${XNNPACK_ROOT}/third-party/cpuinfo/include
165165
)

examples/models/llama2/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
#include <executorch/examples/models/llama2/runner/runner.h>
1212

1313
#if defined(ET_USE_THREADPOOL)
14-
#include <executorch/backends/xnnpack/threadpool/cpuinfo_utils.h>
15-
#include <executorch/backends/xnnpack/threadpool/threadpool.h>
14+
#include <executorch/extension/threadpool/cpuinfo_utils.h>
15+
#include <executorch/extension/threadpool/threadpool.h>
1616
#endif
1717

1818
DEFINE_string(

examples/models/llama2/targets.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ def define_common_targets():
1717
deps = [
1818
"//executorch/examples/models/llama2/runner:runner" + aten_suffix,
1919
"//executorch/extension/evalue_util:print_evalue",
20-
"//executorch/backends/xnnpack/threadpool:threadpool",
21-
"//executorch/backends/xnnpack/threadpool:cpuinfo_utils",
20+
"//executorch/extension/threadpool:threadpool",
21+
"//executorch/extension/threadpool:cpuinfo_utils",
2222
],
2323
external_deps = [
2424
"gflags",

examples/models/llava/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ if(EXECUTORCH_BUILD_PTHREADPOOL)
130130
list(APPEND link_libraries pthreadpool)
131131
# These 2 source files are included in xnnpack_backend
132132
if(NOT TARGET xnnpack_backend)
133-
list(APPEND _srcs ${XNNPACK_ROOT}/threadpool/threadpool.cpp
134-
${XNNPACK_ROOT}/threadpool/threadpool_guard.cpp
133+
list(APPEND _srcs ${EXECUTORCH_ROOT}/extension/threadpool/threadpool.cpp
134+
${EXECUTORCH_ROOT}/extension/threadpool/threadpool_guard.cpp
135135
)
136136
endif()
137137
list(APPEND _common_include_directories
@@ -142,7 +142,7 @@ endif()
142142
# Extra sources for cpuinfo
143143
if(EXECUTORCH_BUILD_CPUINFO)
144144
list(APPEND link_libraries cpuinfo)
145-
list(APPEND _srcs ${XNNPACK_ROOT}/threadpool/cpuinfo_utils.cpp)
145+
list(APPEND _srcs ${EXECUTORCH_ROOT}/extension/threadpool/cpuinfo_utils.cpp)
146146
list(APPEND _common_include_directories
147147
${XNNPACK_ROOT}/third-party/cpuinfo/include
148148
)

examples/models/llava/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
#include <torch/torch.h>
1212

1313
#if defined(ET_USE_THREADPOOL)
14-
#include <executorch/backends/xnnpack/threadpool/cpuinfo_utils.h>
15-
#include <executorch/backends/xnnpack/threadpool/threadpool.h>
14+
#include <executorch/extension/threadpool/cpuinfo_utils.h>
15+
#include <executorch/extension/threadpool/threadpool.h>
1616
#endif
1717

1818
DEFINE_string(

extension/android/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ if(EXECUTORCH_BUILD_LLAMA_JNI)
9595

9696
if(TARGET pthreadpool)
9797
set(LLAMA_JNI_SRCS jni/jni_layer_llama.cpp
98-
../../backends/xnnpack/threadpool/cpuinfo_utils.cpp
98+
../../extension/threadpool/cpuinfo_utils.cpp
9999
)
100100
else()
101101
set(LLAMA_JNI_SRCS jni/jni_layer_llama.cpp)

extension/android/jni/jni_layer_llama.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
#include <executorch/runtime/platform/runtime.h>
2424

2525
#if defined(ET_USE_THREADPOOL)
26-
#include <executorch/backends/xnnpack/threadpool/cpuinfo_utils.h>
27-
#include <executorch/backends/xnnpack/threadpool/threadpool.h>
26+
#include <executorch/extension/threadpool/cpuinfo_utils.h>
27+
#include <executorch/extension/threadpool/threadpool.h>
2828
#endif
2929

3030
#include <fbjni/ByteBuffer.h>

extension/llm/custom_ops/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ if(NOT EXECUTORCH_BUILD_XNNPACK)
5353
list(
5454
APPEND
5555
_custom_ops__srcs
56-
"${CMAKE_CURRENT_SOURCE_DIR}/../../../backends/xnnpack/threadpool/threadpool.cpp"
57-
"${CMAKE_CURRENT_SOURCE_DIR}/../../../backends/xnnpack/threadpool/threadpool_guard.cpp"
56+
"${CMAKE_CURRENT_SOURCE_DIR}/../../../extension/threadpool/threadpool.cpp"
57+
"${CMAKE_CURRENT_SOURCE_DIR}/../../../extension/threadpool/threadpool_guard.cpp"
5858
)
5959
else()
6060
list(APPEND custom_ops_libs xnnpack_backend)

extension/llm/custom_ops/op_sdpa.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
#include <vector>
2121

2222
#ifdef ET_USE_THREADPOOL
23-
#include <executorch/backends/xnnpack/threadpool/threadpool.h>
2423
#include <executorch/extension/parallel/thread_parallel.h>
24+
#include <executorch/extension/threadpool/threadpool.h>
2525
#endif
2626
#include <executorch/extension/kernel_util/make_boxed_from_unboxed_functor.h>
2727

extension/llm/custom_ops/targets.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def define_common_targets():
1717
"//executorch/kernels/optimized:libvec",
1818
"//executorch/extension/kernel_util:kernel_util",
1919
"//executorch/extension/parallel:thread_parallel",
20-
"//executorch/backends/xnnpack/threadpool:threadpool",
20+
"//executorch/extension/threadpool:threadpool",
2121
],
2222
compiler_flags = ["-Wno-missing-prototypes", "-Wno-global-constructors"],
2323
visibility = [

extension/parallel/targets.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def define_common_targets():
2323
"@EXECUTORCH_CLIENTS",
2424
],
2525
deps = [
26-
"//executorch/backends/xnnpack/threadpool:threadpool",
26+
"//executorch/extension/threadpool:threadpool",
2727
"//executorch/runtime/core:core",
2828
"//executorch/runtime/core/exec_aten/util:tensor_util" + aten_suffix,
2929
],

extension/parallel/test/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ include(${EXECUTORCH_ROOT}/build/Test.cmake)
2323

2424
set(_test_srcs
2525
thread_parallel_test.cpp ../thread_parallel.cpp
26-
${EXECUTORCH_ROOT}/backends/xnnpack/threadpool/threadpool.cpp
27-
${EXECUTORCH_ROOT}/backends/xnnpack/threadpool/threadpool_guard.cpp
26+
${EXECUTORCH_ROOT}/extension/threadpool/threadpool.cpp
27+
${EXECUTORCH_ROOT}/extension/threadpool/threadpool_guard.cpp
2828
)
2929

3030
et_cxx_test(

extension/parallel/thread_parallel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
#include <tuple>
1010

11-
#include <executorch/backends/xnnpack/threadpool/threadpool.h>
1211
#include <executorch/extension/parallel/thread_parallel.h>
12+
#include <executorch/extension/threadpool/threadpool.h>
1313
#include <executorch/runtime/core/exec_aten/util/tensor_util.h>
1414
#include <executorch/runtime/platform/assert.h>
1515

File renamed without changes.

backends/xnnpack/threadpool/test/targets.bzl renamed to extension/threadpool/test/targets.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ def define_common_targets():
1515
name = "threadpool_test",
1616
srcs = _THREADPOOL_TESTS,
1717
deps = [
18-
"//executorch/backends/xnnpack/threadpool:threadpool",
18+
"//executorch/extension/threadpool:threadpool",
1919
],
2020
)

backends/xnnpack/threadpool/test/threadpool_test.cpp renamed to extension/threadpool/test/threadpool_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
#include <numeric>
1212
#include <random>
1313

14-
#include <executorch/backends/xnnpack/threadpool/threadpool.h>
15-
#include <executorch/backends/xnnpack/threadpool/threadpool_guard.h>
14+
#include <executorch/extension/threadpool/threadpool.h>
15+
#include <executorch/extension/threadpool/threadpool_guard.h>
1616

1717
using namespace ::testing;
1818

backends/xnnpack/threadpool/threadpool.cpp renamed to extension/threadpool/threadpool.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
#include <executorch/backends/xnnpack/threadpool/threadpool.h>
10-
#include <executorch/backends/xnnpack/threadpool/threadpool_guard.h>
9+
#include <executorch/extension/threadpool/threadpool.h>
10+
#include <executorch/extension/threadpool/threadpool_guard.h>
1111
#include <executorch/runtime/platform/assert.h>
1212
#include <algorithm>
1313

backends/xnnpack/threadpool/threadpool_guard.cpp renamed to extension/threadpool/threadpool_guard.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
#include <executorch/backends/xnnpack/threadpool/threadpool_guard.h>
9+
#include <executorch/extension/threadpool/threadpool_guard.h>
1010

1111
namespace torch {
1212
namespace executorch {

0 commit comments

Comments
 (0)