diff --git a/devtools/bundled_program/CMakeLists.txt b/devtools/bundled_program/CMakeLists.txt index ee7fb34e37f..b1b227b3528 100644 --- a/devtools/bundled_program/CMakeLists.txt +++ b/devtools/bundled_program/CMakeLists.txt @@ -4,18 +4,20 @@ # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. -set( - _schema_files - bundled_program_schema.fbs - scalar_type.fbs -) +set(_schema_files bundled_program_schema.fbs scalar_type.fbs) set(_schema_outputs) foreach(schema_file ${_schema_files}) - list(APPEND _bundled_program_schema__srcs "${CMAKE_CURRENT_SOURCE_DIR}/schema/${schema_file}") + list(APPEND _bundled_program_schema__srcs + "${CMAKE_CURRENT_SOURCE_DIR}/schema/${schema_file}" + ) string(REGEX REPLACE "[.]fbs$" "_generated.h" generated "${schema_file}") - list(APPEND _schema_outputs "${DEVTOOLS_INCLUDE_DIR}/executorch/devtools/bundled_program/schema/${generated}") + list( + APPEND + _schema_outputs + "${DEVTOOLS_INCLUDE_DIR}/executorch/devtools/bundled_program/schema/${generated}" + ) endforeach() file(MAKE_DIRECTORY ${DEVTOOLS_INCLUDE_DIR}/executorch/devtools/bundled_program) @@ -32,20 +34,13 @@ add_custom_command( ) add_library( - bundled_program - ${_schema_outputs} - ${CMAKE_CURRENT_SOURCE_DIR}/bundled_program.cpp -) -target_link_libraries( - bundled_program - PUBLIC - executorch + bundled_program ${_schema_outputs} + ${CMAKE_CURRENT_SOURCE_DIR}/bundled_program.cpp ) +target_link_libraries(bundled_program PUBLIC executorch) target_include_directories( - bundled_program - PUBLIC - ${DEVTOOLS_INCLUDE_DIR} - ${PROJECT_SOURCE_DIR}/third-party/flatbuffers/include + bundled_program PUBLIC ${DEVTOOLS_INCLUDE_DIR} + ${PROJECT_SOURCE_DIR}/third-party/flatbuffers/include ) install( diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3e8342a9741..28f7b110483 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -72,11 +72,12 @@ endif() # size_test_all_optimized_ops: binary with optimized ops and no delegate backend # if(EXECUTORCH_BUILD_KERNELS_OPTIMIZED) -add_executable(size_test_all_optimized_ops ${_size_test__srcs}) -target_link_options_shared_lib(optimized_native_cpu_ops_lib) -target_link_libraries( - size_test_all_optimized_ops executorch optimized_native_cpu_ops_lib) -if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") - target_link_options_gc_sections(size_test_all_optimized_ops) -endif() + add_executable(size_test_all_optimized_ops ${_size_test__srcs}) + target_link_options_shared_lib(optimized_native_cpu_ops_lib) + target_link_libraries( + size_test_all_optimized_ops executorch optimized_native_cpu_ops_lib + ) + if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") + target_link_options_gc_sections(size_test_all_optimized_ops) + endif() endif() diff --git a/tools/cmake/executorch-config.cmake b/tools/cmake/executorch-config.cmake index f64b080239d..6472648786c 100644 --- a/tools/cmake/executorch-config.cmake +++ b/tools/cmake/executorch-config.cmake @@ -150,7 +150,9 @@ if(TARGET coremldelegate) endif() if(TARGET etdump) - set_target_properties(etdump PROPERTIES INTERFACE_LINK_LIBRARIES "flatccrt;executorch") + set_target_properties( + etdump PROPERTIES INTERFACE_LINK_LIBRARIES "flatccrt;executorch" + ) endif() if(TARGET optimized_native_cpu_ops_lib) @@ -174,13 +176,11 @@ if(TARGET extension_threadpool) endif() set(shared_lib_list - # executorch -- size tests fail due to regression if we include this and I'm not sure it's needed. - optimized_native_cpu_ops_lib - portable_ops_lib - quantized_ops_lib - xnnpack_backend - vulkan_backend - quantized_ops_aot_lib) + # executorch -- size tests fail due to regression if we include this and I'm + # not sure it's needed. + optimized_native_cpu_ops_lib portable_ops_lib quantized_ops_lib + xnnpack_backend vulkan_backend quantized_ops_aot_lib +) foreach(lib ${shared_lib_list}) if(TARGET ${lib}) target_link_options_shared_lib(${lib}) diff --git a/tools/cmake/preset/default.cmake b/tools/cmake/preset/default.cmake index d25e05c4acf..0500e730b1a 100644 --- a/tools/cmake/preset/default.cmake +++ b/tools/cmake/preset/default.cmake @@ -15,19 +15,17 @@ endif() # MARK: - Overridable Options define_overridable_option( - EXECUTORCH_ENABLE_LOGGING - "Build with ET_LOG_ENABLED" - BOOL ${_is_build_type_debug} + EXECUTORCH_ENABLE_LOGGING "Build with ET_LOG_ENABLED" BOOL + ${_is_build_type_debug} ) define_overridable_option( - EXECUTORCH_BUILD_COREML - "Build the Core ML backend" - BOOL OFF + EXECUTORCH_BUILD_COREML "Build the Core ML backend" BOOL OFF ) define_overridable_option( EXECUTORCH_FLATBUFFERS_MAX_ALIGNMENT "Exir lets users set the alignment of tensor data embedded in the flatbuffer, and some users need an alignment larger than the default, which is typically 32." - STRING 1024 + STRING + 1024 ) define_overridable_option( EXECUTORCH_PAL_DEFAULT @@ -35,189 +33,121 @@ define_overridable_option( STRING "posix" ) define_overridable_option( - EXECUTORCH_PAL_DEFAULT_FILE_PATH - "PAL implementation file path" - STRING "${PROJECT_SOURCE_DIR}/runtime/platform/default/${EXECUTORCH_PAL_DEFAULT}.cpp" + EXECUTORCH_PAL_DEFAULT_FILE_PATH "PAL implementation file path" STRING + "${PROJECT_SOURCE_DIR}/runtime/platform/default/${EXECUTORCH_PAL_DEFAULT}.cpp" ) define_overridable_option( - EXECUTORCH_LOG_LEVEL - "Build with the given ET_MIN_LOG_LEVEL value" - STRING "Info" + EXECUTORCH_LOG_LEVEL "Build with the given ET_MIN_LOG_LEVEL value" STRING + "Info" ) define_overridable_option( EXECUTORCH_ENABLE_PROGRAM_VERIFICATION - "Build with ET_ENABLE_PROGRAM_VERIFICATION" - BOOL ${_is_build_type_debug} + "Build with ET_ENABLE_PROGRAM_VERIFICATION" BOOL ${_is_build_type_debug} ) define_overridable_option( - EXECUTORCH_ENABLE_EVENT_TRACER - "Build with ET_EVENT_TRACER_ENABLED" - BOOL OFF + EXECUTORCH_ENABLE_EVENT_TRACER "Build with ET_EVENT_TRACER_ENABLED" BOOL OFF ) define_overridable_option( EXECUTORCH_OPTIMIZE_SIZE - "Build executorch runtime optimizing for binary size" - BOOL OFF + "Build executorch runtime optimizing for binary size" BOOL OFF ) define_overridable_option( EXECUTORCH_BUILD_ARM_BAREMETAL - "Build the Arm Baremetal flow for Cortex-M and Ethos-U" - BOOL OFF + "Build the Arm Baremetal flow for Cortex-M and Ethos-U" BOOL OFF ) define_overridable_option( - EXECUTORCH_BUILD_KERNELS_LLM - "Build the custom kernels" - BOOL OFF + EXECUTORCH_BUILD_KERNELS_LLM "Build the custom kernels" BOOL OFF ) define_overridable_option( - EXECUTORCH_BUILD_KERNELS_LLM_AOT - "Build the custom ops lib for AOT" - BOOL OFF + EXECUTORCH_BUILD_KERNELS_LLM_AOT "Build the custom ops lib for AOT" BOOL OFF ) define_overridable_option( EXECUTORCH_BUILD_KERNELS_QUANTIZED_AOT - "Build the optimized ops library for AOT export usage" - BOOL OFF + "Build the optimized ops library for AOT export usage" BOOL OFF ) define_overridable_option( - EXECUTORCH_BUILD_EXTENSION_DATA_LOADER - "Build the Data Loader extension" - BOOL OFF + EXECUTORCH_BUILD_EXTENSION_DATA_LOADER "Build the Data Loader extension" BOOL + OFF ) define_overridable_option( - EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR - "Build the Flat Tensor extension" - BOOL OFF + EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR "Build the Flat Tensor extension" BOOL + OFF ) define_overridable_option( - EXECUTORCH_BUILD_EXTENSION_LLM - "Build the LLM extension" - BOOL OFF + EXECUTORCH_BUILD_EXTENSION_LLM "Build the LLM extension" BOOL OFF ) define_overridable_option( - EXECUTORCH_BUILD_EXTENSION_LLM_APPLE - "Build the LLM Apple extension" - BOOL OFF + EXECUTORCH_BUILD_EXTENSION_LLM_APPLE "Build the LLM Apple extension" BOOL OFF ) define_overridable_option( - EXECUTORCH_BUILD_EXTENSION_MODULE - "Build the Module extension" - BOOL OFF + EXECUTORCH_BUILD_EXTENSION_MODULE "Build the Module extension" BOOL OFF ) define_overridable_option( - EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL - "Build the Runner Util extension" - BOOL OFF + EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL "Build the Runner Util extension" BOOL + OFF ) define_overridable_option( - EXECUTORCH_BUILD_EXTENSION_TENSOR - "Build the Tensor extension" - BOOL OFF + EXECUTORCH_BUILD_EXTENSION_TENSOR "Build the Tensor extension" BOOL OFF ) define_overridable_option( - EXECUTORCH_BUILD_EXTENSION_TRAINING - "Build the training extension" - BOOL OFF + EXECUTORCH_BUILD_EXTENSION_TRAINING "Build the training extension" BOOL OFF ) define_overridable_option( - EXECUTORCH_BUILD_EXTENSION_APPLE - "Build the Apple extension" - BOOL OFF + EXECUTORCH_BUILD_EXTENSION_APPLE "Build the Apple extension" BOOL OFF ) +define_overridable_option(EXECUTORCH_BUILD_MPS "Build the MPS backend" BOOL OFF) define_overridable_option( - EXECUTORCH_BUILD_MPS - "Build the MPS backend" - BOOL OFF + EXECUTORCH_BUILD_NEURON "Build the backends/mediatek directory" BOOL OFF ) define_overridable_option( - EXECUTORCH_BUILD_NEURON - "Build the backends/mediatek directory" - BOOL OFF + EXECUTORCH_BUILD_OPENVINO "Build the Openvino backend" BOOL OFF ) define_overridable_option( - EXECUTORCH_BUILD_OPENVINO - "Build the Openvino backend" - BOOL OFF + EXECUTORCH_BUILD_PYBIND "Build the Python Bindings" BOOL OFF ) define_overridable_option( - EXECUTORCH_BUILD_PYBIND - "Build the Python Bindings" - BOOL OFF + EXECUTORCH_BUILD_QNN "Build the Qualcomm backend" BOOL OFF ) define_overridable_option( - EXECUTORCH_BUILD_QNN - "Build the Qualcomm backend" - BOOL OFF + EXECUTORCH_BUILD_KERNELS_OPTIMIZED "Build the optimized kernels" BOOL OFF ) define_overridable_option( - EXECUTORCH_BUILD_KERNELS_OPTIMIZED - "Build the optimized kernels" - BOOL OFF -) -define_overridable_option( - EXECUTORCH_BUILD_KERNELS_QUANTIZED - "Build the quantized kernels" - BOOL OFF + EXECUTORCH_BUILD_KERNELS_QUANTIZED "Build the quantized kernels" BOOL OFF ) define_overridable_option( - EXECUTORCH_BUILD_DEVTOOLS - "Build the ExecuTorch Developer Tools" - BOOL OFF + EXECUTORCH_BUILD_DEVTOOLS "Build the ExecuTorch Developer Tools" BOOL OFF ) define_overridable_option( - EXECUTORCH_BUILD_TESTS - "Build CMake-based unit tests" - BOOL OFF + EXECUTORCH_BUILD_TESTS "Build CMake-based unit tests" BOOL OFF ) define_overridable_option( - EXECUTORCH_NNLIB_OPT - "Build Cadence backend Hifi nnlib kernel" - BOOL OFF + EXECUTORCH_NNLIB_OPT "Build Cadence backend Hifi nnlib kernel" BOOL OFF ) define_overridable_option( - EXECUTORCH_CADENCE_CPU_RUNNER - "Build Cadence backend CPU runner" - BOOL OFF + EXECUTORCH_CADENCE_CPU_RUNNER "Build Cadence backend CPU runner" BOOL OFF ) define_overridable_option( - EXECUTORCH_BUILD_SIZE_TEST - "Build the size test" - BOOL OFF + EXECUTORCH_BUILD_SIZE_TEST "Build the size test" BOOL OFF ) define_overridable_option( - EXECUTORCH_BUILD_XNNPACK - "Build the XNNPACK backend" - BOOL OFF + EXECUTORCH_BUILD_XNNPACK "Build the XNNPACK backend" BOOL OFF ) define_overridable_option( - EXECUTORCH_BUILD_VULKAN - "Build the Vulkan backend" - BOOL OFF + EXECUTORCH_BUILD_VULKAN "Build the Vulkan backend" BOOL OFF ) define_overridable_option( - EXECUTORCH_BUILD_PORTABLE_OPS - "Build portable_ops library" - BOOL ON + EXECUTORCH_BUILD_PORTABLE_OPS "Build portable_ops library" BOOL ON ) +define_overridable_option(EXECUTORCH_USE_DL "Use libdl library" BOOL ON) define_overridable_option( - EXECUTORCH_USE_DL - "Use libdl library" - BOOL ON + EXECUTORCH_BUILD_CADENCE "Build the Cadence DSP backend" BOOL OFF ) define_overridable_option( - EXECUTORCH_BUILD_CADENCE - "Build the Cadence DSP backend" - BOOL OFF + EXECUTORCH_BUILD_CORTEX_M "Build the Cortex-M backend" BOOL OFF ) define_overridable_option( - EXECUTORCH_BUILD_CORTEX_M - "Build the Cortex-M backend" - BOOL OFF -) -define_overridable_option( - EXECUTORCH_COREML_BUILD_EXECUTOR_RUNNER - "Build CoreML executor runner." - BOOL OFF + EXECUTORCH_COREML_BUILD_EXECUTOR_RUNNER "Build CoreML executor runner." BOOL + OFF ) if(EXECUTORCH_BUILD_ARM_BAREMETAL) @@ -228,14 +158,12 @@ else() set(_default_executorch_build_cpuinfo ON) endif() define_overridable_option( - EXECUTORCH_BUILD_PTHREADPOOL - "Build pthreadpool library." - BOOL ${_default_executorch_build_pthreadpool} + EXECUTORCH_BUILD_PTHREADPOOL "Build pthreadpool library." BOOL + ${_default_executorch_build_pthreadpool} ) define_overridable_option( - EXECUTORCH_BUILD_CPUINFO - "Build cpuinfo library." - BOOL ${_default_executorch_build_cpuinfo} + EXECUTORCH_BUILD_CPUINFO "Build cpuinfo library." BOOL + ${_default_executorch_build_cpuinfo} ) # TODO(jathu): move this to platform specific presets when created @@ -246,40 +174,33 @@ elseif(DEFINED EXECUTORCH_BUILD_PRESET_FILE) set(_default_executorch_build_executor_runner OFF) endif() define_overridable_option( - EXECUTORCH_BUILD_EXECUTOR_RUNNER - "Build the executor_runner executable" - BOOL ${_default_executorch_build_executor_runner} + EXECUTORCH_BUILD_EXECUTOR_RUNNER "Build the executor_runner executable" BOOL + ${_default_executorch_build_executor_runner} ) # NB: Enabling this will serialize execution of delegate instances Keeping this # OFF by default to maintain existing behavior, to be revisited. define_overridable_option( EXECUTORCH_XNNPACK_SHARED_WORKSPACE - "Enable workspace sharing across different delegate instances" - BOOL ON + "Enable workspace sharing across different delegate instances" BOOL ON ) # Keeping this OFF by default due to regressions in decode and model load with # kleidi kernels define_overridable_option( - EXECUTORCH_XNNPACK_ENABLE_KLEIDI - "Enable Arm Kleidi kernels" - BOOL ON + EXECUTORCH_XNNPACK_ENABLE_KLEIDI "Enable Arm Kleidi kernels" BOOL ON ) -# Turning this on cache weights between partitions and methods. If weights -# are shared across methods/partitions then this can reduce load time and -# memory usage +# Turning this on cache weights between partitions and methods. If weights are +# shared across methods/partitions then this can reduce load time and memory +# usage # # Keeping this off maintains existing behavior. Turning this on serializes # execution and initialization of delegates, to be revisited define_overridable_option( EXECUTORCH_XNNPACK_ENABLE_WEIGHT_CACHE - "Enable weights cache to cache and manage all packed weights" - BOOL OFF + "Enable weights cache to cache and manage all packed weights" BOOL OFF ) define_overridable_option( - EXECUTORCH_USE_CPP_CODE_COVERAGE - "Build with code coverage enabled" - BOOL OFF + EXECUTORCH_USE_CPP_CODE_COVERAGE "Build with code coverage enabled" BOOL OFF ) # ------------------------------------------------------------------------------ @@ -289,74 +210,56 @@ define_overridable_option( # ------------------------------------------------------------------------------ check_required_options_on( - IF_ON - EXECUTORCH_ENABLE_EVENT_TRACER - REQUIRES - EXECUTORCH_BUILD_DEVTOOLS + IF_ON EXECUTORCH_ENABLE_EVENT_TRACER REQUIRES EXECUTORCH_BUILD_DEVTOOLS ) check_required_options_on( - IF_ON - EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR - REQUIRES - EXECUTORCH_BUILD_EXTENSION_DATA_LOADER + IF_ON EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR REQUIRES + EXECUTORCH_BUILD_EXTENSION_DATA_LOADER ) check_required_options_on( - IF_ON - EXECUTORCH_BUILD_EXTENSION_MODULE - REQUIRES - EXECUTORCH_BUILD_EXTENSION_DATA_LOADER - EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR + IF_ON EXECUTORCH_BUILD_EXTENSION_MODULE REQUIRES + EXECUTORCH_BUILD_EXTENSION_DATA_LOADER EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR ) check_required_options_on( - IF_ON - EXECUTORCH_BUILD_KERNELS_LLM - REQUIRES - EXECUTORCH_BUILD_KERNELS_OPTIMIZED + IF_ON EXECUTORCH_BUILD_KERNELS_LLM REQUIRES + EXECUTORCH_BUILD_KERNELS_OPTIMIZED ) check_required_options_on( - IF_ON - EXECUTORCH_BUILD_KERNELS_LLM_AOT - REQUIRES - EXECUTORCH_BUILD_EXTENSION_TENSOR - EXECUTORCH_BUILD_KERNELS_LLM + IF_ON EXECUTORCH_BUILD_KERNELS_LLM_AOT REQUIRES + EXECUTORCH_BUILD_EXTENSION_TENSOR EXECUTORCH_BUILD_KERNELS_LLM ) check_required_options_on( IF_ON - EXECUTORCH_BUILD_EXTENSION_TRAINING + EXECUTORCH_BUILD_EXTENSION_TRAINING REQUIRES - EXECUTORCH_BUILD_EXTENSION_DATA_LOADER - EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR - EXECUTORCH_BUILD_EXTENSION_MODULE - EXECUTORCH_BUILD_EXTENSION_TENSOR + EXECUTORCH_BUILD_EXTENSION_DATA_LOADER + EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR + EXECUTORCH_BUILD_EXTENSION_MODULE + EXECUTORCH_BUILD_EXTENSION_TENSOR ) check_required_options_on( - IF_ON - EXECUTORCH_BUILD_TESTS - REQUIRES - EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR + IF_ON EXECUTORCH_BUILD_TESTS REQUIRES EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR ) check_conflicting_options_on( - IF_ON - EXECUTORCH_BUILD_ARM_BAREMETAL - CONFLICTS_WITH - EXECUTORCH_BUILD_EXTENSION_DATA_LOADER - EXECUTORCH_BUILD_PTHREADPOOL - EXECUTORCH_BUILD_CPUINFO + IF_ON EXECUTORCH_BUILD_ARM_BAREMETAL CONFLICTS_WITH + EXECUTORCH_BUILD_EXTENSION_DATA_LOADER EXECUTORCH_BUILD_PTHREADPOOL + EXECUTORCH_BUILD_CPUINFO ) - if(NOT EXISTS ${EXECUTORCH_PAL_DEFAULT_FILE_PATH}) - message(FATAL_ERROR "PAL default implementation (EXECUTORCH_PAL_DEFAULT=${EXECUTORCH_PAL_DEFAULT}) file not found: ${EXECUTORCH_PAL_DEFAULT_FILE_PATH}. Choices: posix, minimal, android") + message( + FATAL_ERROR + "PAL default implementation (EXECUTORCH_PAL_DEFAULT=${EXECUTORCH_PAL_DEFAULT}) file not found: ${EXECUTORCH_PAL_DEFAULT_FILE_PATH}. Choices: posix, minimal, android" + ) endif() - string(TOLOWER "${EXECUTORCH_LOG_LEVEL}" _executorch_log_level_lower) if(_executorch_log_level_lower STREQUAL "debug") set(ET_MIN_LOG_LEVEL Debug) @@ -367,5 +270,8 @@ elseif(_executorch_log_level_lower STREQUAL "error") elseif(_executorch_log_level_lower STREQUAL "fatal") set(ET_MIN_LOG_LEVEL Fatal) else() - message(FATAL_ERROR "Unknown EXECUTORCH_LOG_LEVEL '${EXECUTORCH_LOG_LEVEL}'. Choices: Debug, Info, Error, Fatal") + message( + FATAL_ERROR + "Unknown EXECUTORCH_LOG_LEVEL '${EXECUTORCH_LOG_LEVEL}'. Choices: Debug, Info, Error, Fatal" + ) endif()