Skip to content

Commit 2b5fd9f

Browse files
kirklandsignfacebook-github-bot
authored andcommitted
Move threadpool to extension
Summary: 1. Replace `executorch/backends/xnnpack/threadpool` with `executorch/extension/threadpool` Need to exclude `whatsapp/` 2. `hg mv xplat/executorch/backends/xnnpack/threadpool xplat/executorch/extension` and `hg mv fbcode/executorch/backends/xnnpack/threadpool fbcode/executorch/extension` Differential Revision: D61938189
1 parent a5157de commit 2b5fd9f

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
@@ -131,8 +131,8 @@ if(EXECUTORCH_BUILD_PTHREADPOOL)
131131
list(APPEND link_libraries pthreadpool)
132132
# These 2 source files are included in xnnpack_backend
133133
if(NOT TARGET xnnpack_backend)
134-
list(APPEND _srcs ${XNNPACK_ROOT}/threadpool/threadpool.cpp
135-
${XNNPACK_ROOT}/threadpool/threadpool_guard.cpp
134+
list(APPEND _srcs ${EXECUTORCH_ROOT}/extension/threadpool/threadpool.cpp
135+
${EXECUTORCH_ROOT}/extension/threadpool/threadpool_guard.cpp
136136
)
137137
endif()
138138
list(APPEND _common_include_directories
@@ -143,7 +143,7 @@ endif()
143143
# Extra sources for cpuinfo
144144
if(EXECUTORCH_BUILD_CPUINFO)
145145
list(APPEND link_libraries cpuinfo)
146-
list(APPEND _srcs ${XNNPACK_ROOT}/threadpool/cpuinfo_utils.cpp)
146+
list(APPEND _srcs ${EXECUTORCH_ROOT}/extension/threadpool/cpuinfo_utils.cpp)
147147
list(APPEND _common_include_directories
148148
${XNNPACK_ROOT}/third-party/cpuinfo/include
149149
)

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,7 +20,7 @@
2020
#include <vector>
2121

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

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,7 +8,7 @@
88

99
#include <tuple>
1010

11-
#include <executorch/backends/xnnpack/threadpool/threadpool.h>
11+
#include <executorch/extension/threadpool/threadpool.h>
1212
#include <executorch/extension/parallel/thread_parallel.h>
1313
#include <executorch/runtime/core/exec_aten/util/tensor_util.h>
1414
#include <executorch/runtime/platform/assert.h>
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)