Skip to content

Commit 1c5aa55

Browse files
committed
Consolidating executor runners in CMake - xnnpack
Continuing the process of consolidating the executor runners to top level CMakeLists.txt file. Completing this process for the xnnpack backend. Change also updates the CI tests to not use the generic executor_runner and removes the specific xnn_executor_runner.
1 parent 456ed6a commit 1c5aa55

File tree

3 files changed

+6
-41
lines changed

3 files changed

+6
-41
lines changed

.ci/scripts/test_model.sh

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -111,19 +111,6 @@ test_model() {
111111
run_portable_executor_runner
112112
}
113113

114-
build_cmake_xnn_executor_runner() {
115-
echo "Building xnn_executor_runner"
116-
117-
(rm -rf ${CMAKE_OUTPUT_DIR} \
118-
&& mkdir ${CMAKE_OUTPUT_DIR} \
119-
&& cd ${CMAKE_OUTPUT_DIR} \
120-
&& retry cmake -DCMAKE_BUILD_TYPE=Release \
121-
-DEXECUTORCH_BUILD_XNNPACK=ON \
122-
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" ..)
123-
124-
cmake --build ${CMAKE_OUTPUT_DIR} -j4
125-
}
126-
127114
test_model_with_xnnpack() {
128115
WITH_QUANTIZATION=$1
129116
WITH_DELEGATION=$2
@@ -150,10 +137,10 @@ test_model_with_xnnpack() {
150137
if [[ "${BUILD_TOOL}" == "buck2" ]]; then
151138
buck2 run //examples/xnnpack:xnn_executor_runner -- --model_path "${OUTPUT_MODEL_PATH}"
152139
elif [[ "${BUILD_TOOL}" == "cmake" ]]; then
153-
if [[ ! -f ${CMAKE_OUTPUT_DIR}/backends/xnnpack/xnn_executor_runner ]]; then
154-
build_cmake_xnn_executor_runner
140+
if [[ ! -f ${CMAKE_OUTPUT_DIR}/executor_runner ]]; then
141+
build_cmake_executor_runner
155142
fi
156-
./${CMAKE_OUTPUT_DIR}/backends/xnnpack/xnn_executor_runner --model_path "${OUTPUT_MODEL_PATH}"
143+
./${CMAKE_OUTPUT_DIR}/executor_runner --model_path "${OUTPUT_MODEL_PATH}"
157144
else
158145
echo "Invalid build tool ${BUILD_TOOL}. Only buck2 and cmake are supported atm"
159146
exit 1

backends/openvino/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ target_link_options_shared_lib(openvino_backend)
5151
if(EXECUTORCH_BUILD_OPENVINO_EXECUTOR_RUNNER)
5252
# Build executor runner binary for openvino backend
5353
list(APPEND openvino_executor_runner_libs openvino_backend executorch)
54-
54+
5555
set(_openvino_executor_runner__srcs
5656
${EXECUTORCH_ROOT}/examples/portable/executor_runner/executor_runner.cpp
5757
${EXECUTORCH_ROOT}/extension/data_loader/file_data_loader.cpp
@@ -60,9 +60,9 @@ if(EXECUTORCH_BUILD_OPENVINO_EXECUTOR_RUNNER)
6060
${EXECUTORCH_ROOT}/extension/runner_util/inputs_portable.cpp
6161
)
6262
add_executable(openvino_executor_runner ${_openvino_executor_runner__srcs})
63-
63+
6464
list(APPEND openvino_executor_runner_libs)
65-
65+
6666
target_link_libraries(
6767
openvino_executor_runner gflags portable_ops_lib ${openvino_executor_runner_libs}
6868
)

backends/xnnpack/CMakeLists.txt

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -114,22 +114,6 @@ target_include_directories(
114114
target_compile_options(xnnpack_backend PUBLIC ${_common_compile_options})
115115
target_link_options_shared_lib(xnnpack_backend)
116116

117-
if(EXECUTORCH_BUILD_KERNELS_OPTIMIZED)
118-
list(APPEND xnn_executor_runner_libs optimized_native_cpu_ops_lib)
119-
else()
120-
list(APPEND xnn_executor_runner_libs portable_ops_lib)
121-
endif()
122-
123-
if(EXECUTORCH_BUILD_KERNELS_CUSTOM)
124-
list(APPEND xnn_executor_runner_libs $<LINK_LIBRARY:WHOLE_ARCHIVE,custom_ops>)
125-
endif()
126-
127-
if(EXECUTORCH_BUILD_KERNELS_QUANTIZED)
128-
list(APPEND xnn_executor_runner_libs quantized_ops_lib)
129-
endif()
130-
131-
list(APPEND xnn_executor_runner_libs xnnpack_backend executorch)
132-
133117
# ios can only build library but not binary
134118
if(NOT CMAKE_TOOLCHAIN_FILE MATCHES ".*(iOS|ios\.toolchain)\.cmake$")
135119
#
@@ -139,11 +123,6 @@ if(NOT CMAKE_TOOLCHAIN_FILE MATCHES ".*(iOS|ios\.toolchain)\.cmake$")
139123
list(TRANSFORM _xnn_executor_runner__srcs PREPEND "${EXECUTORCH_ROOT}/")
140124
add_executable(xnn_executor_runner ${_xnn_executor_runner__srcs})
141125

142-
if(EXECUTORCH_ENABLE_EVENT_TRACER)
143-
list(APPEND xnn_executor_runner_libs etdump)
144-
endif()
145-
146-
target_link_libraries(xnn_executor_runner gflags ${xnn_executor_runner_libs})
147126
target_compile_options(xnn_executor_runner PUBLIC ${_common_compile_options})
148127
if(EXECUTORCH_BUILD_PTHREADPOOL)
149128
target_link_libraries(xnn_executor_runner extension_threadpool pthreadpool)
@@ -153,7 +132,6 @@ endif()
153132

154133
install(
155134
TARGETS xnnpack_backend
156-
DESTINATION lib
157135
INCLUDES
158136
DESTINATION ${_common_include_directories}
159137
)

0 commit comments

Comments
 (0)