Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ci/scripts/test_llama.sh
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ fi
which "${PYTHON_EXECUTABLE}"

cmake_install_executorch_libraries() {
echo "Installing libexecutorch.a, libextension_module.so, libportable_ops_lib.a"
echo "Installing libprim_ops_lib.a, libextension_module.so, libportable_ops_lib.a"
rm -rf cmake-out
retry cmake \
-DCMAKE_INSTALL_PREFIX=cmake-out \
Expand Down
2 changes: 1 addition & 1 deletion .ci/scripts/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ build_executorch_runner() {
}

cmake_install_executorch_lib() {
echo "Installing libexecutorch.a and libportable_kernels.a"
echo "Installing libprim_ops_lib.a and libportable_kernels.a"
clean_executorch_install_folders
retry cmake -DBUCK2="$BUCK" \
-DCMAKE_INSTALL_PREFIX=cmake-out \
Expand Down
25 changes: 9 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ endif()
add_subdirectory(schema)

#
# executorch_core: Minimal runtime library
# executorch_core: Primary runtime library
#
# The bare-minimum runtime library, supporting the Program and Method
# interfaces. Does not contain any operators, including primitive ops. Does not
Expand Down Expand Up @@ -606,19 +606,11 @@ if(EXECUTORCH_BUILD_PYBIND AND APPLE)
endif()

#
# executorch: Primary runtime library with primitive operators.
# prim_ops_lib: primitive operators.
#
# Provides the Program and Method interfaces, along with primitive operators.
# Does not contain portable kernels or other full operators. Does not contain
# any backends.
# Provides primitive operators with registration.
#
add_library(executorch ${_executorch__srcs})
target_link_libraries(executorch PRIVATE executorch_core)
target_include_directories(executorch PUBLIC ${_common_include_directories})
target_compile_definitions(executorch PUBLIC C10_USING_CUSTOM_GENERATED_MACROS)
target_compile_options(executorch PUBLIC ${_common_compile_options})
target_link_options_shared_lib(executorch)

add_subdirectory(kernels/prim_ops)
#
# portable_ops_lib: A library to register core ATen ops using portable kernels,
# see kernels/portable/CMakeLists.txt.
Expand Down Expand Up @@ -660,7 +652,7 @@ install(DIRECTORY extension/kernel_util/ DESTINATION include/executorch/extensi
install(DIRECTORY extension/tensor/ DESTINATION include/executorch/extension/tensor FILES_MATCHING PATTERN "*.h")
install(DIRECTORY extension/threadpool/ DESTINATION include/executorch/extension/threadpool FILES_MATCHING PATTERN "*.h")
install(
TARGETS executorch executorch_core
TARGETS executorch_core prim_ops_lib
DESTINATION lib
INCLUDES
DESTINATION ${_common_include_directories}
Expand Down Expand Up @@ -786,8 +778,9 @@ if(EXECUTORCH_BUILD_PYBIND)
${TORCH_PYTHON_LIBRARY}
bundled_program
etdump
executorch
executorch_core
extension_data_loader
prim_ops_lib
util
torch
)
Expand Down Expand Up @@ -839,7 +832,7 @@ if(EXECUTORCH_BUILD_PYBIND)
target_compile_definitions(util PUBLIC C10_USING_CUSTOM_GENERATED_MACROS)

target_compile_options(util PUBLIC ${_pybind_compile_options})
target_link_libraries(util PRIVATE torch c10 executorch extension_tensor)
target_link_libraries(util PRIVATE torch c10 executorch_core extension_tensor)

# pybind portable_lib
pybind11_add_module(portable_lib SHARED extension/pybindings/pybindings.cpp)
Expand Down Expand Up @@ -878,7 +871,7 @@ endif()

if(EXECUTORCH_BUILD_EXECUTOR_RUNNER)
# Baseline libraries that executor_runner will link against.
set(_executor_runner_libs executorch gflags)
set(_executor_runner_libs executorch_core prim_ops_lib gflags)

if(EXECUTORCH_BUILD_KERNELS_OPTIMIZED)
list(APPEND _executor_runner_libs optimized_native_cpu_ops_lib)
Expand Down
4 changes: 2 additions & 2 deletions backends/apple/coreml/scripts/build_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ cmake "$PROTOBUF_DIR_PATH/cmake" -B"$CMAKE_PROTOBUF_BUILD_DIR_PATH" \
-DCMAKE_MACOSX_BUNDLE=OFF \
-DCMAKE_CXX_STANDARD=17

cmake --build "$CMAKE_PROTOBUF_BUILD_DIR_PATH" -j9 -t libprotobuf-lite
cmake --build "$CMAKE_PROTOBUF_BUILDb_DIR_PATH" -j9 -t libprotobuf-lite

# Copy required libraries
echo "ExecuTorch: Copying libraries"
mkdir "$LIBRARIES_DIR_PATH"
cp -f "$CMAKE_EXECUTORCH_BUILD_DIR_PATH/libexecutorch.a" "$LIBRARIES_DIR_PATH"
cp -f "$CMAKE_EXECUTORCH_BUILD_DIR_PATH/libprim_ops_lib.a" "$LIBRARIES_DIR_PATH"
cp -f "$CMAKE_EXECUTORCH_BUILD_DIR_PATH/libexecutorch_core.a" "$LIBRARIES_DIR_PATH"
cp -f "$CMAKE_PROTOBUF_BUILD_DIR_PATH/libprotobuf-lite.a" "$LIBRARIES_DIR_PATH"

Expand Down
9 changes: 5 additions & 4 deletions backends/cadence/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ if(EXECUTORCH_CADENCE_CPU_RUNNER)
# Find prebuilt libraries. executorch package should contain portable_ops_lib,
# etdump, bundled_program.
find_package(executorch CONFIG REQUIRED)
target_link_options_shared_lib(executorch)
target_link_options_shared_lib(prim_ops_lib)
target_link_options_shared_lib(portable_ops_lib)

target_include_directories(executorch INTERFACE ${_common_include_directories})
target_include_directories(executorch_core INTERFACE ${_common_include_directories})

find_package(
gflags REQUIRED PATHS ${CMAKE_CURRENT_BINARY_DIR}/../../third-party
Expand All @@ -51,7 +51,7 @@ if(EXECUTORCH_CADENCE_CPU_RUNNER)
add_executable(cadence_runner
${EXECUTORCH_ROOT}/examples/devtools/example_runner/example_runner.cpp
)
target_compile_options(executorch INTERFACE -DET_EVENT_TRACER_ENABLED)
target_compile_options(executorch_core INTERFACE -DET_EVENT_TRACER_ENABLED)

target_include_directories(
etdump INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/../../devtools/include
Expand All @@ -65,7 +65,8 @@ if(EXECUTORCH_CADENCE_CPU_RUNNER)

target_link_libraries(
cadence_runner
executorch
executorch_core
prim_ops_lib
gflags
etdump
extension_data_loader
Expand Down
2 changes: 1 addition & 1 deletion backends/cadence/fusion_g3/operators/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ set(_aten_ops__srcs
"${EXECUTORCH_ROOT}/kernels/portable/cpu/pattern/unary_ufunc_realhbbf16_to_floathbf16.cpp"
)
add_library(aten_ops_cadence ${_aten_ops__srcs})
target_link_libraries(aten_ops_cadence PUBLIC executorch)
target_link_libraries(aten_ops_cadence PUBLIC executorch_core)
target_link_libraries(aten_ops_cadence PRIVATE xa_nnlib)

# Let files say "include <executorch/path/to/header.h>".
Expand Down
4 changes: 2 additions & 2 deletions backends/cadence/hifi/operators/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ set(_aten_ops__srcs
"${EXECUTORCH_ROOT}/kernels/portable/cpu/util/delinearize_index.cpp"
)
add_library(aten_ops_cadence ${_aten_ops__srcs})
target_link_libraries(aten_ops_cadence PUBLIC executorch)
target_link_libraries(aten_ops_cadence PUBLIC executorch_core)
target_link_libraries(aten_ops_cadence PRIVATE cadence_kernels)

# Let files say "include <executorch/path/to/header.h>".
Expand All @@ -88,7 +88,7 @@ target_include_directories(
${_common_include_directories}
)

target_link_libraries(custom_ops PUBLIC executorch)
target_link_libraries(custom_ops PUBLIC executorch_core)
target_link_libraries(custom_ops PRIVATE cadence_kernels)

# Generate C++ bindings to register kernels into both PyTorch (for AOT) and
Expand Down
4 changes: 2 additions & 2 deletions backends/cadence/reference/operators/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ set(_aten_ops__srcs
"${EXECUTORCH_ROOT}/kernels/portable/cpu/util/select_copy_util.cpp"
)
add_library(aten_ops_cadence ${_aten_ops__srcs})
target_link_libraries(aten_ops_cadence PUBLIC executorch)
target_link_libraries(aten_ops_cadence PUBLIC executorch_core)
target_link_libraries(aten_ops_cadence PRIVATE cadence_kernels)

# Let files say "include <executorch/path/to/header.h>".
Expand Down Expand Up @@ -98,7 +98,7 @@ target_include_directories(
${_common_include_directories}
)

target_link_libraries(custom_ops PUBLIC executorch)
target_link_libraries(custom_ops PUBLIC executorch_core)
target_link_libraries(custom_ops PRIVATE cadence_kernels)

# Generate C++ bindings to register kernels into both PyTorch (for AOT) and
Expand Down
2 changes: 1 addition & 1 deletion backends/cadence/runtime/executor_main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ set -e
source "$(dirname "${BASH_SOURCE[0]}")/../../.ci/scripts/utils.sh"

cmake_install_executorch_devtools_lib() {
echo "Installing libexecutorch.a, libportable_kernels.a, libetdump.a, libbundled_program.a"
echo "Installing libprim_ops_lib.a, libportable_kernels.a, libetdump.a, libbundled_program.a"
rm -rf cmake-out

retry cmake -DCMAKE_INSTALL_PREFIX=cmake-out \
Expand Down
8 changes: 4 additions & 4 deletions backends/openvino/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ target_link_options_shared_lib(openvino_backend)

if(EXECUTORCH_BUILD_OPENVINO_EXECUTOR_RUNNER)
# Build executor runner binary for openvino backend
list(APPEND openvino_executor_runner_libs openvino_backend executorch)
list(APPEND openvino_executor_runner_libs openvino_backend executorch_core prim_ops_lib)

set(_openvino_executor_runner__srcs
${EXECUTORCH_ROOT}/examples/portable/executor_runner/executor_runner.cpp
${EXECUTORCH_ROOT}/extension/data_loader/file_data_loader.cpp
Expand All @@ -60,9 +60,9 @@ if(EXECUTORCH_BUILD_OPENVINO_EXECUTOR_RUNNER)
${EXECUTORCH_ROOT}/extension/runner_util/inputs_portable.cpp
)
add_executable(openvino_executor_runner ${_openvino_executor_runner__srcs})

list(APPEND openvino_executor_runner_libs)

target_link_libraries(
openvino_executor_runner gflags portable_ops_lib ${openvino_executor_runner_libs}
)
Expand Down
3 changes: 2 additions & 1 deletion backends/qualcomm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
qnn_schema
qnn_manager
qnn_executorch_header
executorch
executorch_core
prim_ops_lib
qcir_utils
extension_tensor
)
Expand Down
2 changes: 1 addition & 1 deletion backends/xnnpack/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ if(EXECUTORCH_BUILD_KERNELS_QUANTIZED)
list(APPEND xnn_executor_runner_libs quantized_ops_lib)
endif()

list(APPEND xnn_executor_runner_libs xnnpack_backend executorch)
list(APPEND xnn_executor_runner_libs xnnpack_backend executorch_core prim_ops_lib)

# ios can only build library but not binary
if(NOT CMAKE_TOOLCHAIN_FILE MATCHES ".*(iOS|ios\.toolchain)\.cmake$")
Expand Down
4 changes: 2 additions & 2 deletions devtools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ add_library(
target_link_libraries(
etdump
PUBLIC etdump_schema flatccrt
PRIVATE executorch
PRIVATE executorch_core
)

add_custom_command(
Expand All @@ -213,7 +213,7 @@ add_library(
bundled_program
${CMAKE_CURRENT_SOURCE_DIR}/bundled_program/bundled_program.cpp
)
target_link_libraries(bundled_program executorch bundled_program_schema)
target_link_libraries(bundled_program executorch_core bundled_program_schema)

set_target_properties(bundled_program PROPERTIES LINKER_LANGUAGE CXX)
target_include_directories(
Expand Down
3 changes: 2 additions & 1 deletion docs/source/tutorial-arm-ethos-u.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ ExecuTorch's CMake build system produces a set of build pieces which are critica

[This](using-executorch-building-from-source.md) document provides a detailed overview of each individual build piece. For running either variant of the `.pte` file, you will need a core set of libraries. Here is a list,

- `libexecutorch.a`
- `libexecutorch_core.a`
- `libprim_ops_lib.a`
- `libportable_kernels.a`
- `libportable_ops_lib.a`

Expand Down
4 changes: 2 additions & 2 deletions docs/source/using-executorch-building-from-source.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ Or alternatively, [install conda on your machine](https://conda.io/projects/cond
ExecuTorch's CMake build system covers the pieces of the runtime that are
likely to be useful to embedded systems users.

- `libexecutorch.a`: The core of the ExecuTorch runtime. Does not contain any
operator/kernel definitions or backend definitions.
- `libexecutorch_core.a`: The core of the ExecuTorch runtime. Does not contain any
- `libprim_ops_lib.a`: The implementations and registration of prim ops.
- `libportable_kernels.a`: The implementations of ATen-compatible operators,
following the signatures in `//kernels/portable/functions.yaml`.
- `libportable_kernels_bindings.a`: Generated code that registers the contents
Expand Down
2 changes: 1 addition & 1 deletion examples/apple/coreml/scripts/build_executor_runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ cp -rf "$COREML_DIR_PATH/runtime/include/" "$INCLUDE_DIR_PATH"
# Copy required libraries
echo "ExecuTorch: Copying libraries"
mkdir "$LIBRARIES_DIR_PATH"
find "$CMAKE_BUILD_DIR_PATH/" -name 'libexecutorch.a' -exec cp -f "{}" "$LIBRARIES_DIR_PATH/libexecutorch.a" \;
find "$CMAKE_BUILD_DIR_PATH/" -name 'libprim_ops_lib.a' -exec cp -f "{}" "$LIBRARIES_DIR_PATH/libprim_ops_lib.a" \;
find "$CMAKE_BUILD_DIR_PATH/" -name 'libexecutorch_core.a' -exec cp -f "{}" "$LIBRARIES_DIR_PATH/libexecutorch_core.a" \;
find "$CMAKE_BUILD_DIR_PATH/" -name 'libprotobuf-lite.a' -exec cp -f "{}" "$LIBRARIES_DIR_PATH/libprotobuf-lite.a" \;
find "$CMAKE_BUILD_DIR_PATH/" -name 'libprotobuf-lited.a' -exec cp -f "{}" "$LIBRARIES_DIR_PATH/libprotobuf-lite.a" \;
Expand Down
8 changes: 4 additions & 4 deletions examples/apple/mps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ set(_common_include_directories ${EXECUTORCH_ROOT}/..)
# Find prebuilt libraries. executorch package should contain portable_ops_lib,
# etdump, bundled_program.
find_package(executorch CONFIG REQUIRED)
target_include_directories(executorch INTERFACE ${_common_include_directories})
target_compile_options(executorch INTERFACE ${_common_compile_options})
target_include_directories(executorch_core INTERFACE ${_common_include_directories})
target_compile_options(executorch_core INTERFACE ${_common_compile_options})

find_package(
gflags REQUIRED PATHS ${CMAKE_CURRENT_BINARY_DIR}/../../../third-party
Expand All @@ -67,7 +67,7 @@ if(NOT CMAKE_TOOLCHAIN_FILE MATCHES ".*(iOS|ios\.toolchain)\.cmake$")
)
gen_operators_lib(
LIB_NAME "mps_portable_ops_lib" KERNEL_LIBS portable_kernels DEPS
executorch
executorch_core
)

set(mps_executor_runner_libs
Expand Down Expand Up @@ -110,7 +110,7 @@ if(NOT CMAKE_TOOLCHAIN_FILE MATCHES ".*(iOS|ios\.toolchain)\.cmake$")
target_link_libraries(
mps_executor_runner
bundled_program
executorch
executorch_core
gflags
etdump
${FLATCC_LIB}
Expand Down
2 changes: 1 addition & 1 deletion examples/apple/mps/test_mps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ set -e
# shellcheck source=/dev/null
source "$(dirname "${BASH_SOURCE[0]}")/../../../.ci/scripts/utils.sh"
cmake_install_executorch_devtools_lib() {
echo "Installing libexecutorch.a, libportable_kernels.a, libetdump.a, libbundled_program.a"
echo "Installing libprim_ops_lib.a, libportable_kernels.a, libetdump.a, libbundled_program.a"
rm -rf cmake-out

retry cmake -DBUCK2="$BUCK" \
Expand Down
6 changes: 3 additions & 3 deletions examples/arm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ set(_common_compile_options -Wno-deprecated-declarations -fPIC)
set(_common_include_directories ${EXECUTORCH_ROOT}/..)

find_package(executorch CONFIG REQUIRED HINTS ${CMAKE_INSTALL_PREFIX})
target_include_directories(executorch INTERFACE ${_common_include_directories})
target_include_directories(executorch_core INTERFACE ${_common_include_directories})

include(${EXECUTORCH_ROOT}/tools/cmake/Utils.cmake)
include(${EXECUTORCH_ROOT}/tools/cmake/Codegen.cmake)
Expand All @@ -55,10 +55,10 @@ generate_bindings_for_kernels(
${EXECUTORCH_ROOT}/kernels/portable/functions.yaml
)
gen_operators_lib(
LIB_NAME "arm_portable_ops_lib" KERNEL_LIBS portable_kernels DEPS executorch
LIB_NAME "arm_portable_ops_lib" KERNEL_LIBS portable_kernels DEPS executorch_core
)

if(EXECUTORCH_ENABLE_EVENT_TRACER)
target_compile_options(executorch INTERFACE -DET_EVENT_TRACER_ENABLED)
target_compile_options(executorch_core INTERFACE -DET_EVENT_TRACER_ENABLED)
target_compile_options(portable_ops_lib INTERFACE -DET_EVENT_TRACER_ENABLED)
endif()
13 changes: 7 additions & 6 deletions examples/arm/executor_runner/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -460,18 +460,18 @@ endif()


# Dependencies from the ExecuTorch build
add_library(executorch STATIC IMPORTED)
add_library(prim_ops_lib STATIC IMPORTED)
set_property(
TARGET executorch PROPERTY IMPORTED_LOCATION
"${ET_BUILD_DIR_PATH}/libexecutorch.a"
TARGET prim_ops_lib PROPERTY IMPORTED_LOCATION
"${ET_BUILD_DIR_PATH}/libprim_ops_lib.a"
)

add_library(executorch_core STATIC IMPORTED)
set_property(
TARGET executorch_core
PROPERTY IMPORTED_LOCATION "${ET_BUILD_DIR_PATH}/libexecutorch_core.a"
)
target_link_libraries(executorch INTERFACE executorch_core)
target_link_libraries(prim_ops_lib INTERFACE executorch_core)

add_library(executorch_delegate_ethos_u STATIC IMPORTED)
set_property(
Expand Down Expand Up @@ -543,13 +543,14 @@ set(arm_executor_runner_link)
list(APPEND arm_executor_runner_link
extension_runner_util
ethosu_target_init
executorch
executorch_core
"-Wl,--whole-archive"
executorch_delegate_ethos_u
quantized_ops_lib
portable_ops_lib
quantized_kernels
portable_kernels
prim_ops_lib
"-Wl,--no-whole-archive"
-Xlinker -Map=arm_executor_runner.map
)
Expand Down Expand Up @@ -643,4 +644,4 @@ if(SEMIHOSTING)
${ETHOS_SDK_PATH}/core_platform/targets/${TARGET_BOARD}/retarget.c
PROPERTIES HEADER_FILE_ONLY TRUE
)
endif()
endif()
2 changes: 1 addition & 1 deletion examples/cadence/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ target_link_options(
)
target_link_libraries(
cadence_executorch_example dsp_mu_polling_libs cadence_ops_lib
extension_runner_util executorch
extension_runner_util executorch_core prim_ops_lib
)

add_custom_command(
Expand Down
Loading
Loading