File tree Expand file tree Collapse file tree 5 files changed +61
-3
lines changed Expand file tree Collapse file tree 5 files changed +61
-3
lines changed Original file line number Diff line number Diff line change @@ -749,9 +749,9 @@ endif()
749749
750750if (EXECUTORCH_BUILD_PTHREADPOOL
751751 AND EXECUTORCH_BUILD_CPUINFO
752- AND CMAKE_CXX_STANDARD GREATER_EQUAL 14
753752)
754753 add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/threadpool)
754+ add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/parallel)
755755endif ()
756756
757757if (EXECUTORCH_BUILD_PYBIND)
Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ excludes = [
7373deps = [
7474 " executorch" ,
7575 " executorch_core" ,
76+ " extension_parallel" ,
7677 " extension_threadpool" ,
7778 " portable_kernels" ,
7879]
@@ -115,6 +116,7 @@ excludes = [
115116deps = [
116117 " executorch_core" ,
117118 " executorch" ,
119+ " extension_parallel" ,
118120]
119121
120122[targets .optimized_native_cpu_ops ]
@@ -129,6 +131,8 @@ excludes = [
129131deps = [
130132 " executorch_core" ,
131133 " executorch" ,
134+ " extension_parallel" ,
135+ " extension_threadpool" ,
132136 " portable_kernels" ,
133137]
134138# ---------------------------------- core end ----------------------------------
@@ -208,6 +212,19 @@ deps = [
208212 " extension_runner_util" ,
209213]
210214
215+ [targets .extension_parallel ]
216+ buck_targets = [
217+ " //extension/parallel:thread_parallel" ,
218+ ]
219+ filters = [
220+ " .cpp$" ,
221+ ]
222+ deps = [
223+ " executorch" ,
224+ " executorch_core" ,
225+ " extension_threadpool" ,
226+ ]
227+
211228[targets .extension_tensor ]
212229buck_targets = [
213230 " //extension/tensor:tensor" ,
@@ -395,6 +412,7 @@ deps = [
395412 " executorch" ,
396413 " executorch_core" ,
397414 " optimized_kernels" ,
415+ " extension_parallel" ,
398416 " extension_threadpool" ,
399417 " xnnpack_backend" ,
400418]
@@ -431,6 +449,7 @@ deps = [
431449 " executorch_core" ,
432450 " extension_data_loader" ,
433451 " extension_module" ,
452+ " extension_parallel" ,
434453 " portable_kernels" ,
435454 " quantized_kernels" ,
436455 " xnnpack_backend" ,
Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ set(lib_list
6767 portable_ops_lib
6868 extension_module
6969 extension_module_static
70+ extension_parallel
7071 extension_runner_util
7172 extension_tensor
7273 extension_threadpool
@@ -114,3 +115,16 @@ foreach(lib ${lib_list})
114115 list (APPEND EXECUTORCH_LIBRARIES ${lib} )
115116 endif ()
116117endforeach ()
118+
119+ # TODO: investigate use of install(EXPORT) to cleanly handle
120+ # target_compile_options/target_compile_definitions for everything.
121+ if (TARGET extension_parallel)
122+ set_target_properties (
123+ extension_parallel PROPERTIES INTERFACE_LINK_LIBRARIES extension_threadpool
124+ )
125+ endif ()
126+ if (TARGET cpublas)
127+ set_target_properties (
128+ cpublas PROPERTIES INTERFACE_LINK_LIBRARIES extension_parallel
129+ )
130+ endif ()
Original file line number Diff line number Diff line change 1+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2+ # All rights reserved.
3+ #
4+ # This source code is licensed under the BSD-style license found in the
5+ # LICENSE file in the root directory of this source tree.
6+
7+ # Please keep this file formatted by running:
8+ # ~~~
9+ # cmake-format -i CMakeLists.txt
10+ # ~~~
11+
12+ if (NOT (EXECUTORCH_BUILD_PTHREADPOOL AND EXECUTORCH_BUILD_CPUINFO))
13+ message (FATAL_ERROR "extension/parallel requires extension/threadpool" )
14+ endif ()
15+
16+ add_library (extension_parallel thread_parallel.cpp)
17+
18+ target_link_libraries (extension_parallel PUBLIC executorch_core extension_threadpool)
19+ target_compile_options (extension_parallel PUBLIC ${_common_compile_options} )
20+
21+ install (
22+ TARGETS extension_parallel
23+ DESTINATION lib
24+ INCLUDES
25+ DESTINATION ${_common_include_directories} )
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ endif()
4343list (TRANSFORM _optimized_cpublas__srcs PREPEND "${EXECUTORCH_ROOT} /" )
4444add_library (cpublas STATIC ${_optimized_cpublas__srcs} )
4545target_link_libraries (
46- cpublas PRIVATE executorch_core eigen_blas extension_threadpool
46+ cpublas PUBLIC executorch_core eigen_blas extension_parallel extension_threadpool
4747)
4848target_compile_options (cpublas PUBLIC ${_common_compile_options} )
4949
@@ -63,7 +63,7 @@ list(TRANSFORM _optimized_kernels__srcs PREPEND "${EXECUTORCH_ROOT}/")
6363add_library (optimized_kernels ${_optimized_kernels__srcs} )
6464target_include_directories (optimized_kernels PRIVATE ${TORCH_INCLUDE_DIRS} "${EXECUTORCH_ROOT} /third-party/pocketfft" )
6565target_link_libraries (
66- optimized_kernels PRIVATE executorch_core cpublas extension_threadpool
66+ optimized_kernels PUBLIC executorch_core cpublas extension_threadpool
6767)
6868target_compile_options (optimized_kernels PUBLIC ${_common_compile_options} )
6969# Build a library for _optimized_kernels_srcs
You can’t perform that action at this time.
0 commit comments