diff --git a/.ci/scripts/build-qnn-sdk.sh b/.ci/scripts/build-qnn-sdk.sh index 806df85d211..4518468f29c 100755 --- a/.ci/scripts/build-qnn-sdk.sh +++ b/.ci/scripts/build-qnn-sdk.sh @@ -32,6 +32,8 @@ set_up_aot() { -DQNN_SDK_ROOT=${QNN_SDK_ROOT} \ -DEXECUTORCH_BUILD_DEVTOOLS=ON \ -DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \ + -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \ + -DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON \ -DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \ -DEXECUTORCH_ENABLE_EVENT_TRACER=ON \ -DPYTHON_EXECUTABLE=python3 diff --git a/.ci/scripts/test_llama_torchao_lowbit.sh b/.ci/scripts/test_llama_torchao_lowbit.sh index 3fe5fa0faea..ac603cc5e83 100644 --- a/.ci/scripts/test_llama_torchao_lowbit.sh +++ b/.ci/scripts/test_llama_torchao_lowbit.sh @@ -30,6 +30,7 @@ cmake -DPYTHON_EXECUTABLE=python \ -DCMAKE_BUILD_TYPE=Release \ -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \ -DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \ + -DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON \ -DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \ -DEXECUTORCH_BUILD_XNNPACK=OFF \ -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \ diff --git a/.ci/scripts/test_llava.sh b/.ci/scripts/test_llava.sh index 0d9f2b8b141..8d0e69c6d7a 100644 --- a/.ci/scripts/test_llava.sh +++ b/.ci/scripts/test_llava.sh @@ -37,6 +37,7 @@ EXECUTORCH_COMMON_CMAKE_ARGS=" \ -DEXECUTORCH_ENABLE_LOGGING=ON \ -DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \ -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \ + -DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON \ -DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \ -DEXECUTORCH_BUILD_KERNELS_CUSTOM=ON \ -DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \ diff --git a/.ci/scripts/test_phi_3_mini.sh b/.ci/scripts/test_phi_3_mini.sh index a89d68ac31f..60f2054d30b 100644 --- a/.ci/scripts/test_phi_3_mini.sh +++ b/.ci/scripts/test_phi_3_mini.sh @@ -27,6 +27,7 @@ cmake_install_executorch_libraries() { -DEXECUTORCH_ENABLE_LOGGING=1 \ -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \ + -DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON \ -DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \ -DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \ -DEXECUTORCH_BUILD_XNNPACK=ON \ diff --git a/.github/workflows/trunk.yml b/.github/workflows/trunk.yml index 06e8af7cd5d..81199291003 100644 --- a/.github/workflows/trunk.yml +++ b/.github/workflows/trunk.yml @@ -552,6 +552,7 @@ jobs: -DEXECUTORCH_ENABLE_LOGGING=1 \ -DCMAKE_BUILD_TYPE=Release \ -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \ + -DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON \ -DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \ -DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \ -DEXECUTORCH_BUILD_XNNPACK=ON \ diff --git a/CMakeLists.txt b/CMakeLists.txt index 0540c2da039..3354697acc3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -152,37 +152,11 @@ else() endif() if(EXECUTORCH_BUILD_TESTS) - set(EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR ON) include(CTest) endif() add_subdirectory(third-party) -if(EXECUTORCH_BUILD_EXTENSION_TRAINING) - set(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER ON) - set(EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR ON) - set(EXECUTORCH_BUILD_EXTENSION_MODULE ON) - set(EXECUTORCH_BUILD_EXTENSION_TENSOR ON) -endif() - -if(EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR) - set(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER ON) -endif() - -if(EXECUTORCH_BUILD_EXTENSION_MODULE) - set(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER ON) - set(EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR ON) -endif() - -if(EXECUTORCH_BUILD_KERNELS_CUSTOM_AOT) - set(EXECUTORCH_BUILD_EXTENSION_TENSOR ON) - set(EXECUTORCH_BUILD_KERNELS_CUSTOM ON) -endif() - -if(EXECUTORCH_BUILD_KERNELS_CUSTOM) - set(EXECUTORCH_BUILD_KERNELS_OPTIMIZED ON) -endif() - if(NOT DEFINED FXDIV_SOURCE_DIR) set(ORIGINAL_CMAKE_POSITION_INDEPENDENT_CODE_FLAG ${CMAKE_POSITION_INDEPENDENT_CODE} @@ -336,7 +310,7 @@ if(EXECUTORCH_USE_CPP_CODE_COVERAGE) " -fprofile-instr-generate -fcoverage-mapping" ) else() - message(ERROR + message(FATAL_ERROR "Code coverage for compiler ${CMAKE_CXX_COMPILER_ID} is unsupported" ) endif() diff --git a/backends/qualcomm/scripts/build.sh b/backends/qualcomm/scripts/build.sh index 320cbcf4b87..8099ecb3de8 100755 --- a/backends/qualcomm/scripts/build.sh +++ b/backends/qualcomm/scripts/build.sh @@ -81,6 +81,8 @@ if [ "$BUILD_AARCH64" = true ]; then -DEXECUTORCH_BUILD_QNN=ON \ -DEXECUTORCH_BUILD_DEVTOOLS=ON \ -DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \ + -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \ + -DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON \ -DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \ -DEXECUTORCH_ENABLE_EVENT_TRACER=ON \ -DQNN_SDK_ROOT=$QNN_SDK_ROOT \ @@ -127,6 +129,8 @@ if [ "$BUILD_X86_64" = true ]; then -DEXECUTORCH_BUILD_QNN=ON \ -DEXECUTORCH_BUILD_DEVTOOLS=ON \ -DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \ + -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \ + -DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON \ -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \ -DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \ -DEXECUTORCH_ENABLE_EVENT_TRACER=ON \ diff --git a/examples/models/phi-3-mini/CMakeLists.txt b/examples/models/phi-3-mini/CMakeLists.txt index 5e9cad0d3de..9f7790cb8ab 100644 --- a/examples/models/phi-3-mini/CMakeLists.txt +++ b/examples/models/phi-3-mini/CMakeLists.txt @@ -21,8 +21,9 @@ set(CMAKE_CXX_STANDARD_REQUIRED True) set(CMAKE_BUILD_TYPE Release) # Set options for executorch build. -option(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER "" ON) option(EXECUTORCH_BUILD_EXTENSION_MODULE "" ON) +option(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER "" ON) +option(EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR "" ON) option(EXECUTORCH_BUILD_EXTENSION_TENSOR "" ON) option(EXECUTORCH_BUILD_KERNELS_OPTIMIZED "" ON) option(EXECUTORCH_BUILD_XNNPACK "" ON) diff --git a/scripts/build_android_library.sh b/scripts/build_android_library.sh index 86afc105dd4..7bb26c89d9e 100755 --- a/scripts/build_android_library.sh +++ b/scripts/build_android_library.sh @@ -47,6 +47,7 @@ build_android_native_library() { -DEXECUTORCH_BUILD_XNNPACK=ON \ -DEXECUTORCH_XNNPACK_SHARED_WORKSPACE=ON \ -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \ + -DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON \ -DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \ -DEXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL=ON \ -DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \ diff --git a/tools/cmake/preset/apple_common.cmake b/tools/cmake/preset/apple_common.cmake index c4f0c0a5fc8..f3ac66219dc 100644 --- a/tools/cmake/preset/apple_common.cmake +++ b/tools/cmake/preset/apple_common.cmake @@ -22,6 +22,7 @@ set_overridable_option(EXECUTORCH_XNNPACK_SHARED_WORKSPACE ON) set_overridable_option(EXECUTORCH_BUILD_EXTENSION_APPLE ON) set_overridable_option(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER ON) set_overridable_option(EXECUTORCH_BUILD_EXTENSION_MODULE ON) +set_overridable_option(EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR ON) set_overridable_option(EXECUTORCH_BUILD_EXTENSION_TENSOR ON) set_overridable_option(EXECUTORCH_BUILD_KERNELS_CUSTOM ON) set_overridable_option(EXECUTORCH_BUILD_KERNELS_OPTIMIZED ON) diff --git a/tools/cmake/preset/default.cmake b/tools/cmake/preset/default.cmake index 2d0c6302117..e40d72c7082 100644 --- a/tools/cmake/preset/default.cmake +++ b/tools/cmake/preset/default.cmake @@ -276,9 +276,72 @@ define_overridable_option( "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 +) -# MARK: - Validations +# ------------------------------------------------------------------------------ +# Validations +# # At this point all the options should be configured with their final value. +# ------------------------------------------------------------------------------ + +check_required_options_on( + 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 +) + +check_required_options_on( + 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_CUSTOM + REQUIRES + EXECUTORCH_BUILD_KERNELS_OPTIMIZED +) + +check_required_options_on( + IF_ON + EXECUTORCH_BUILD_KERNELS_CUSTOM_AOT + REQUIRES + EXECUTORCH_BUILD_EXTENSION_TENSOR + EXECUTORCH_BUILD_KERNELS_CUSTOM +) + +check_required_options_on( + IF_ON + EXECUTORCH_BUILD_EXTENSION_TRAINING + REQUIRES + 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(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") @@ -299,13 +362,6 @@ else() endif() -if(EXECUTORCH_ENABLE_EVENT_TRACER) - if(NOT EXECUTORCH_BUILD_DEVTOOLS) - message(FATAL_ERROR "Use of 'EXECUTORCH_ENABLE_EVENT_TRACER' requires 'EXECUTORCH_BUILD_DEVTOOLS' to be enabled.") - endif() -endif() - - if(EXECUTORCH_BUILD_ARM_BAREMETAL) if(EXECUTORCH_BUILD_PTHREADPOOL) message(FATAL_ERROR "Cannot enable both EXECUTORCH_BUILD_PTHREADPOOL and EXECUTORCH_BUILD_ARM_BAREMETAL") diff --git a/tools/cmake/preset/pybind.cmake b/tools/cmake/preset/pybind.cmake index ad5adc3eef4..1a60db834d8 100644 --- a/tools/cmake/preset/pybind.cmake +++ b/tools/cmake/preset/pybind.cmake @@ -18,6 +18,8 @@ set_overridable_option(EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL ON) set_overridable_option(EXECUTORCH_BUILD_KERNELS_CUSTOM ON) set_overridable_option(EXECUTORCH_BUILD_KERNELS_CUSTOM_AOT ON) set_overridable_option(EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR ON) +set_overridable_option(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER ON) +set_overridable_option(EXECUTORCH_BUILD_KERNELS_OPTIMIZED ON) if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")