Skip to content

Commit 52f9e03

Browse files
zonglinpengfacebook-github-bot
authored andcommitted
build cadence hifi flow as a stand-alone cmake dependency (#5551)
Summary: Pull Request resolved: #5551 This PR enables - stand-alone build of xtensa hifi kernels and runtime flow by build_cadence_xtensa.sh - ported new slice-utils for slice op - updated the xtensa build bash instruction - removed unused hifi kernel header Next pr will enable - stand-alone build of cpu reference kernels and runtime flow by build_cadence_runner.sh Reviewed By: hsharma35, mcremon-meta Differential Revision: D63281705 fbshipit-source-id: b01914c6d147e87aca45f8158c87fa703187fd9e
1 parent b9dadee commit 52f9e03

File tree

5 files changed

+14
-55
lines changed

5 files changed

+14
-55
lines changed

backends/cadence/CMakeLists.txt

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ if(NOT EXECUTORCH_ROOT)
2020
endif()
2121

2222
include(${EXECUTORCH_ROOT}/build/Utils.cmake)
23-
include(${EXECUTORCH_ROOT}/build/Codegen.cmake)
2423

2524
# Let files say "include <executorch/path/to/header.h>".
2625
set(_common_include_directories ${EXECUTORCH_ROOT}/..)
@@ -30,54 +29,6 @@ if(EXECUTORCH_NNLIB_OPT)
3029
set(TARGET_DIR hifi)
3130
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_DIR}/third-party/nnlib)
3231
endif()
33-
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
34-
35-
# Source root directory for executorch.
36-
if(NOT EXECUTORCH_ROOT)
37-
set(EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..)
38-
endif()
39-
40-
if(NOT PYTHON_EXECUTABLE)
41-
resolve_python_executable()
42-
endif()
43-
44-
set(_common_compile_options -Wno-deprecated-declarations -fPIC)
45-
46-
# Find prebuilt libraries. executorch package should contain portable_ops_lib,
47-
# etdump, bundled_program.
48-
find_package(executorch CONFIG REQUIRED)
49-
target_link_options_shared_lib(executorch)
50-
target_link_options_shared_lib(portable_ops_lib)
51-
52-
target_include_directories(executorch INTERFACE ${_common_include_directories})
53-
54-
find_package(
55-
gflags REQUIRED PATHS ${CMAKE_CURRENT_BINARY_DIR}/../../third-party
56-
)
57-
58-
add_executable(cadence_runner cadence_runner/cadence_runner.cpp)
59-
target_compile_options(executorch INTERFACE -DET_EVENT_TRACER_ENABLED)
6032

6133
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_DIR}/operators)
6234
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_DIR}/kernels)
63-
64-
target_include_directories(
65-
etdump INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/../../sdk/include
66-
${EXECUTORCH_ROOT}/third-party/flatcc/include
67-
)
68-
69-
target_include_directories(
70-
cadence_runner PUBLIC ${ROOT_DIR}/.. ${CMAKE_BINARY_DIR}
71-
${_common_include_directories}
72-
)
73-
74-
target_link_libraries(
75-
cadence_runner
76-
executorch
77-
gflags
78-
etdump
79-
extension_data_loader
80-
bundled_program
81-
cadence_ops_lib
82-
flatccrt
83-
)

backends/cadence/build_cadence_xtensa.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,19 @@ else
6565
-DEXECUTORCH_BUILD_HOST_TARGETS=ON \
6666
-DEXECUTORCH_BUILD_EXECUTOR_RUNNER=ON \
6767
-DEXECUTORCH_BUILD_PTHREADPOOL=OFF \
68-
-DEXECUTORCH_BUILD_CADENCE=OFF \
68+
-DEXECUTORCH_BUILD_CPUINFO=OFF \
69+
-DEXECUTORCH_BUILD_FLATC=OFF \
70+
-DEXECUTORCH_BUILD_CADENCE=ON \
6971
-DFLATC_EXECUTABLE="$(which flatc)" \
72+
-DEXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL=ON \
7073
-DEXECUTORCH_ENABLE_LOGGING=ON \
7174
-DEXECUTORCH_ENABLE_PROGRAM_VERIFICATION=ON \
7275
-DEXECUTORCH_USE_DL=OFF \
7376
-DBUILD_EXECUTORCH_PORTABLE_OPS=ON \
7477
-DEXECUTORCH_BUILD_KERNELS_CUSTOM=OFF \
7578
-DPYTHON_EXECUTABLE=python3 \
7679
-DEXECUTORCH_NNLIB_OPT=ON \
77-
-DEXECUTORCH_BUILD_GFLAGS=ON \
7880
-DHAVE_FNMATCH_H=OFF \
79-
-DEXECUTORCH_ENABLE_EVENT_TRACER=OFF \
80-
-DEXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL=ON \
81-
-DEXECUTORCH_BUILD_CPUINFO=OFF \
8281
-Bcmake-out
8382
cmake --build cmake-out --target install --config Release -j16
8483
fi

backends/cadence/hifi/kernels/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ add_library(
1010
kernels.cpp
1111
${EXECUTORCH_ROOT}/backends/cadence/hifi/third-party/nnlib/matmul_asym8uxasym8u_asym8u.cpp
1212
)
13+
# Let files say "include <executorch/path/to/header.h>".
14+
set(_common_include_directories ${EXECUTORCH_ROOT}/..)
1315

1416
target_include_directories(
1517
cadence_kernels
@@ -19,6 +21,7 @@ target_include_directories(
1921
${EXECUTORCH_ROOT}/backends/cadence/hifi/third-party/nnlib/nnlib-hifi4/xa_nnlib/include/nnlib
2022
${EXECUTORCH_ROOT}/backends/cadence/hifi/third-party/nnlib/nnlib-hifi4/xa_nnlib/include
2123
${EXECUTORCH_ROOT}/backends/cadence/hifi/third-party/nnlib/nnlib-hifi4/xa_nnlib/algo/ndsp/hifi4/include/
24+
${_common_include_directories}
2225
)
2326

2427
target_link_libraries(cadence_kernels PRIVATE xa_nnlib)

backends/cadence/hifi/operators/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ set(_aten_ops__srcs
2828
"${EXECUTORCH_ROOT}/kernels/portable/cpu/util/matmul_ops_util.cpp"
2929
"${EXECUTORCH_ROOT}/kernels/portable/cpu/util/reduce_util.cpp"
3030
"${EXECUTORCH_ROOT}/kernels/portable/cpu/util/repeat_util.cpp"
31+
"${EXECUTORCH_ROOT}/kernels/portable/cpu/util/slice_util.cpp"
3132
"${EXECUTORCH_ROOT}/kernels/portable/cpu/op_add.cpp"
3233
"${EXECUTORCH_ROOT}/kernels/portable/cpu/op_bmm.cpp"
3334
"${EXECUTORCH_ROOT}/kernels/portable/cpu/op_cat.cpp"

backends/cadence/reference/kernels/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,9 @@
77
# lint_cmake: -linelength
88
add_library(cadence_kernels kernels.cpp)
99

10-
target_include_directories(cadence_kernels PUBLIC .)
10+
# Let files say "include <executorch/path/to/header.h>".
11+
set(_common_include_directories ${EXECUTORCH_ROOT}/..)
12+
13+
target_include_directories(cadence_kernels PUBLIC .
14+
${_common_include_directories}
15+
)

0 commit comments

Comments
 (0)