Skip to content

Commit 9f7f0c1

Browse files
committed
Update
[ghstack-poisoned]
1 parent 956f8a5 commit 9f7f0c1

File tree

3 files changed

+29
-5
lines changed

3 files changed

+29
-5
lines changed

configurations/CMakeLists.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,23 @@ if(EXECUTORCH_BUILD_KERNELS_OPTIMIZED)
4747
message("Generated files ${gen_command_sources}")
4848

4949
# optimized_native_cpu_ops_lib: Register optimized op kernels into the runtime
50+
if(NOT DEFINED EXECUTORCH_HAVE_OPTIMIZED_PORTABLE_KERNELS)
51+
message(FATAL_ERROR "EXECUTORCH_HAVE_OPTIMIZED_PORTABLE_KERNELS was not defined!")
52+
endif()
53+
if(${EXECUTORCH_HAVE_OPTIMIZED_PORTABLE_KERNELS})
54+
if(NOT TARGET optimized_portable_kernels)
55+
message(FATAL_ERROR "optimized_portable_kernels missing")
56+
endif()
57+
set(_optimized_native_cpu_ops_lib_portable_kernels_lib optimized_portable_kernels)
58+
else()
59+
set(_optimized_native_cpu_ops_lib_portable_kernels_lib portable_kernels)
60+
endif()
5061
gen_operators_lib(
5162
LIB_NAME
5263
"optimized_native_cpu_ops_lib"
5364
KERNEL_LIBS
54-
portable_kernels
5565
optimized_kernels
66+
${_optimized_native_cpu_ops_lib_portable_kernels_lib}
5667
DEPS
5768
executorch
5869
)

extension/android/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ if(TARGET optimized_native_cpu_ops_lib)
8484
APPEND
8585
link_libraries
8686
optimized_native_cpu_ops_lib
87-
optimized_kernels
88-
portable_kernels
89-
cpublas
90-
eigen_blas
9187
)
9288
target_link_options_shared_lib(optimized_native_cpu_ops_lib)
9389
else()

kernels/portable/CMakeLists.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,23 @@ gen_operators_lib(
6363
LIB_NAME "portable_ops_lib" KERNEL_LIBS portable_kernels DEPS executorch
6464
)
6565

66+
# Portable kernels support optional parallelization (and, in the
67+
# future, perhaps other performance features). If support is present,
68+
# produce an optimized version.
69+
set(EXECUTORCH_HAVE_OPTIMIZED_PORTABLE_KERNELS EXECUTORCH_BUILD_PTHREADPOOL PARENT_SCOPE)
70+
set(EXECUTORCH_HAVE_OPTIMIZED_PORTABLE_KERNELS EXECUTORCH_BUILD_PTHREADPOOL)
71+
72+
if(${EXECUTORCH_HAVE_OPTIMIZED_PORTABLE_KERNELS})
73+
add_library(optimized_portable_kernels ${_portable_kernels__srcs})
74+
target_link_libraries(optimized_portable_kernels PRIVATE executorch)
75+
target_link_libraries(optimized_portable_kernels PUBLIC extension_threadpool)
76+
target_compile_options(optimized_portable_kernels PUBLIC ${_common_compile_options})
77+
install(
78+
TARGETS optimized_portable_kernels
79+
DESTINATION lib
80+
)
81+
endif()
82+
6683
install(
6784
TARGETS portable_kernels portable_ops_lib
6885
DESTINATION lib

0 commit comments

Comments
 (0)