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
34 changes: 16 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# Copyright 2024-2026 Arm Limited and/or its affiliates.
Expand Down Expand Up @@ -546,21 +546,19 @@
endif()

#
# executorch: Primary runtime library with primitive operators.
# executorch_prim_ops: Registers primitive operators (aten::copy, aten::view,
# prim_ops) on top of executorch_core. Does not contain portable kernels,
# full operators, or any backends.
#
# Provides the Program and Method interfaces, along with primitive operators.
# Does not contain portable kernels or other full operators. Does not contain
# any backends.
#
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)
add_library(executorch_prim_ops ${_executorch__srcs})
target_link_libraries(executorch_prim_ops PRIVATE executorch_core)
target_include_directories(executorch_prim_ops PUBLIC ${_common_include_directories})
target_compile_definitions(executorch_prim_ops PUBLIC C10_USING_CUSTOM_GENERATED_MACROS)
if(NOT EXECUTORCH_ENABLE_LOGGING)
target_compile_definitions(executorch PUBLIC ET_LOG_ENABLED=0)
target_compile_definitions(executorch_prim_ops PUBLIC ET_LOG_ENABLED=0)
endif()
target_compile_options(executorch PUBLIC ${_common_compile_options})
executorch_target_link_options_shared_lib(executorch)
target_compile_options(executorch_prim_ops PUBLIC ${_common_compile_options})
executorch_target_link_options_shared_lib(executorch_prim_ops)

#
# portable_ops_lib: A library to register core ATen ops using portable kernels,
Expand Down Expand Up @@ -594,7 +592,7 @@

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/configurations)

# Install `executorch` library as well as `executorch-config.cmake` under
# Install `executorch_prim_ops` library as well as `executorch-config.cmake` under
# ${CMAKE_INSTALL_PREFIX}/
install(
DIRECTORY runtime/core/
Expand Down Expand Up @@ -650,7 +648,7 @@
PATTERN "*.h"
)
install(
TARGETS executorch executorch_core
TARGETS executorch_prim_ops executorch_core
EXPORT ExecuTorchTargets
INCLUDES
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
Expand Down Expand Up @@ -952,7 +950,7 @@
bundled_program
etdump
flatccrt
executorch
executorch_prim_ops
extension_data_loader
util
torch
Expand Down Expand Up @@ -1051,7 +1049,7 @@
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_prim_ops extension_tensor)

# pybind portable_lib
pybind11_add_module(portable_lib SHARED extension/pybindings/pybindings.cpp)
Expand Down Expand Up @@ -1098,7 +1096,7 @@
)
target_include_directories(data_loader PRIVATE ${_common_include_directories})
target_compile_options(data_loader PUBLIC ${_pybind_compile_options})
target_link_libraries(data_loader PRIVATE executorch)
target_link_libraries(data_loader PRIVATE executorch_prim_ops)
install(TARGETS data_loader
LIBRARY DESTINATION executorch/extension/pybindings
)
Expand Down Expand Up @@ -1277,7 +1275,7 @@

if(EXECUTORCH_BUILD_EXECUTOR_RUNNER)
# Baseline libraries that executor_runner will link against.
set(_executor_runner_libs executorch extension_evalue_util
set(_executor_runner_libs executorch_prim_ops extension_evalue_util
extension_runner_util gflags executorch_backends
)

Expand Down
8 changes: 4 additions & 4 deletions backends/cadence/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
Expand Down Expand Up @@ -36,11 +36,11 @@
# Find prebuilt libraries. executorch package should contain portable_ops_lib,
# etdump, bundled_program.
find_package(executorch CONFIG REQUIRED)
executorch_target_link_options_shared_lib(executorch)
executorch_target_link_options_shared_lib(executorch_prim_ops)
executorch_target_link_options_shared_lib(portable_ops_lib)

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

find_package(
Expand All @@ -51,7 +51,7 @@
cadence_runner
${EXECUTORCH_ROOT}/examples/devtools/example_runner/example_runner.cpp
)
target_compile_options(executorch INTERFACE -DET_EVENT_TRACER_ENABLED)
target_compile_options(executorch_prim_ops INTERFACE -DET_EVENT_TRACER_ENABLED)

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

target_link_libraries(
cadence_runner
executorch
executorch_prim_ops
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 @@ -65,7 +65,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_prim_ops)
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/generic/operators/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,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_prim_ops)
target_link_libraries(aten_ops_cadence PRIVATE cadence_kernels)

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

target_link_libraries(custom_ops PUBLIC executorch)
target_link_libraries(custom_ops PUBLIC executorch_prim_ops)
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/hifi/operators/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,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_prim_ops)
target_link_libraries(aten_ops_cadence PRIVATE cadence_kernels)

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

target_link_libraries(custom_ops PUBLIC executorch)
target_link_libraries(custom_ops PUBLIC executorch_prim_ops)
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/vision/operators/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,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_prim_ops)
target_link_libraries(aten_ops_cadence PRIVATE cadence_kernels)

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

target_link_libraries(custom_ops PUBLIC executorch)
target_link_libraries(custom_ops PUBLIC executorch_prim_ops)
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/cortex_m/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# Copyright 2025-2026 Arm Limited and/or its affiliates.
Expand Down Expand Up @@ -84,7 +84,7 @@
target_link_libraries(
cortex_m_kernels
PRIVATE cmsis-nn
PRIVATE executorch
PRIVATE executorch_prim_ops
PRIVATE kernels_util_all_deps
)

Expand All @@ -96,7 +96,7 @@

# cortex_m_ops_lib: Register Cortex-M ops kernels into Executorch runtime
gen_operators_lib(
LIB_NAME "cortex_m_ops_lib" KERNEL_LIBS cortex_m_kernels DEPS executorch
LIB_NAME "cortex_m_ops_lib" KERNEL_LIBS cortex_m_kernels DEPS executorch_prim_ops
)

install(
Expand Down
2 changes: 1 addition & 1 deletion backends/mlx/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if(EXECUTORCH_MLX_ENABLE_SANITIZERS)
endif()

target_link_libraries(
op_test_runner PRIVATE extension_module extension_tensor executorch
op_test_runner PRIVATE extension_module extension_tensor executorch_prim_ops
mlxdelegate
)

Expand Down
2 changes: 1 addition & 1 deletion backends/qualcomm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
qnn_schema
qnn_manager
qnn_executorch_header
executorch
executorch_prim_ops
extension_tensor
qnn_backend_options
wrappers
Expand Down
2 changes: 1 addition & 1 deletion backends/samsung/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ if(${ANDROID})
PRIVATE enn_logging
enn_backend
gflags
executorch
executorch_prim_ops
extension_data_loader
portable_ops_lib
android
Expand Down
2 changes: 1 addition & 1 deletion devtools/bundled_program/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ add_library(
bundled_program ${_schema_outputs}
${CMAKE_CURRENT_SOURCE_DIR}/bundled_program.cpp
)
target_link_libraries(bundled_program PUBLIC executorch)
target_link_libraries(bundled_program PUBLIC executorch_prim_ops)
target_include_directories(
bundled_program
PUBLIC
Expand Down
2 changes: 1 addition & 1 deletion devtools/etdump/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ add_library(
target_link_libraries(
etdump
PUBLIC flatccrt
PRIVATE executorch
PRIVATE executorch_prim_ops
)
target_include_directories(
etdump
Expand Down
8 changes: 4 additions & 4 deletions examples/apple/mps/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#
# Copyright (c) 2023 Apple Inc. All rights reserved.
# Provided subject to the LICENSE file in the top level directory.
Expand Down Expand Up @@ -43,8 +43,8 @@
# 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_prim_ops INTERFACE ${_common_include_directories})
target_compile_options(executorch_prim_ops INTERFACE ${_common_compile_options})

find_package(
gflags REQUIRED PATHS ${CMAKE_CURRENT_BINARY_DIR}/../../../third-party
Expand All @@ -67,7 +67,7 @@
)
gen_operators_lib(
LIB_NAME "mps_portable_ops_lib" KERNEL_LIBS portable_kernels DEPS
executorch
executorch_prim_ops
)

set(mps_executor_runner_libs
Expand Down Expand Up @@ -98,7 +98,7 @@
target_link_libraries(
mps_executor_runner
bundled_program
executorch
executorch_prim_ops
extension_evalue_util
extension_runner_util
gflags
Expand Down
4 changes: 2 additions & 2 deletions examples/arm/executor_runner/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ list(
arm_executor_runner_link
extension_runner_util
ethosu_target_init
executorch
executorch_prim_ops
quantized_ops_lib
cortex_m_ops_lib
executorch_delegate_ethos_u
Expand Down Expand Up @@ -319,7 +319,7 @@ if(NOT ("${EXECUTORCH_SELECT_OPS_LIST}" STREQUAL ""
KERNEL_LIBS
portable_kernels
DEPS
executorch
executorch_prim_ops
DTYPE_SELECTIVE_BUILD
"${EXECUTORCH_ENABLE_DTYPE_SELECTIVE_BUILD}"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ target_sources(

target_link_libraries(
img_class_example
PUBLIC executorch
PUBLIC executorch_prim_ops
ethosu_target_init
extension_runner_util
quantized_ops_lib
Expand Down
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_prim_ops
)

add_custom_command(
Expand Down
8 changes: 4 additions & 4 deletions examples/devtools/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# Copyright 2025 Arm Limited and/or its affiliates.
Expand Down Expand Up @@ -39,18 +39,18 @@
# Find prebuilt libraries. executorch package should contain portable_ops_lib,
# etdump, bundled_program.
find_package(executorch CONFIG REQUIRED)
executorch_target_link_options_shared_lib(executorch)
executorch_target_link_options_shared_lib(executorch_prim_ops)
executorch_target_link_options_shared_lib(portable_ops_lib)

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

find_package(
gflags REQUIRED PATHS ${CMAKE_CURRENT_BINARY_DIR}/../../third-party
)

add_executable(example_runner example_runner/example_runner.cpp)
target_compile_options(
executorch INTERFACE -DET_EVENT_TRACER_ENABLED -DET_BUNDLE_IO_ENABLED
executorch_prim_ops INTERFACE -DET_EVENT_TRACER_ENABLED -DET_BUNDLE_IO_ENABLED
)

target_include_directories(
Expand All @@ -59,7 +59,7 @@
)
target_link_libraries(
example_runner
executorch
executorch_prim_ops
gflags
etdump
extension_data_loader
Expand Down
2 changes: 1 addition & 1 deletion examples/llm_manual/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ add_subdirectory(
add_executable(nanogpt_runner main.cpp)
target_link_libraries(
nanogpt_runner
PRIVATE executorch
PRIVATE executorch_prim_ops
extension_module_static # Provides the Module class
extension_tensor # Provides the TensorPtr class
optimized_native_cpu_ops_lib # Provides baseline cross-platform
Expand Down
6 changes: 3 additions & 3 deletions examples/mediatek/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ executorch_load_build_variables()
# Find prebuilt libraries. executorch package should contain portable_ops_lib,
# etdump, bundled_program.
find_package(executorch CONFIG REQUIRED)
target_compile_options(executorch INTERFACE -DET_EVENT_TRACER_ENABLED)
target_compile_options(executorch_prim_ops INTERFACE -DET_EVENT_TRACER_ENABLED)
find_package(gflags REQUIRED)

link_directories(${EXECUTORCH_ROOT}/cmake-android-out/lib)
Expand Down Expand Up @@ -72,7 +72,7 @@ if(${ANDROID})
target_link_libraries(
mtk_executor_runner
${_executor_runner_libs}
executorch
executorch_prim_ops
neuron_backend
executorch_core
extension_evalue_util
Expand Down Expand Up @@ -103,7 +103,7 @@ if(${ANDROID})

target_link_libraries(
mtk_oss_executor_runner ${_executor_runner_libs} extension_module
executorch neuron_backend gflags
executorch_prim_ops neuron_backend gflags
)
target_compile_options(
mtk_oss_executor_runner PUBLIC ${_common_compile_options}
Expand Down
6 changes: 3 additions & 3 deletions examples/models/dinov2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ find_package(gflags REQUIRED)
# Find executorch libraries
list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../..)
find_package(executorch CONFIG REQUIRED FIND_ROOT_PATH_BOTH)
get_target_property(_executorch_imported executorch IMPORTED)
get_target_property(_executorch_imported executorch_prim_ops IMPORTED)
if(NOT _executorch_imported)
executorch_target_link_options_shared_lib(executorch)
executorch_target_link_options_shared_lib(executorch_prim_ops)
endif()

set(link_libraries executorch gflags)
set(link_libraries executorch_prim_ops gflags)

# Common ops
if(TARGET optimized_native_cpu_ops_lib)
Expand Down
Loading
Loading