File tree Expand file tree Collapse file tree 3 files changed +29
-5
lines changed
Expand file tree Collapse file tree 3 files changed +29
-5
lines changed Original file line number Diff line number Diff 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 )
Original file line number Diff line number Diff 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)
9389else ()
Original file line number Diff line number Diff 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+
6683install (
6784 TARGETS portable_kernels portable_ops_lib
6885 DESTINATION lib
You can’t perform that action at this time.
0 commit comments