Skip to content

Link xnn_executor_runner with optimized op library #8901

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Mar 4, 2025
32 changes: 19 additions & 13 deletions backends/xnnpack/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ if(NOT PYTHON_EXECUTABLE)
resolve_python_executable()
endif()

# NB: Enabling this will serialize execution of delegate instances
# Keeping this OFF by default to maintain existing behavior, to be revisited.
# NB: Enabling this will serialize execution of delegate instances Keeping this
# OFF by default to maintain existing behavior, to be revisited.
option(EXECUTORCH_XNNPACK_SHARED_WORKSPACE
"Enable workspace sharing across different delegate instances" ON)
# Keeping this OFF by default due to regressions in decode
# and model load with kleidi kernels
option(EXECUTORCH_XNNPACK_ENABLE_KLEIDI
"Enable Arm Kleidi kernels" OFF)
"Enable workspace sharing across different delegate instances" ON
)
# Keeping this OFF by default due to regressions in decode and model load with
# kleidi kernels
option(EXECUTORCH_XNNPACK_ENABLE_KLEIDI "Enable Arm Kleidi kernels" OFF)
if(EXECUTORCH_XNNPACK_SHARED_WORKSPACE)
add_definitions(-DENABLE_XNNPACK_SHARED_WORKSPACE)
endif()
Expand Down Expand Up @@ -100,8 +100,7 @@ include(cmake/Dependencies.cmake)
list(TRANSFORM _xnnpack_backend__srcs PREPEND "${EXECUTORCH_ROOT}/")
add_library(xnnpack_backend STATIC ${_xnnpack_backend__srcs})
target_link_libraries(
xnnpack_backend PRIVATE ${xnnpack_third_party} executorch_core
xnnpack_schema
xnnpack_backend PRIVATE ${xnnpack_third_party} executorch_core xnnpack_schema
)

target_include_directories(
Expand All @@ -119,6 +118,12 @@ target_include_directories(
target_compile_options(xnnpack_backend PUBLIC ${_common_compile_options})
target_link_options_shared_lib(xnnpack_backend)

if(EXECUTORCH_BUILD_KERNELS_OPTIMIZED)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed build when XNNPACK is on but optimized lib is off. everything else (except corresponding change to line 149 below) is just cmake-format.

list(APPEND xnn_executor_runner_libs optimized_native_cpu_ops_lib)
else()
list(APPEND xnn_executor_runner_libs portable_ops_lib)
endif()

list(APPEND xnn_executor_runner_libs xnnpack_backend executorch)

# ios can only build library but not binary
Expand All @@ -134,13 +139,14 @@ if(NOT CMAKE_TOOLCHAIN_FILE MATCHES ".*(iOS|ios\.toolchain)\.cmake$")
if(EXECUTORCH_BUILD_DEVTOOLS)
list(APPEND xnn_executor_runner_libs etdump)
else()
message(SEND_ERROR "Use of 'EXECUTORCH_ENABLE_EVENT_TRACER' requires 'EXECUTORCH_BUILD_DEVTOOLS' to be enabled.")
message(
SEND_ERROR
"Use of 'EXECUTORCH_ENABLE_EVENT_TRACER' requires 'EXECUTORCH_BUILD_DEVTOOLS' to be enabled."
)
endif()
endif()

target_link_libraries(
xnn_executor_runner gflags portable_ops_lib ${xnn_executor_runner_libs}
)
target_link_libraries(xnn_executor_runner gflags ${xnn_executor_runner_libs})
target_compile_options(xnn_executor_runner PUBLIC ${_common_compile_options})
endif()

Expand Down
Loading