Skip to content

Rename executorch_no_prim_ops to executorch_core, standarize backend names #5343

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
37 changes: 20 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -456,22 +456,22 @@ endif()
add_subdirectory(schema)

#
# executorch_no_prim_ops: Minimal runtime library
# executorch_core: Minimal runtime library
#
# The bare-minimum runtime library, supporting the Program and Method
# interfaces. Does not contain any operators, including primitive ops. Does not
# contain any backends.
#

# Remove any PAL-definition files from the sources.
list(FILTER _executorch_no_prim_ops__srcs EXCLUDE REGEX
list(FILTER _executorch_core__srcs EXCLUDE REGEX
"runtime/platform/default/[^/]*.cpp$"
)

# Add the source file that maps to the requested default PAL implementation.
if(EXECUTORCH_PAL_DEFAULT MATCHES "^(posix|minimal)$")
message(STATUS "executorch: Using PAL default '${EXECUTORCH_PAL_DEFAULT}'")
list(APPEND _executorch_no_prim_ops__srcs
list(APPEND _executorch_core__srcs
"runtime/platform/default/${EXECUTORCH_PAL_DEFAULT}.cpp"
)
else()
Expand All @@ -481,45 +481,48 @@ else()
)
endif()

add_library(executorch_no_prim_ops ${_executorch_no_prim_ops__srcs})
target_link_libraries(executorch_no_prim_ops PRIVATE program_schema)
add_library(executorch_core ${_executorch_core__srcs})
# Legacy name - deprecated.
add_library(executorch_no_prim_ops ALIAS executorch_core)

target_link_libraries(executorch_core PRIVATE program_schema)
if(EXECUTORCH_USE_DL)
# Check if dl exists for this toolchain and only then link it.
find_library(DL_LIBRARY_EXISTS NAMES dl)
# Check if the library was found
if(DL_LIBRARY_EXISTS)
target_link_libraries(executorch_no_prim_ops PRIVATE dl) # For dladdr()
target_link_libraries(executorch_core PRIVATE dl) # For dladdr()
endif()
endif()
target_include_directories(
executorch_no_prim_ops PUBLIC ${_common_include_directories}
executorch_core PUBLIC ${_common_include_directories}
)
target_compile_options(executorch_no_prim_ops PUBLIC ${_common_compile_options})
target_compile_options(executorch_core PUBLIC ${_common_compile_options})
if(MAX_KERNEL_NUM)
target_compile_definitions(
executorch_no_prim_ops PRIVATE MAX_KERNEL_NUM=${MAX_KERNEL_NUM}
executorch_core PRIVATE MAX_KERNEL_NUM=${MAX_KERNEL_NUM}
)
endif()

if(EXECUTORCH_BUILD_PYBIND AND APPLE)
# shared version
add_library(
executorch_no_prim_ops_shared SHARED ${_executorch_no_prim_ops__srcs}
executorch_core_shared SHARED ${_executorch_core__srcs}
)
target_link_libraries(executorch_no_prim_ops_shared PRIVATE program_schema)
target_link_libraries(executorch_core_shared PRIVATE program_schema)
if(DL_LIBRARY_EXISTS)
# For dladdr()
target_link_libraries(executorch_no_prim_ops_shared PRIVATE dl)
target_link_libraries(executorch_core_shared PRIVATE dl)
endif()
target_include_directories(
executorch_no_prim_ops_shared PUBLIC ${_common_include_directories}
executorch_core_shared PUBLIC ${_common_include_directories}
)
target_compile_options(
executorch_no_prim_ops_shared PUBLIC ${_common_compile_options}
executorch_core_shared PUBLIC ${_common_compile_options}
)
if(MAX_KERNEL_NUM)
target_compile_definitions(
executorch_no_prim_ops_shared PRIVATE MAX_KERNEL_NUM=${MAX_KERNEL_NUM}
executorch_core_shared PRIVATE MAX_KERNEL_NUM=${MAX_KERNEL_NUM}
)
endif()
endif()
Expand All @@ -532,7 +535,7 @@ endif()
# any backends.
#
add_library(executorch ${_executorch__srcs})
target_link_libraries(executorch PRIVATE executorch_no_prim_ops)
target_link_libraries(executorch PRIVATE executorch_core)
target_include_directories(executorch PUBLIC ${_common_include_directories})
target_compile_options(executorch PUBLIC ${_common_compile_options})
target_link_options_shared_lib(executorch)
Expand Down Expand Up @@ -568,7 +571,7 @@ endif()
# Install `executorch` library as well as `executorch-config.cmake` under
# ${CMAKE_INSTALL_PREFIX}/
install(
TARGETS executorch executorch_no_prim_ops
TARGETS executorch executorch_core
DESTINATION lib
INCLUDES
DESTINATION ${_common_include_directories}
Expand Down
52 changes: 27 additions & 25 deletions backends/apple/coreml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,34 +112,36 @@ set(PROTOBUF_SOURCES
)

# Define the delegate library
add_library(coremldelegate)
add_library(coreml_backend)
# Preserve old name for backwards compatability
add_library(coremldelegate ALIAS coreml_backend)
target_sources(
coremldelegate PRIVATE ${INMEMORYFS_SOURCES} ${KVSTORE_SOURCES}
coreml_backend PRIVATE ${INMEMORYFS_SOURCES} ${KVSTORE_SOURCES}
${DELEGATE_SOURCES} ${UTIL_SOURCES}
)

target_include_directories(
coremldelegate PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/runtime/include
coreml_backend PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/runtime/include
)
target_include_directories(
coremldelegate PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/runtime/kvstore
coreml_backend PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/runtime/kvstore
)
target_include_directories(
coremldelegate PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/runtime/inmemoryfs
coreml_backend PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/runtime/inmemoryfs
)
target_include_directories(
coremldelegate PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/runtime/delegate
coreml_backend PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/runtime/delegate
)
target_include_directories(
coremldelegate PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/runtime/util
coreml_backend PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/runtime/util
)
target_include_directories(coremldelegate PRIVATE ${EXECUTORCH_ROOT}/..)
target_link_libraries(coremldelegate PRIVATE executorch_no_prim_ops)
target_include_directories(coreml_backend PRIVATE ${EXECUTORCH_ROOT}/..)
target_link_libraries(coreml_backend PRIVATE executorch_core)

if(EXECUTORCH_BUILD_DEVTOOLS)
target_sources(coremldelegate PRIVATE ${SDK_SOURCES} ${PROTOBUF_SOURCES})
target_sources(coreml_backend PRIVATE ${SDK_SOURCES} ${PROTOBUF_SOURCES})
target_include_directories(
coremldelegate
coreml_backend
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/runtime/sdk
${CMAKE_CURRENT_SOURCE_DIR}/third-party/coremltools/deps/protobuf/src
Expand All @@ -149,7 +151,7 @@ if(EXECUTORCH_BUILD_DEVTOOLS)
)

target_link_options_shared_lib(libprotobuf-lite)
target_link_libraries(coremldelegate PRIVATE libprotobuf-lite)
target_link_libraries(coreml_backend PRIVATE libprotobuf-lite)
endif()

find_library(ACCELERATE_FRAMEWORK Accelerate)
Expand All @@ -158,46 +160,46 @@ find_library(FOUNDATION_FRAMEWORK Foundation)
find_library(SQLITE_LIBRARY sqlite3)

target_link_libraries(
coremldelegate
PRIVATE executorch_no_prim_ops ${ACCELERATE_FRAMEWORK} ${COREML_FRAMEWORK}
coreml_backend
PRIVATE executorch_core ${ACCELERATE_FRAMEWORK} ${COREML_FRAMEWORK}
${FOUNDATION_FRAMEWORK} ${SQLITE_LIBRARY}
)

target_link_options_shared_lib(coremldelegate)
target_link_options_shared_lib(coreml_backend)

if(COREML_BUILD_EXECUTOR_RUNNER)
target_link_libraries(
coremldelegate PRIVATE portable_ops_lib portable_kernels
coreml_backend PRIVATE portable_ops_lib portable_kernels
)
endif()

target_compile_options(coremldelegate PRIVATE "-fobjc-arc")
target_compile_options(coremldelegate PRIVATE "-fno-exceptions")
target_compile_options(coreml_backend PRIVATE "-fobjc-arc")
target_compile_options(coreml_backend PRIVATE "-fno-exceptions")

if(EXECUTORCH_BUILD_DEVTOOLS)
target_compile_options(
executorch_no_prim_ops PUBLIC -DET_EVENT_TRACER_ENABLED
executorch_core PUBLIC -DET_EVENT_TRACER_ENABLED
)
target_compile_options(coremldelegate PRIVATE "-frtti")
target_compile_options(coreml_backend PRIVATE "-frtti")
target_compile_options(libprotobuf-lite PRIVATE "-frtti")
else()
target_compile_options(coremldelegate PRIVATE "-fno-rtti")
target_compile_options(coreml_backend PRIVATE "-fno-rtti")
endif()

set(TARGET coremldelegate APPEND_STRING PROPERTY COMPILE_FLAGS
set(TARGET coreml_backend APPEND_STRING PROPERTY COMPILE_FLAGS
"-x objective-c++"
)

set(TARGET coremldelegate APPEND_STRING PROPERTY COMPILE_FLAGS
set(TARGET coreml_backend APPEND_STRING PROPERTY COMPILE_FLAGS
"-Wno-null-character"
)

set(TARGET coremldelegate APPEND_STRING PROPERTY COMPILE_FLAGS
set(TARGET coreml_backend APPEND_STRING PROPERTY COMPILE_FLAGS
"-Wno-receiver-expr"
)

install(
TARGETS coremldelegate
TARGETS coreml_backend
DESTINATION lib
INCLUDES
DESTINATION ${_common_include_directories}
Expand Down
4 changes: 2 additions & 2 deletions backends/apple/coreml/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ The `converted_graph` is the quantized torch model, and can be delegated to **Co

## Runtime

To execute a Core ML delegated program, the application must link to the `coremldelegate` library. Once linked there are no additional steps required, ExecuTorch when running the program would call the Core ML runtime to execute the Core ML delegated part of the program.
To execute a Core ML delegated program, the application must link to the `coreml_backend` library. Once linked there are no additional steps required, ExecuTorch when running the program would call the Core ML runtime to execute the Core ML delegated part of the program.

Please follow the instructions described in the [Core ML setup](/backends/apple/coreml/setup.md) to link the `coremldelegate` library.
Please follow the instructions described in the [Core ML setup](/backends/apple/coreml/setup.md) to link the `coreml_backend` library.

## Help & Improvements
If you have problems or questions or have suggestions for ways to make
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
C9E7D7962AB3F9BF00CCAE5D /* KeyValueStoreTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = C9E7D78E2AB3F9BF00CCAE5D /* KeyValueStoreTests.mm */; };
C9E7D7A22AB3FBB200CCAE5D /* CoreMLBackendDelegateTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = C9E7D7A12AB3FBB200CCAE5D /* CoreMLBackendDelegateTests.mm */; };
C9EC7E1B2BC73B3200A6B166 /* MultiArrayTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = C9EC7E1A2BC73B3200A6B166 /* MultiArrayTests.mm */; };
F24817E52BC655E100E80D98 /* libexecutorch_no_prim_ops.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F24817E42BC655E100E80D98 /* libexecutorch_no_prim_ops.a */; };
F24817E52BC655E100E80D98 /* libexecutorch_core.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F24817E42BC655E100E80D98 /* libexecutorch_core.a */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand Down Expand Up @@ -310,7 +310,7 @@
C9EA3FE52B73EF6300B7D7BD /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; };
C9EC7E092BC662A300A6B166 /* objc_array_util.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = objc_array_util.h; path = ../util/objc_array_util.h; sourceTree = "<group>"; };
C9EC7E1A2BC73B3200A6B166 /* MultiArrayTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = MultiArrayTests.mm; path = ../test/MultiArrayTests.mm; sourceTree = "<group>"; };
F24817E42BC655E100E80D98 /* libexecutorch_no_prim_ops.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libexecutorch_no_prim_ops.a; path = ../libraries/libexecutorch_no_prim_ops.a; sourceTree = "<group>"; };
F24817E42BC655E100E80D98 /* libexecutorch_core.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libexecutorch_core.a; path = ../libraries/libexecutorch_core.a; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -319,7 +319,7 @@
buildActionMask = 2147483647;
files = (
C94D510F2ABDF87500AF47FD /* Accelerate.framework in Frameworks */,
F24817E52BC655E100E80D98 /* libexecutorch_no_prim_ops.a in Frameworks */,
F24817E52BC655E100E80D98 /* libexecutorch_core.a in Frameworks */,
C94D510E2ABDF86800AF47FD /* libsqlite3.tbd in Frameworks */,
C94D50D92ABD7B2400AF47FD /* CoreML.framework in Frameworks */,
C99883862B95AD7D000953A3 /* libprotobuf-lite.a in Frameworks */,
Expand Down Expand Up @@ -540,7 +540,7 @@
C96560942AABFDCE005F8126 /* libsqlite3.tbd */,
C96560922AABF992005F8126 /* CoreML.framework */,
C96560902AABF982005F8126 /* Accelerate.framework */,
F24817E42BC655E100E80D98 /* libexecutorch_no_prim_ops.a */,
F24817E42BC655E100E80D98 /* libexecutorch_core.a */,
C965608D2AABF72A005F8126 /* libexecutorch.a */,
);
name = "Recovered References";
Expand Down
2 changes: 1 addition & 1 deletion backends/apple/coreml/scripts/build_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ cmake --build "$CMAKE_PROTOBUF_BUILD_DIR_PATH" -j9 -t libprotobuf-lite
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/libexecutorch_no_prim_ops.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"

#Copy ExecuTorch headers
Expand Down
15 changes: 8 additions & 7 deletions backends/apple/mps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,30 +64,31 @@ target_include_directories(
)

list(TRANSFORM _mps_backend__srcs PREPEND "${EXECUTORCH_ROOT}/")
add_library(mpsdelegate ${_mps_backend__srcs})
add_library(mps_backend ${_mps_backend__srcs})
add_library(mpsdelegate ALIAS mps_backend)

find_library(FOUNDATION_FRAMEWORK Foundation)
find_library(METAL_FRAMEWORK Metal)
find_library(MPS_FRAMEWORK MetalPerformanceShaders)
find_library(MPS_GRAPH_FRAMEWORK MetalPerformanceShadersGraph)

target_link_libraries(
mpsdelegate
mps_backend
PRIVATE bundled_program
mps_schema
executorch_no_prim_ops
executorch_core
${FOUNDATION_FRAMEWORK}
${METAL_FRAMEWORK}
${MPS_FRAMEWORK}
${MPS_GRAPH_FRAMEWORK}
)

target_link_options_shared_lib(mpsdelegate)
target_compile_options(mpsdelegate PUBLIC ${_common_compile_options})
target_compile_options(mpsdelegate PRIVATE "-fno-objc-arc")
target_link_options_shared_lib(mps_backend)
target_compile_options(mps_backend PUBLIC ${_common_compile_options})
target_compile_options(mps_backend PRIVATE "-fno-objc-arc")

install(
TARGETS mpsdelegate
TARGETS mps_backend
DESTINATION lib
INCLUDES
DESTINATION ${_common_include_directories}
Expand Down
7 changes: 4 additions & 3 deletions backends/arm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ set(_arm_baremetal_sources backends/arm/runtime/ArmBackendEthosU.cpp
)
list(TRANSFORM _arm_baremetal_sources PREPEND "${EXECUTORCH_ROOT}/")

add_library(executorch_delegate_ethos_u STATIC ${_arm_baremetal_sources})
add_library(ethos_u_backend STATIC ${_arm_baremetal_sources})
add_library(executorch_delegate_ethos_u ALIAS ethos_u_backend)
target_include_directories(
executorch_delegate_ethos_u PUBLIC ${_common_include_directories}
ethos_u_backend PUBLIC ${_common_include_directories}
)
target_include_directories(
executorch_delegate_ethos_u PUBLIC ${DRIVER_ETHOSU_INCLUDE_DIR}
ethos_u_backend PUBLIC ${DRIVER_ETHOSU_INCLUDE_DIR}
)
2 changes: 1 addition & 1 deletion backends/mediatek/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/runtime/include)
add_library(neuron_backend SHARED)
target_link_libraries(neuron_backend
PRIVATE
executorch_no_prim_ops
executorch_core
portable_ops_lib
android
log
Expand Down
2 changes: 1 addition & 1 deletion backends/qualcomm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ target_link_libraries(
)
target_link_libraries(
qnn_executorch_backend PRIVATE qnn_executorch_header qnn_schema qnn_manager
executorch_no_prim_ops qcir_utils
executorch_core qcir_utils
)
set_target_properties(
qnn_executorch_backend PROPERTIES LINK_FLAGS "-Wl,-rpath='$ORIGIN'"
Expand Down
2 changes: 1 addition & 1 deletion backends/xnnpack/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,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_no_prim_ops
xnnpack_backend PRIVATE ${xnnpack_third_party} executorch_core
xnnpack_schema
)

Expand Down
2 changes: 1 addition & 1 deletion build/Codegen.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ function(gen_custom_ops_aot_lib)
if(TARGET portable_lib)
target_link_libraries(${GEN_LIB_NAME} PRIVATE portable_lib)
else()
target_link_libraries(${GEN_LIB_NAME} PRIVATE executorch_no_prim_ops)
target_link_libraries(${GEN_LIB_NAME} PRIVATE executorch_core)
endif()
endfunction()

Expand Down
6 changes: 3 additions & 3 deletions build/build_apple_frameworks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ PLATFORM_TARGET=("17.0" "17.0" "10.15")

FRAMEWORK_EXECUTORCH="executorch:\
libexecutorch.a,\
libexecutorch_no_prim_ops.a,\
libexecutorch_core.a,\
libextension_apple.a,\
libextension_data_loader.a,\
libextension_module.a,\
libextension_tensor.a,\
:$HEADERS_PATH"

FRAMEWORK_BACKEND_COREML="backend_coreml:\
libcoremldelegate.a,\
libcoreml_backend.a,\
:"

FRAMEWORK_BACKEND_MPS="backend_mps:\
libmpsdelegate.a,\
libmps_backend.a,\
:"

FRAMEWORK_BACKEND_XNNPACK="backend_xnnpack:\
Expand Down
Loading
Loading