diff --git a/CMakeLists.txt b/CMakeLists.txt index 99c8b7f69f..20bb1bb122 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -505,7 +505,8 @@ if(EXECUTORCH_BUILD_PYBIND AND APPLE) ) target_link_libraries(executorch_no_prim_ops_shared PRIVATE program_schema) if(DL_LIBRARY_EXISTS) - target_link_libraries(executorch_no_prim_ops_shared PRIVATE dl) # For dladdr() + # For dladdr() + target_link_libraries(executorch_no_prim_ops_shared PRIVATE dl) endif() target_include_directories( executorch_no_prim_ops_shared PUBLIC ${_common_include_directories} @@ -541,7 +542,7 @@ target_link_options_shared_lib(executorch) # operators necessary for the models that will run. # if(BUILD_EXECUTORCH_PORTABLE_OPS) -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/kernels/portable) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/kernels/portable) endif() if(EXECUTORCH_BUILD_KERNELS_OPTIMIZED) @@ -584,56 +585,56 @@ if(EXECUTORCH_BUILD_GTESTS) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third-party/googletest) endif() -if(EXECUTORCH_BUILD_SDK) - set(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER - ON - CACHE BOOL "EXECUTORCH_BUILD_EXTENSION_DATA_LOADER" FORCE - ) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/devtools) +if(EXECUTORCH_BUILD_ARM_BAREMETAL) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/arm) endif() -if(EXECUTORCH_BUILD_EXTENSION_APPLE) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/apple) +if(EXECUTORCH_BUILD_CADENCE) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/cadence) endif() -if(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/data_loader) +if(EXECUTORCH_BUILD_COREML) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/apple/coreml) endif() -if(EXECUTORCH_BUILD_EXTENSION_MODULE) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/module) +if(EXECUTORCH_BUILD_MPS) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/apple/mps) endif() if(EXECUTORCH_BUILD_NEURON) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/mediatek) endif() -if(EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/runner_util) +if(EXECUTORCH_BUILD_QNN) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/qualcomm) endif() if(EXECUTORCH_BUILD_XNNPACK) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/xnnpack) endif() -if(EXECUTORCH_BUILD_QNN) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/qualcomm) +if(EXECUTORCH_BUILD_SDK) + set(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER + ON + CACHE BOOL "EXECUTORCH_BUILD_EXTENSION_DATA_LOADER" FORCE + ) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/devtools) endif() -if(EXECUTORCH_BUILD_ARM_BAREMETAL) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/arm) +if(EXECUTORCH_BUILD_EXTENSION_APPLE) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/apple) endif() -if(EXECUTORCH_BUILD_MPS) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/apple/mps) +if(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/data_loader) endif() -if(EXECUTORCH_BUILD_COREML) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/apple/coreml) +if(EXECUTORCH_BUILD_EXTENSION_MODULE) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/module) endif() -if(EXECUTORCH_BUILD_CADENCE) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/cadence) +if(EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/runner_util) endif() if(EXECUTORCH_BUILD_PYBIND) @@ -690,9 +691,8 @@ if(EXECUTORCH_BUILD_PYBIND) ) # util lib add_library( - util - ${CMAKE_CURRENT_SOURCE_DIR}/extension/evalue_util/print_evalue.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/extension/aten_util/aten_bridge.cpp + util ${CMAKE_CURRENT_SOURCE_DIR}/extension/evalue_util/print_evalue.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/extension/aten_util/aten_bridge.cpp ) target_include_directories( util PUBLIC ${_common_include_directories} ${TORCH_INCLUDE_DIRS} @@ -741,12 +741,14 @@ if(EXECUTORCH_BUILD_PYBIND) else() set_target_properties( portable_lib - PROPERTIES # Assume is the root `site-packages/executorch` - # Need to add /extension/llm/custom_ops for - # libcustom_ops_aot_lib - # Need to add /kernels/quantized for - # libquantized_ops_aot_lib - BUILD_RPATH "$ORIGIN:$ORIGIN/../../extension/llm/custom_ops:$ORIGIN/../../kernels/quantized" + PROPERTIES + # Assume is the root `site-packages/executorch` + # Need to add /extension/llm/custom_ops for + # libcustom_ops_aot_lib + # Need to add /kernels/quantized for + # libquantized_ops_aot_lib + BUILD_RPATH + "$ORIGIN:$ORIGIN/../../extension/llm/custom_ops:$ORIGIN/../../kernels/quantized" ) endif() @@ -757,9 +759,7 @@ endif() if(EXECUTORCH_BUILD_KERNELS_CUSTOM) # TODO: move all custom kernels to ${CMAKE_CURRENT_SOURCE_DIR}/kernels/custom - add_subdirectory( - ${CMAKE_CURRENT_SOURCE_DIR}/extension/llm/custom_ops - ) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/llm/custom_ops) endif() if(EXECUTORCH_BUILD_KERNELS_QUANTIZED) diff --git a/backends/apple/coreml/CMakeLists.txt b/backends/apple/coreml/CMakeLists.txt index 113b21bd69..7f927284cd 100644 --- a/backends/apple/coreml/CMakeLists.txt +++ b/backends/apple/coreml/CMakeLists.txt @@ -14,10 +14,10 @@ if(NOT EXECUTORCH_ROOT) endif() if(EXECUTORCH_BUILD_SDK) -# protobuf requires frtti -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -frtti" ) + # protobuf requires frtti + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -frtti") endif() - + option(COREML_BUILD_EXECUTOR_RUNNER "Build CoreML executor runner." OFF) # inmemoryfs sources diff --git a/backends/cadence/CMakeLists.txt b/backends/cadence/CMakeLists.txt index f725655e0d..d786142f08 100644 --- a/backends/cadence/CMakeLists.txt +++ b/backends/cadence/CMakeLists.txt @@ -27,8 +27,8 @@ set(_common_include_directories ${EXECUTORCH_ROOT}/..) set(TARGET_DIR reference) if(EXECUTORCH_NNLIB_OPT) -set(TARGET_DIR hifi) -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_DIR}/third-party/nnlib) + set(TARGET_DIR hifi) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_DIR}/third-party/nnlib) endif() set(CMAKE_EXPORT_COMPILE_COMMANDS ON) @@ -68,7 +68,7 @@ target_include_directories( target_include_directories( cadence_runner PUBLIC ${ROOT_DIR}/.. ${CMAKE_BINARY_DIR} - ${_common_include_directories} + ${_common_include_directories} ) target_link_libraries( diff --git a/backends/cadence/hifi/kernels/CMakeLists.txt b/backends/cadence/hifi/kernels/CMakeLists.txt index 8cbeb3e180..15d1a4ddd5 100644 --- a/backends/cadence/hifi/kernels/CMakeLists.txt +++ b/backends/cadence/hifi/kernels/CMakeLists.txt @@ -13,11 +13,12 @@ add_library( target_include_directories( cadence_kernels - PUBLIC . - ${EXECUTORCH_ROOT}/backends/cadence/hifi/third-party/nnlib/nnlib-hifi4/xa_nnlib/algo/common/include/ - ${EXECUTORCH_ROOT}/backends/cadence/hifi/third-party/nnlib/nnlib-hifi4/xa_nnlib/include/nnlib - ${EXECUTORCH_ROOT}/backends/cadence/hifi/third-party/nnlib/nnlib-hifi4/xa_nnlib/include - ${EXECUTORCH_ROOT}/backends/cadence/hifi/third-party/nnlib/nnlib-hifi4/xa_nnlib/algo/ndsp/hifi4/include/ + PUBLIC + . + ${EXECUTORCH_ROOT}/backends/cadence/hifi/third-party/nnlib/nnlib-hifi4/xa_nnlib/algo/common/include/ + ${EXECUTORCH_ROOT}/backends/cadence/hifi/third-party/nnlib/nnlib-hifi4/xa_nnlib/include/nnlib + ${EXECUTORCH_ROOT}/backends/cadence/hifi/third-party/nnlib/nnlib-hifi4/xa_nnlib/include + ${EXECUTORCH_ROOT}/backends/cadence/hifi/third-party/nnlib/nnlib-hifi4/xa_nnlib/algo/ndsp/hifi4/include/ ) target_link_libraries(cadence_kernels PRIVATE xa_nnlib) diff --git a/backends/cadence/hifi/operators/CMakeLists.txt b/backends/cadence/hifi/operators/CMakeLists.txt index 996d109db4..8da6169cda 100644 --- a/backends/cadence/hifi/operators/CMakeLists.txt +++ b/backends/cadence/hifi/operators/CMakeLists.txt @@ -44,7 +44,8 @@ set(_aten_ops__srcs "${EXECUTORCH_ROOT}/kernels/portable/cpu/op_sub.cpp" "${EXECUTORCH_ROOT}/kernels/portable/cpu/op_to_copy.cpp" "${EXECUTORCH_ROOT}/kernels/portable/cpu/op_view_copy.cpp" - "${EXECUTORCH_ROOT}/kernels/portable/cpu/op_where.cpp") + "${EXECUTORCH_ROOT}/kernels/portable/cpu/op_where.cpp" +) add_library(aten_ops_cadence ${_aten_ops__srcs}) target_link_libraries(aten_ops_cadence PUBLIC executorch) target_link_libraries(aten_ops_cadence PRIVATE cadence_kernels) @@ -52,18 +53,20 @@ target_link_libraries(aten_ops_cadence PRIVATE cadence_kernels) # Let files say "include ". set(_common_include_directories ${EXECUTORCH_ROOT}/..) -target_include_directories(aten_ops_cadence PUBLIC ${ROOT_DIR}/.. - ${CMAKE_BINARY_DIR} - ${_common_include_directories}) +target_include_directories( + aten_ops_cadence PUBLIC ${ROOT_DIR}/.. ${CMAKE_BINARY_DIR} + ${_common_include_directories} +) # Custom ops that are needed to run the test model. add_library( - custom_ops "quantized_linear_out.cpp" - "quantized_layer_norm.cpp" - "quantize_per_tensor.cpp" "dequantize_per_tensor.cpp") -target_include_directories(custom_ops PUBLIC ${ROOT_DIR}/.. - ${CMAKE_BINARY_DIR} - ${_common_include_directories}) + custom_ops "quantized_linear_out.cpp" "quantized_layer_norm.cpp" + "quantize_per_tensor.cpp" "dequantize_per_tensor.cpp" +) +target_include_directories( + custom_ops PUBLIC ${ROOT_DIR}/.. ${CMAKE_BINARY_DIR} + ${_common_include_directories} +) target_link_libraries(custom_ops PUBLIC executorch) target_link_libraries(custom_ops PRIVATE cadence_kernels) @@ -75,12 +78,11 @@ gen_selected_ops( "${CMAKE_CURRENT_LIST_DIR}/../../aot/functions_hifi.yaml" "" "" ) generate_bindings_for_kernels( - LIB_NAME "cadence_ops_lib" OPS_SCHEMA_YAML - FUNCTIONS_YAML ${CMAKE_CURRENT_SOURCE_DIR}/../../aot/functions_hifi.yaml + LIB_NAME "cadence_ops_lib" OPS_SCHEMA_YAML FUNCTIONS_YAML + ${CMAKE_CURRENT_SOURCE_DIR}/../../aot/functions_hifi.yaml ) message("Generated files ${gen_command_sources}") gen_operators_lib( - LIB_NAME "cadence_ops_lib" - KERNEL_LIBS custom_ops - DEPS aten_ops_cadence) + LIB_NAME "cadence_ops_lib" KERNEL_LIBS custom_ops DEPS aten_ops_cadence +) diff --git a/backends/cadence/hifi/third-party/nnlib/CMakeLists.txt b/backends/cadence/hifi/third-party/nnlib/CMakeLists.txt index e93e0759d2..90eca6b47e 100644 --- a/backends/cadence/hifi/third-party/nnlib/CMakeLists.txt +++ b/backends/cadence/hifi/third-party/nnlib/CMakeLists.txt @@ -1,30 +1,19 @@ - cmake_minimum_required(VERSION 3.10.0) project(cadence_nnlib) - -add_custom_target( nnlib_target ALL COMMAND - make install_nnlib -f makefile -C ${EXECUTORCH_ROOT}/backends/cadence/hifi/third-party/nnlib/nnlib-hifi4/xa_nnlib/build - OBJDIR=${CMAKE_CURRENT_BINARY_DIR}/obj - LIBDIR=${CMAKE_CURRENT_BINARY_DIR}/lib - -j8 ) +add_custom_target( + nnlib_target ALL + COMMAND + make install_nnlib -f makefile -C + ${EXECUTORCH_ROOT}/backends/cadence/hifi/third-party/nnlib/nnlib-hifi4/xa_nnlib/build + OBJDIR=${CMAKE_CURRENT_BINARY_DIR}/obj + LIBDIR=${CMAKE_CURRENT_BINARY_DIR}/lib -j8 +) add_library(xa_nnlib STATIC IMPORTED GLOBAL) add_dependencies(xa_nnlib nnlib_target) set_property( - TARGET xa_nnlib - PROPERTY - IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/lib/xa_nnlib.a" + TARGET xa_nnlib PROPERTY IMPORTED_LOCATION + "${CMAKE_CURRENT_BINARY_DIR}/lib/xa_nnlib.a" ) - - - - - - - - - - - diff --git a/backends/cadence/reference/kernels/CMakeLists.txt b/backends/cadence/reference/kernels/CMakeLists.txt index eadb01f54d..fba66e9b27 100644 --- a/backends/cadence/reference/kernels/CMakeLists.txt +++ b/backends/cadence/reference/kernels/CMakeLists.txt @@ -5,12 +5,6 @@ # LICENSE file in the root directory of this source tree. # lint_cmake: -linelength -add_library( - cadence_kernels - kernels.cpp -) +add_library(cadence_kernels kernels.cpp) -target_include_directories( - cadence_kernels - PUBLIC . -) +target_include_directories(cadence_kernels PUBLIC .) diff --git a/backends/cadence/reference/operators/CMakeLists.txt b/backends/cadence/reference/operators/CMakeLists.txt index 71b0304c99..605c43ef71 100644 --- a/backends/cadence/reference/operators/CMakeLists.txt +++ b/backends/cadence/reference/operators/CMakeLists.txt @@ -50,7 +50,8 @@ set(_aten_ops__srcs "${EXECUTORCH_ROOT}/kernels/portable/cpu/op_where.cpp" "${EXECUTORCH_ROOT}/kernels/portable/cpu/op_expand_copy.cpp" "${EXECUTORCH_ROOT}/kernels/portable/cpu/op_gelu.cpp" - "${EXECUTORCH_ROOT}/kernels/portable/cpu/op_empty.cpp") + "${EXECUTORCH_ROOT}/kernels/portable/cpu/op_empty.cpp" +) add_library(aten_ops_cadence ${_aten_ops__srcs}) target_link_libraries(aten_ops_cadence PUBLIC executorch) target_link_libraries(aten_ops_cadence PRIVATE cadence_kernels) @@ -58,19 +59,26 @@ target_link_libraries(aten_ops_cadence PRIVATE cadence_kernels) # Let files say "include ". set(_common_include_directories ${EXECUTORCH_ROOT}/..) -target_include_directories(aten_ops_cadence PUBLIC ${ROOT_DIR}/.. - ${CMAKE_BINARY_DIR} - ${_common_include_directories}) +target_include_directories( + aten_ops_cadence PUBLIC ${ROOT_DIR}/.. ${CMAKE_BINARY_DIR} + ${_common_include_directories} +) # Custom ops that are needed to run the test model. add_library( - custom_ops "quantized_linear_out.cpp" "quantized_conv_out.cpp" - "quantized_relu_out.cpp" "quantized_layer_norm.cpp" - "quantize_per_tensor.cpp" "dequantize_per_tensor.cpp" - "quantized_matmul_out.cpp") -target_include_directories(custom_ops PUBLIC ${ROOT_DIR}/.. - ${CMAKE_BINARY_DIR} - ${_common_include_directories}) + custom_ops + "quantized_linear_out.cpp" + "quantized_conv_out.cpp" + "quantized_relu_out.cpp" + "quantized_layer_norm.cpp" + "quantize_per_tensor.cpp" + "dequantize_per_tensor.cpp" + "quantized_matmul_out.cpp" +) +target_include_directories( + custom_ops PUBLIC ${ROOT_DIR}/.. ${CMAKE_BINARY_DIR} + ${_common_include_directories} +) target_link_libraries(custom_ops PUBLIC executorch) target_link_libraries(custom_ops PRIVATE cadence_kernels) @@ -82,12 +90,11 @@ gen_selected_ops( "${CMAKE_CURRENT_LIST_DIR}/../../aot/functions.yaml" "" "" ) generate_bindings_for_kernels( - LIB_NAME "cadence_ops_lib" OPS_SCHEMA_YAML - FUNCTIONS_YAML ${CMAKE_CURRENT_SOURCE_DIR}/../../aot/functions.yaml + LIB_NAME "cadence_ops_lib" OPS_SCHEMA_YAML FUNCTIONS_YAML + ${CMAKE_CURRENT_SOURCE_DIR}/../../aot/functions.yaml ) message("Generated cadence x86 files ${gen_command_sources}") gen_operators_lib( - LIB_NAME "cadence_ops_lib" - KERNEL_LIBS custom_ops - DEPS aten_ops_cadence) + LIB_NAME "cadence_ops_lib" KERNEL_LIBS custom_ops DEPS aten_ops_cadence +) diff --git a/backends/mediatek/CMakeLists.txt b/backends/mediatek/CMakeLists.txt index 7e36746bca..4b233d94f0 100644 --- a/backends/mediatek/CMakeLists.txt +++ b/backends/mediatek/CMakeLists.txt @@ -10,41 +10,35 @@ # Let include directory as "executorch/..." set(_common_include_directories ${CMAKE_CURRENT_SOURCE_DIR}/../../..) -set(NEURON_BUFFER_ALLOCATOR_LIB "" CACHE PATH "Path to Neuron Buffer Allocator library") -message(STATUS "Looking for neuron_buffer_allocator in ${NEURON_BUFFER_ALLOCATOR_LIB}") - -include_directories( - BEFORE - ${_common_include_directories} +set(NEURON_BUFFER_ALLOCATOR_LIB + "" + CACHE PATH "Path to Neuron Buffer Allocator library" +) +message( + STATUS "Looking for neuron_buffer_allocator in ${NEURON_BUFFER_ALLOCATOR_LIB}" ) +include_directories(BEFORE ${_common_include_directories}) + # shortcut include directory for neuron headers -include_directories( - BEFORE - ${CMAKE_CURRENT_SOURCE_DIR}/runtime/include -) +include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/runtime/include) # targets add_library(neuron_backend SHARED) -target_link_libraries(neuron_backend - PRIVATE - executorch_no_prim_ops - portable_ops_lib - android - log - ${NEURON_BUFFER_ALLOCATOR_LIB} +target_link_libraries( + neuron_backend PRIVATE executorch_no_prim_ops portable_ops_lib android log + ${NEURON_BUFFER_ALLOCATOR_LIB} ) -target_sources(neuron_backend - INTERFACE - ${CMAKE_CURRENT_LIST_DIR}/runtime/include/NeuronBackend.h - ${CMAKE_CURRENT_LIST_DIR}/runtime/include/NeuronBufferAllocator.h - ${CMAKE_CURRENT_LIST_DIR}/runtime/include/NeuronExecutor.h - ${CMAKE_CURRENT_LIST_DIR}/runtime/include/NeuronLog.h - ${CMAKE_CURRENT_LIST_DIR}/runtime/include/api/APUWareUtilsLib.h - ${CMAKE_CURRENT_LIST_DIR}/runtime/include/api/NeuronAdapterShim.h - PRIVATE - ${CMAKE_CURRENT_LIST_DIR}/runtime/NeuronBackend.cpp - ${CMAKE_CURRENT_LIST_DIR}/runtime/NeuronExecutor.cpp +target_sources( + neuron_backend + INTERFACE ${CMAKE_CURRENT_LIST_DIR}/runtime/include/NeuronBackend.h + ${CMAKE_CURRENT_LIST_DIR}/runtime/include/NeuronBufferAllocator.h + ${CMAKE_CURRENT_LIST_DIR}/runtime/include/NeuronExecutor.h + ${CMAKE_CURRENT_LIST_DIR}/runtime/include/NeuronLog.h + ${CMAKE_CURRENT_LIST_DIR}/runtime/include/api/APUWareUtilsLib.h + ${CMAKE_CURRENT_LIST_DIR}/runtime/include/api/NeuronAdapterShim.h + PRIVATE ${CMAKE_CURRENT_LIST_DIR}/runtime/NeuronBackend.cpp + ${CMAKE_CURRENT_LIST_DIR}/runtime/NeuronExecutor.cpp ) target_link_options_shared_lib(neuron_backend) diff --git a/backends/qualcomm/CMakeLists.txt b/backends/qualcomm/CMakeLists.txt index babdb96d8b..8c62b025bc 100644 --- a/backends/qualcomm/CMakeLists.txt +++ b/backends/qualcomm/CMakeLists.txt @@ -66,9 +66,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Release") add_link_options("-s") # --gc-sections is added by torch. - add_compile_options( - "-O3" "-ffunction-sections" "-fdata-sections" "-frtti" - ) + add_compile_options("-O3" "-ffunction-sections" "-fdata-sections" "-frtti") endif() include_directories( @@ -261,11 +259,8 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64") if(CMAKE_BUILD_TYPE STREQUAL "Release") # need to allow exceptions in pybind - set(_pybind_compile_options - -Wno-deprecated-declarations - -fPIC - -frtti - -fexceptions + set(_pybind_compile_options -Wno-deprecated-declarations -fPIC -frtti + -fexceptions ) target_compile_options( PyQnnManagerAdaptor PUBLIC ${_pybind_compile_options} diff --git a/backends/vulkan/cmake/ShaderLibrary.cmake b/backends/vulkan/cmake/ShaderLibrary.cmake index 49dc27056a..b44736d20d 100644 --- a/backends/vulkan/cmake/ShaderLibrary.cmake +++ b/backends/vulkan/cmake/ShaderLibrary.cmake @@ -50,8 +50,8 @@ function(gen_vulkan_shader_lib_cpp shaders_path) execute_process( COMMAND "${PYTHON_EXECUTABLE}" - ${EXECUTORCH_ROOT}/backends/vulkan/runtime/gen_vulkan_spv.py - --glsl-path ${shaders_path} --output-path ${VULKAN_SHADERGEN_OUT_PATH} + ${EXECUTORCH_ROOT}/backends/vulkan/runtime/gen_vulkan_spv.py --glsl-path + ${shaders_path} --output-path ${VULKAN_SHADERGEN_OUT_PATH} --glslc-path=${GLSLC_PATH} --tmp-dir-path=${VULKAN_SHADERGEN_OUT_PATH} --env ${VULKAN_GEN_ARG_ENV} RESULT_VARIABLE error_code diff --git a/backends/xnnpack/CMakeLists.txt b/backends/xnnpack/CMakeLists.txt index a5b12d6579..98870bf0e1 100644 --- a/backends/xnnpack/CMakeLists.txt +++ b/backends/xnnpack/CMakeLists.txt @@ -32,9 +32,11 @@ if(NOT PYTHON_EXECUTABLE) resolve_python_executable() endif() -# NB: Enabling this will serialize execution of delegate instances -# Keeping this OFF by default to maintain existing behavior, to be revisited. -option(EXECUTORCH_XNNPACK_SHARED_WORKSPACE "Enable workspace sharing across different delegate instances" OFF) +# NB: Enabling this will serialize execution of delegate instances Keeping this +# OFF by default to maintain existing behavior, to be revisited. +option(EXECUTORCH_XNNPACK_SHARED_WORKSPACE + "Enable workspace sharing across different delegate instances" OFF +) if(EXECUTORCH_XNNPACK_SHARED_WORKSPACE) add_definitions(-DENABLE_XNNPACK_SHARED_WORKSPACE) endif() diff --git a/build/Codegen.cmake b/build/Codegen.cmake index 818deb1758..381cd0958f 100644 --- a/build/Codegen.cmake +++ b/build/Codegen.cmake @@ -78,7 +78,8 @@ function(generate_bindings_for_kernels) # Executorch runtime. execute_process( COMMAND - "${PYTHON_EXECUTABLE}" -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())" + "${PYTHON_EXECUTABLE}" -c + "from distutils.sysconfig import get_python_lib;print(get_python_lib())" OUTPUT_VARIABLE site-packages-out ERROR_VARIABLE site-packages-out-error RESULT_VARIABLE site-packages-result diff --git a/build/Test.cmake b/build/Test.cmake index b2b23cb03a..20d5cc58f8 100644 --- a/build/Test.cmake +++ b/build/Test.cmake @@ -5,8 +5,8 @@ # LICENSE file in the root directory of this source tree. # -# This file is intended to have helper functions for test-related -# CMakeLists.txt files. +# This file is intended to have helper functions for test-related CMakeLists.txt +# files. # # ### Editing this file ### # @@ -33,53 +33,56 @@ target_link_options_shared_lib(quantized_ops_lib) # Add code coverage flags to supported compilers if(EXECUTORCH_USE_CPP_CODE_COVERAGE) if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - string(APPEND CMAKE_C_FLAGS " --coverage -fprofile-abs-path") - string(APPEND CMAKE_CXX_FLAGS " --coverage -fprofile-abs-path") + string(APPEND CMAKE_C_FLAGS " --coverage -fprofile-abs-path") + string(APPEND CMAKE_CXX_FLAGS " --coverage -fprofile-abs-path") elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") - string(APPEND CMAKE_C_FLAGS " -fprofile-instr-generate -fcoverage-mapping") - string(APPEND CMAKE_CXX_FLAGS " -fprofile-instr-generate -fcoverage-mapping") + string(APPEND CMAKE_C_FLAGS " -fprofile-instr-generate -fcoverage-mapping") + string(APPEND CMAKE_CXX_FLAGS + " -fprofile-instr-generate -fcoverage-mapping" + ) else() - message(ERROR "Code coverage for compiler ${CMAKE_CXX_COMPILER_ID} is unsupported") + message(ERROR + "Code coverage for compiler ${CMAKE_CXX_COMPILER_ID} is unsupported" + ) endif() endif() -# A helper function to generate a gtest cxx executable target -# @param target_name: name for the executable -# @param SOURCES : test sources to be compiled. Sometimes -# util sources are used as well -# @param EXTRA LIBS : additional libraries to be linked against -# the target. gtest, gmock, executorch are linked by default, but Sometimes -# user may need additional libraries like kernels. -# We use CMake package executorch in this helper, so user can easily add -# installed libraries. +# A helper function to generate a gtest cxx executable target @param +# target_name: name for the executable @param SOURCES : test +# sources to be compiled. Sometimes util sources are used as well @param EXTRA +# LIBS : additional libraries to be linked against the target. +# gtest, gmock, executorch are linked by default, but Sometimes user may need +# additional libraries like kernels. We use CMake package executorch in this +# helper, so user can easily add installed libraries. # -# Example: -# et_cxx_test(my_test SOURCES my_test.cpp EXTRA_LIBS portable_kernels) +# Example: et_cxx_test(my_test SOURCES my_test.cpp EXTRA_LIBS portable_kernels) # # This defines a gtest executable my_test, compiling my_test.cpp, and linking # against libportable_kernels.a. # function(et_cxx_test target_name) -set(multi_arg_names SOURCES EXTRA_LIBS) -cmake_parse_arguments(ET_CXX_TEST "" "" "${multi_arg_names}" ${ARGN}) + set(multi_arg_names SOURCES EXTRA_LIBS) + cmake_parse_arguments(ET_CXX_TEST "" "" "${multi_arg_names}" ${ARGN}) -# Let files say "include ". -target_include_directories(executorch INTERFACE ${EXECUTORCH_ROOT}/..) + # Let files say "include ". + target_include_directories(executorch INTERFACE ${EXECUTORCH_ROOT}/..) -set(ET_TEST_UTIL_SOURCES ${EXECUTORCH_ROOT}/runtime/core/exec_aten/testing_util/tensor_util.cpp) + set(ET_TEST_UTIL_SOURCES + ${EXECUTORCH_ROOT}/runtime/core/exec_aten/testing_util/tensor_util.cpp + ) -add_executable(${target_name} ${ET_CXX_TEST_SOURCES} ${ET_TEST_UTIL_SOURCES}) -# Includes gtest, gmock, executorch by default -target_link_libraries( - ${target_name} GTest::gtest GTest::gtest_main GTest::gmock executorch - ${ET_CXX_TEST_EXTRA_LIBS} -) + add_executable(${target_name} ${ET_CXX_TEST_SOURCES} ${ET_TEST_UTIL_SOURCES}) + # Includes gtest, gmock, executorch by default + target_link_libraries( + ${target_name} GTest::gtest GTest::gtest_main GTest::gmock executorch + ${ET_CXX_TEST_EXTRA_LIBS} + ) -# add_test adds a test target to be used by ctest. -# We use `ExecuTorchTest` as the ctest target name for the test executable -# Usage: cd cmake-out/path/to/test/; ctest -# Note: currently we directly invoke the test target, without using ctest -add_test(ExecuTorchTest ${target_name}) + # add_test adds a test target to be used by ctest. We use `ExecuTorchTest` as + # the ctest target name for the test executable Usage: cd + # cmake-out/path/to/test/; ctest Note: currently we directly invoke the test + # target, without using ctest + add_test(ExecuTorchTest ${target_name}) endfunction() diff --git a/devtools/CMakeLists.txt b/devtools/CMakeLists.txt index 4c4d15fd73..776d421a8d 100644 --- a/devtools/CMakeLists.txt +++ b/devtools/CMakeLists.txt @@ -92,11 +92,11 @@ if(EXECUTORCH_SEPARATE_FLATCC_HOST_PROJECT) # headers on the host during the build, even if we're cross-compiling the # flatcc runtime to a different architecture. execute_process( - COMMAND ${CMAKE_COMMAND} ${_flatcc_source_dir} - -DFLATCC_TEST=OFF -DFLATCC_REFLECTION=OFF - # See above comment about POSITION_INDEPENDENT_CODE. - -DCMAKE_POSITION_INDEPENDENT_CODE=ON - -B${CMAKE_BINARY_DIR}/_host_build + COMMAND + ${CMAKE_COMMAND} ${_flatcc_source_dir} -DFLATCC_TEST=OFF + -DFLATCC_REFLECTION=OFF + # See above comment about POSITION_INDEPENDENT_CODE. + -DCMAKE_POSITION_INDEPENDENT_CODE=ON -B${CMAKE_BINARY_DIR}/_host_build ) execute_process( COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR}/_host_build diff --git a/examples/arm/executor_runner/CMakeLists.txt b/examples/arm/executor_runner/CMakeLists.txt index 1f42eda9fb..136f72ee75 100644 --- a/examples/arm/executor_runner/CMakeLists.txt +++ b/examples/arm/executor_runner/CMakeLists.txt @@ -9,25 +9,38 @@ project(arm_executor_runner) option(SEMIHOSTING "Enable semihosting" OFF) if(NOT DEFINED ET_PTE_FILE_PATH AND NOT ${SEMIHOSTING}) - message(FATAL_ERROR - "ET_PTE_FILE_PATH must specify a model .pte, for bare metal systems the " - "model is built into the binary.") + message( + FATAL_ERROR + "ET_PTE_FILE_PATH must specify a model .pte, for bare metal systems the " + "model is built into the binary." + ) endif() # Example ExecuTorch demo for bare metal Cortex-M based systems -set(ET_DIR_PATH "../../.." CACHE PATH - "Path to ExecuTorch dir") -set(ET_BUILD_DIR_PATH "${ET_DIR_PATH}/cmake-out" CACHE PATH - "Path to ExecuTorch build dir") -set(ET_INCLUDE_PATH "${ET_DIR_PATH}/.." CACHE PATH - "Path to ExecuTorch headers") -set(ET_PTE_FILE_PATH "" CACHE PATH - "Path to ExecuTorch model pte") -set(ETHOS_SDK_PATH "${ET_DIR_PATH}/examples/arm/ethos-u-scratch/ethos-u" CACHE PATH - "Path to Ethos-U bare metal driver/env") -set(PYTHON_EXECUTABLE "python" CACHE PATH - "Define to override python executable used") - +set(ET_DIR_PATH + "../../.." + CACHE PATH "Path to ExecuTorch dir" +) +set(ET_BUILD_DIR_PATH + "${ET_DIR_PATH}/cmake-out" + CACHE PATH "Path to ExecuTorch build dir" +) +set(ET_INCLUDE_PATH + "${ET_DIR_PATH}/.." + CACHE PATH "Path to ExecuTorch headers" +) +set(ET_PTE_FILE_PATH + "" + CACHE PATH "Path to ExecuTorch model pte" +) +set(ETHOS_SDK_PATH + "${ET_DIR_PATH}/examples/arm/ethos-u-scratch/ethos-u" + CACHE PATH "Path to Ethos-U bare metal driver/env" +) +set(PYTHON_EXECUTABLE + "python" + CACHE PATH "Define to override python executable used" +) get_filename_component(ET_BUILD_DIR_PATH ${ET_BUILD_DIR_PATH} REALPATH) get_filename_component(ET_DIR_PATH ${ET_DIR_PATH} REALPATH) @@ -104,16 +117,16 @@ set_property( # Convert pte to header if(NOT ${SEMIHOSTING}) - add_custom_target(gen_model_header - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/model_pte.h) + add_custom_target( + gen_model_header DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/model_pte.h + ) add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/model_pte.h - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/pte_to_header.py - --pte ${ET_PTE_FILE_PATH} - --outdir ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS ${ET_PTE_FILE_PATH} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/model_pte.h + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/pte_to_header.py --pte + ${ET_PTE_FILE_PATH} --outdir ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS ${ET_PTE_FILE_PATH} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) endif() @@ -146,19 +159,17 @@ target_include_directories( arm_executor_runner PRIVATE ${ET_INCLUDE_PATH} ${CMAKE_CURRENT_BINARY_DIR} ) - - if(SEMIHOSTING) -target_compile_definitions(arm_executor_runner PUBLIC SEMIHOSTING) + target_compile_definitions(arm_executor_runner PUBLIC SEMIHOSTING) else() -add_dependencies(arm_executor_runner gen_model_header) + add_dependencies(arm_executor_runner gen_model_header) endif() # Fixup compilation of retarget.c if(SEMIHOSTING) -# Remove this when MLBEDSW-8910 is closed. -set_source_files_properties( - ${ETHOS_SDK_PATH}/core_platform/targets/corstone-300/retarget.c - PROPERTIES HEADER_FILE_ONLY TRUE -) + # Remove this when MLBEDSW-8910 is closed. + set_source_files_properties( + ${ETHOS_SDK_PATH}/core_platform/targets/corstone-300/retarget.c + PROPERTIES HEADER_FILE_ONLY TRUE + ) endif() diff --git a/examples/mediatek/CMakeLists.txt b/examples/mediatek/CMakeLists.txt index 966fecb066..2abee59759 100644 --- a/examples/mediatek/CMakeLists.txt +++ b/examples/mediatek/CMakeLists.txt @@ -1,8 +1,8 @@ - # Copyright (c) 2024 MediaTek Inc. - # - # Licensed under the BSD License (the "License"); you may not use this file - # except in compliance with the License. See the license file in the root - # directory of this source tree for more details. +# Copyright (c) 2024 MediaTek Inc. +# +# Licensed under the BSD License (the "License"); you may not use this file +# except in compliance with the License. See the license file in the root +# directory of this source tree for more details. cmake_minimum_required(VERSION 3.19) project(mediatek_example) @@ -49,117 +49,93 @@ find_package(gflags REQUIRED) link_directories(${EXECUTORCH_ROOT}/cmake-android-out/lib) if(${ANDROID}) - message("Build MTK Android Examples") - - get_filename_component(EXECUTORCH_SOURCE_DIR - "${CMAKE_CURRENT_LIST_DIR}/../.." - ABSOLUTE - ) - set(_mtk_executor_runner__srcs ${_executor_runner__srcs}) - list( - TRANSFORM - _mtk_executor_runner__srcs - PREPEND - "${EXECUTORCH_SOURCE_DIR}/" - ) - list( - FILTER - _mtk_executor_runner__srcs - EXCLUDE REGEX - ".*executor_runner.cpp$" - ) - list( - PREPEND - _mtk_executor_runner__srcs - ${CMAKE_CURRENT_LIST_DIR}/executor_runner/mtk_executor_runner.cpp - ) - - add_executable(mtk_executor_runner ${_mtk_executor_runner__srcs}) - - target_include_directories(mtk_executor_runner - PUBLIC - ${_common_include_directories} - ${EXECUTORCH_ROOT}/cmake-android-out/third-party/gflags/include - ) - - target_link_libraries(mtk_executor_runner - ${_executor_runner_libs} - executorch - neuron_backend - gflags - ) - target_compile_options(mtk_executor_runner - PUBLIC - ${_common_compile_options} - ) - - set(_mtk_llama_executor_runner__srcs ${_mtk_executor_runner__srcs}) - list( - FILTER - _mtk_llama_executor_runner__srcs - EXCLUDE REGEX - ".*executor_runner.cpp$" - ) - list( - PREPEND - _mtk_llama_executor_runner__srcs - ${CMAKE_CURRENT_LIST_DIR}/executor_runner/mtk_llama_executor_runner.cpp - ) - # Build ABSL and RE2 - set(EXTENSIONS_LLM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../extension/llm) - set(THIRD_PARTY_ABSL_DIR ${EXTENSIONS_LLM_DIR}/third-party/abseil-cpp) - set(THIRD_PARTY_RE2_DIR ${EXTENSIONS_LLM_DIR}/third-party/re2) - set(ABSL_ENABLE_INSTALL ON) - set(ABSL_PROPAGATE_CXX_STD ON) - set(_pic_flag ${CMAKE_POSITION_INDEPENDENT_CODE}) - set(CMAKE_POSITION_INDEPENDENT_CODE ON) - add_subdirectory(${THIRD_PARTY_ABSL_DIR} ${CMAKE_CURRENT_BINARY_DIR}/third-party/abseil) - add_subdirectory(${THIRD_PARTY_RE2_DIR} ${CMAKE_CURRENT_BINARY_DIR}/third-party/re2) - set(CMAKE_POSITION_INDEPENDENT_CODE ${_pic_flag}) - - # Build tokenizers - set(LLAMA2_TOKENIZER_DIR ${EXTENSIONS_LLM_DIR}/tokenizer) - add_library(tokenizer STATIC) - target_include_directories(tokenizer - PUBLIC - ${_common_include_directories} - ${THIRD_PARTY_ABSL_DIR} - ${THIRD_PARTY_RE2_DIR} - ) - target_link_libraries(tokenizer - PRIVATE - re2::re2 - ) - target_sources(tokenizer - PRIVATE - ${LLAMA2_TOKENIZER_DIR}/tiktoken.cpp - ${LLAMA2_TOKENIZER_DIR}/bpe_tokenizer.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/../models/llama2/tokenizer/llama_tiktoken.cpp - ) - - # Include directory for neuron headers - include_directories( - BEFORE - ${_common_include_directories} - ${CMAKE_CURRENT_SOURCE_DIR}/../../backends/mediatek/runtime/include - ) - - # Build Llama Executor static library - add_subdirectory(executor_runner/llama_runner) - - # Build Llama Executor Runner - add_executable(mtk_llama_executor_runner ${_mtk_llama_executor_runner__srcs}) - - target_link_libraries(mtk_llama_executor_runner - ${_executor_runner_libs} - ${NEURON_BUFFER_ALLOCATOR_LIB} - neuron_backend - gflags - mtk_llama_executor_lib - tokenizer - ) - target_compile_options(mtk_llama_executor_runner - PUBLIC - ${_common_compile_options} - ) + message("Build MTK Android Examples") + + get_filename_component( + EXECUTORCH_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE + ) + set(_mtk_executor_runner__srcs ${_executor_runner__srcs}) + list(TRANSFORM _mtk_executor_runner__srcs PREPEND "${EXECUTORCH_SOURCE_DIR}/") + list(FILTER _mtk_executor_runner__srcs EXCLUDE REGEX ".*executor_runner.cpp$") + list(PREPEND _mtk_executor_runner__srcs + ${CMAKE_CURRENT_LIST_DIR}/executor_runner/mtk_executor_runner.cpp + ) + + add_executable(mtk_executor_runner ${_mtk_executor_runner__srcs}) + + target_include_directories( + mtk_executor_runner + PUBLIC ${_common_include_directories} + ${EXECUTORCH_ROOT}/cmake-android-out/third-party/gflags/include + ) + + target_link_libraries( + mtk_executor_runner ${_executor_runner_libs} executorch neuron_backend + gflags + ) + target_compile_options(mtk_executor_runner PUBLIC ${_common_compile_options}) + + set(_mtk_llama_executor_runner__srcs ${_mtk_executor_runner__srcs}) + list(FILTER _mtk_llama_executor_runner__srcs EXCLUDE REGEX + ".*executor_runner.cpp$" + ) + list(PREPEND _mtk_llama_executor_runner__srcs + ${CMAKE_CURRENT_LIST_DIR}/executor_runner/mtk_llama_executor_runner.cpp + ) + # Build ABSL and RE2 + set(EXTENSIONS_LLM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../extension/llm) + set(THIRD_PARTY_ABSL_DIR ${EXTENSIONS_LLM_DIR}/third-party/abseil-cpp) + set(THIRD_PARTY_RE2_DIR ${EXTENSIONS_LLM_DIR}/third-party/re2) + set(ABSL_ENABLE_INSTALL ON) + set(ABSL_PROPAGATE_CXX_STD ON) + set(_pic_flag ${CMAKE_POSITION_INDEPENDENT_CODE}) + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + add_subdirectory( + ${THIRD_PARTY_ABSL_DIR} ${CMAKE_CURRENT_BINARY_DIR}/third-party/abseil + ) + add_subdirectory( + ${THIRD_PARTY_RE2_DIR} ${CMAKE_CURRENT_BINARY_DIR}/third-party/re2 + ) + set(CMAKE_POSITION_INDEPENDENT_CODE ${_pic_flag}) + + # Build tokenizers + set(LLAMA2_TOKENIZER_DIR ${EXTENSIONS_LLM_DIR}/tokenizer) + add_library(tokenizer STATIC) + target_include_directories( + tokenizer PUBLIC ${_common_include_directories} ${THIRD_PARTY_ABSL_DIR} + ${THIRD_PARTY_RE2_DIR} + ) + target_link_libraries(tokenizer PRIVATE re2::re2) + target_sources( + tokenizer + PRIVATE + ${LLAMA2_TOKENIZER_DIR}/tiktoken.cpp + ${LLAMA2_TOKENIZER_DIR}/bpe_tokenizer.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../models/llama2/tokenizer/llama_tiktoken.cpp + ) + + # Include directory for neuron headers + include_directories( + BEFORE ${_common_include_directories} + ${CMAKE_CURRENT_SOURCE_DIR}/../../backends/mediatek/runtime/include + ) + + # Build Llama Executor static library + add_subdirectory(executor_runner/llama_runner) + + # Build Llama Executor Runner + add_executable(mtk_llama_executor_runner ${_mtk_llama_executor_runner__srcs}) + + target_link_libraries( + mtk_llama_executor_runner + ${_executor_runner_libs} + ${NEURON_BUFFER_ALLOCATOR_LIB} + neuron_backend + gflags + mtk_llama_executor_lib + tokenizer + ) + target_compile_options( + mtk_llama_executor_runner PUBLIC ${_common_compile_options} + ) endif() diff --git a/examples/mediatek/executor_runner/llama_runner/CMakeLists.txt b/examples/mediatek/executor_runner/llama_runner/CMakeLists.txt index fe809ef133..9d27e685f3 100644 --- a/examples/mediatek/executor_runner/llama_runner/CMakeLists.txt +++ b/examples/mediatek/executor_runner/llama_runner/CMakeLists.txt @@ -1,66 +1,41 @@ - # Copyright (c) 2024 MediaTek Inc. - # - # Licensed under the BSD License (the "License"); you may not use this file - # except in compliance with the License. See the license file in the root - # directory of this source tree for more details. +# Copyright (c) 2024 MediaTek Inc. +# +# Licensed under the BSD License (the "License"); you may not use this file +# except in compliance with the License. See the license file in the root +# directory of this source tree for more details. # Let include directory as "executorch/..." set(_common_include_directories ${CMAKE_CURRENT_SOURCE_DIR}/../../../..) -include_directories( - BEFORE - ${_common_include_directories} -) +include_directories(BEFORE ${_common_include_directories}) # shortcut include directory for neuron headers include_directories( - BEFORE - ${_common_include_directories}/backends/mediatek/runtime/include + BEFORE ${_common_include_directories}/backends/mediatek/runtime/include ) add_library(llm_helper STATIC) -target_sources(llm_helper - PRIVATE - llm_helper/mask_builder.cpp - llm_helper/rotary_embedding.cpp - llm_helper/token_embedding.cpp +target_sources( + llm_helper + PRIVATE llm_helper/mask_builder.cpp llm_helper/rotary_embedding.cpp + llm_helper/token_embedding.cpp ) -target_link_libraries(llm_helper - PRIVATE - executorch -) -target_include_directories(llm_helper - PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR} - llm_helper/include -) -target_compile_options(llm_helper - PRIVATE - ${_common_compile_options} +target_link_libraries(llm_helper PRIVATE executorch) +target_include_directories( + llm_helper PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} llm_helper/include ) +target_compile_options(llm_helper PRIVATE ${_common_compile_options}) add_library(mtk_llama_executor_lib STATIC) -target_link_libraries(mtk_llama_executor_lib - PRIVATE - ${_executor_runner_libs} - ${NEURON_BUFFER_ALLOCATOR_LIB} - neuron_backend - log - llm_helper -) -target_sources(mtk_llama_executor_lib - INTERFACE - MultiModelLoader.h - ModelChunk.h - LlamaModelChunk.h - LlamaRuntime.h - PRIVATE - MultiModelLoader.cpp - ModelChunk.cpp - LlamaModelChunk.cpp - LlamaRuntime.cpp -) -target_compile_options(mtk_llama_executor_lib - PUBLIC - ${_common_compile_options} -) +target_link_libraries( + mtk_llama_executor_lib + PRIVATE ${_executor_runner_libs} ${NEURON_BUFFER_ALLOCATOR_LIB} + neuron_backend log llm_helper +) +target_sources( + mtk_llama_executor_lib + INTERFACE MultiModelLoader.h ModelChunk.h LlamaModelChunk.h LlamaRuntime.h + PRIVATE MultiModelLoader.cpp ModelChunk.cpp LlamaModelChunk.cpp + LlamaRuntime.cpp +) +target_compile_options(mtk_llama_executor_lib PUBLIC ${_common_compile_options}) diff --git a/examples/models/llama2/runner/CMakeLists.txt b/examples/models/llama2/runner/CMakeLists.txt index 2c9696f69e..c99a54982a 100644 --- a/examples/models/llama2/runner/CMakeLists.txt +++ b/examples/models/llama2/runner/CMakeLists.txt @@ -42,8 +42,9 @@ target_include_directories( ) if(EXECUTORCH_USE_TIKTOKEN) - list(APPEND _llama_runner__srcs - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../extension/llm/tokenizer/tiktoken.cpp + list( + APPEND _llama_runner__srcs + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../extension/llm/tokenizer/tiktoken.cpp ) list(APPEND _llama_runner__srcs ${CMAKE_CURRENT_SOURCE_DIR}/../tokenizer/llama_tiktoken.cpp diff --git a/examples/models/llava/CMakeLists.txt b/examples/models/llava/CMakeLists.txt index a1a6fc8c93..9d7e47812e 100644 --- a/examples/models/llava/CMakeLists.txt +++ b/examples/models/llava/CMakeLists.txt @@ -21,7 +21,6 @@ project(llava) # Duplicating options as root CMakeLists.txt option(EXECUTORCH_BUILD_KERNELS_OPTIMIZED "Build the optimized kernels" OFF) - include(CMakeDependentOption) # # pthreadpool: build pthreadpool library. Disable on unsupported platforms diff --git a/examples/qualcomm/CMakeLists.txt b/examples/qualcomm/CMakeLists.txt index 94af209cb6..542d7f0346 100644 --- a/examples/qualcomm/CMakeLists.txt +++ b/examples/qualcomm/CMakeLists.txt @@ -41,7 +41,7 @@ set(_common_include_directories ${EXECUTORCH_ROOT}/..) # The `__srcs` lists are defined by including ${EXECUTORCH_SRCS_FILE}. # set(EXECUTORCH_SRCS_FILE - "${CMAKE_CURRENT_BINARY_DIR}/../../executorch_srcs.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/../../executorch_srcs.cmake" ) extract_sources(${EXECUTORCH_SRCS_FILE}) include(${EXECUTORCH_SRCS_FILE}) @@ -50,7 +50,6 @@ get_filename_component( EXECUTORCH_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE ) - # portable_ops_lib gen_selected_ops(LIB_NAME "full_portable_ops_lib" INCLUDE_ALL_OPS "ON") generate_bindings_for_kernels( @@ -68,21 +67,13 @@ target_include_directories( ) # build qnn_executor_runner -add_subdirectory( - ${CMAKE_CURRENT_SOURCE_DIR}/executor_runner -) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/executor_runner) # build qnn_llama_runner -add_subdirectory( - ${CMAKE_CURRENT_SOURCE_DIR}/oss_scripts/llama2 -) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/oss_scripts/llama2) # build qaihub_llama2_7b_runner and qaihub_llama3_8b_runner -add_subdirectory( - ${CMAKE_CURRENT_SOURCE_DIR}/qaihub_scripts/llama -) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/qaihub_scripts/llama) # build qaihub_stable_diffusion_runner -add_subdirectory( - ${CMAKE_CURRENT_SOURCE_DIR}/qaihub_scripts/stable_diffusion -) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/qaihub_scripts/stable_diffusion) diff --git a/examples/qualcomm/executor_runner/CMakeLists.txt b/examples/qualcomm/executor_runner/CMakeLists.txt index 73106d9368..b950a4f82f 100644 --- a/examples/qualcomm/executor_runner/CMakeLists.txt +++ b/examples/qualcomm/executor_runner/CMakeLists.txt @@ -9,7 +9,9 @@ set(_qnn_executor_runner__srcs ${_executor_runner__srcs}) # preprocess executor runner src files list(TRANSFORM _qnn_executor_runner__srcs PREPEND "${EXECUTORCH_SOURCE_DIR}/") list(FILTER _qnn_executor_runner__srcs EXCLUDE REGEX ".*executor_runner.cpp$") -list(PREPEND _qnn_executor_runner__srcs ${CMAKE_CURRENT_LIST_DIR}/qnn_executor_runner.cpp) +list(PREPEND _qnn_executor_runner__srcs + ${CMAKE_CURRENT_LIST_DIR}/qnn_executor_runner.cpp +) # build executor runner add_executable(qnn_executor_runner ${_qnn_executor_runner__srcs}) diff --git a/examples/qualcomm/oss_scripts/llama2/CMakeLists.txt b/examples/qualcomm/oss_scripts/llama2/CMakeLists.txt index 2f13f017d3..7b59120d71 100644 --- a/examples/qualcomm/oss_scripts/llama2/CMakeLists.txt +++ b/examples/qualcomm/oss_scripts/llama2/CMakeLists.txt @@ -9,25 +9,21 @@ set(_qnn_llama_runner__srcs ${_llama_runner__srcs}) # preprocess qnn llama runner src files list(TRANSFORM _qnn_llama_runner__srcs PREPEND "${EXECUTORCH_SOURCE_DIR}/") list(FILTER _qnn_llama_runner__srcs EXCLUDE REGEX ".*(/runner/).*") -list(PREPEND _qnn_llama_runner__srcs +list( + PREPEND + _qnn_llama_runner__srcs ${CMAKE_CURRENT_LIST_DIR}/qnn_llama_runner.cpp ${CMAKE_CURRENT_LIST_DIR}/runner/runner.cpp ${CMAKE_CURRENT_LIST_DIR}/runner/runner.h ) - # build qnn llama runner add_executable(qnn_llama_runner ${_qnn_llama_runner__srcs}) target_include_directories( qnn_llama_runner PUBLIC ${_common_include_directories} ) -target_link_libraries(qnn_llama_runner - qnn_executorch_backend - full_portable_ops_lib - extension_data_loader - extension_module - gflags -) -target_compile_options(qnn_llama_runner - PUBLIC ${_common_compile_options} +target_link_libraries( + qnn_llama_runner qnn_executorch_backend full_portable_ops_lib + extension_data_loader extension_module gflags ) +target_compile_options(qnn_llama_runner PUBLIC ${_common_compile_options}) diff --git a/examples/qualcomm/qaihub_scripts/llama/CMakeLists.txt b/examples/qualcomm/qaihub_scripts/llama/CMakeLists.txt index d2cbbc183c..674aa2b72f 100644 --- a/examples/qualcomm/qaihub_scripts/llama/CMakeLists.txt +++ b/examples/qualcomm/qaihub_scripts/llama/CMakeLists.txt @@ -6,45 +6,42 @@ # preprocess qaihub runner src files for llama2,3 set(_qaihub_llama_runner__srcs ${_llama_runner__srcs}) -list(TRANSFORM _qaihub_llama_runner__srcs PREPEND "${EXECUTORCH_SOURCE_DIR}/") -list(FILTER _qaihub_llama_runner__srcs EXCLUDE REGEX ".*(/runner/).*") -list(PREPEND _qaihub_llama_runner__srcs +list(TRANSFORM _qaihub_llama_runner__srcs PREPEND "${EXECUTORCH_SOURCE_DIR}/") +list(FILTER _qaihub_llama_runner__srcs EXCLUDE REGEX ".*(/runner/).*") +list( + PREPEND + _qaihub_llama_runner__srcs ${CMAKE_CURRENT_LIST_DIR}/runner/runner.cpp ${CMAKE_CURRENT_LIST_DIR}/runner/runner.h ${CMAKE_CURRENT_LIST_DIR}/runner/io_memory.cpp ${CMAKE_CURRENT_LIST_DIR}/runner/io_memory.h ) - # preprocess qaihub llama2 7b runner src files set(_qaihub_llama2_7b_runner__srcs ${_qaihub_llama_runner__srcs}) list(PREPEND _qaihub_llama2_7b_runner__srcs - ${CMAKE_CURRENT_LIST_DIR}/llama2/qaihub_llama2_7b_runner.cpp + ${CMAKE_CURRENT_LIST_DIR}/llama2/qaihub_llama2_7b_runner.cpp ) # build qaihub llama2 7b runner add_executable(qaihub_llama2_7b_runner ${_qaihub_llama2_7b_runner__srcs}) -target_include_directories(qaihub_llama2_7b_runner - PUBLIC ${_common_include_directories} +target_include_directories( + qaihub_llama2_7b_runner PUBLIC ${_common_include_directories} ) -target_link_libraries(qaihub_llama2_7b_runner - qnn_executorch_backend - executorch_no_prim_ops - extension_data_loader - extension_module - gflags +target_link_libraries( + qaihub_llama2_7b_runner qnn_executorch_backend executorch_no_prim_ops + extension_data_loader extension_module gflags ) -target_compile_options(qaihub_llama2_7b_runner - PUBLIC ${_common_compile_options} +target_compile_options( + qaihub_llama2_7b_runner PUBLIC ${_common_compile_options} ) - # preprocess qaihub llama3 8b runner src files set(_qaihub_llama3_8b_runner__srcs ${_qaihub_llama_runner__srcs}) list(PREPEND _qaihub_llama3_8b_runner__srcs - ${CMAKE_CURRENT_LIST_DIR}/llama3/qaihub_llama3_8b_runner.cpp + ${CMAKE_CURRENT_LIST_DIR}/llama3/qaihub_llama3_8b_runner.cpp ) # Adding a compile option to differentiate llama2 with llama3 logic @@ -65,23 +62,25 @@ add_subdirectory( ) set(CMAKE_POSITION_INDEPENDENT_CODE ${_pic_flag}) - -list(APPEND _qaihub_llama3_8b_runner__srcs +list( + APPEND _qaihub_llama3_8b_runner__srcs ${CMAKE_CURRENT_SOURCE_DIR}/../../../../extension/llm/tokenizer/tiktoken.cpp ) -list(APPEND _qaihub_llama3_8b_runner__srcs +list( + APPEND + _qaihub_llama3_8b_runner__srcs ${CMAKE_CURRENT_SOURCE_DIR}/../../../models/llama2/tokenizer/llama_tiktoken.cpp ) set(_preprocessor_flag -DET_USE_TIKTOKEN) - # build qaihub llama3 8b runner add_executable(qaihub_llama3_8b_runner ${_qaihub_llama3_8b_runner__srcs}) -target_include_directories(qaihub_llama3_8b_runner - PUBLIC ${_common_include_directories} +target_include_directories( + qaihub_llama3_8b_runner PUBLIC ${_common_include_directories} ) -target_link_libraries(qaihub_llama3_8b_runner +target_link_libraries( + qaihub_llama3_8b_runner qnn_executorch_backend executorch_no_prim_ops extension_data_loader @@ -89,6 +88,6 @@ target_link_libraries(qaihub_llama3_8b_runner gflags re2::re2 ) -target_compile_options(qaihub_llama3_8b_runner - PUBLIC ${_common_compile_options} +target_compile_options( + qaihub_llama3_8b_runner PUBLIC ${_common_compile_options} ) diff --git a/examples/qualcomm/qaihub_scripts/stable_diffusion/CMakeLists.txt b/examples/qualcomm/qaihub_scripts/stable_diffusion/CMakeLists.txt index c897f5f9f8..b0cec2d300 100644 --- a/examples/qualcomm/qaihub_scripts/stable_diffusion/CMakeLists.txt +++ b/examples/qualcomm/qaihub_scripts/stable_diffusion/CMakeLists.txt @@ -6,21 +6,22 @@ # preprocess qaihub_stable_diffusion_runner_src files set(_qaihub_stable_diffusion_runner__srcs - ${CMAKE_CURRENT_LIST_DIR}/qaihub_stable_diffusion_runner.cpp - ${CMAKE_CURRENT_LIST_DIR}/runner/runner.cpp - ${CMAKE_CURRENT_LIST_DIR}/runner/runner.h + ${CMAKE_CURRENT_LIST_DIR}/qaihub_stable_diffusion_runner.cpp + ${CMAKE_CURRENT_LIST_DIR}/runner/runner.cpp + ${CMAKE_CURRENT_LIST_DIR}/runner/runner.h ) # build qaihub_stable_diffusion_runner -add_executable(qaihub_stable_diffusion_runner ${_qaihub_stable_diffusion_runner__srcs}) -target_include_directories(qaihub_stable_diffusion_runner - PUBLIC ${_common_include_directories} +add_executable( + qaihub_stable_diffusion_runner ${_qaihub_stable_diffusion_runner__srcs} ) -target_link_libraries(qaihub_stable_diffusion_runner - qnn_executorch_backend - executorch_no_prim_ops - extension_data_loader - extension_module - gflags +target_include_directories( + qaihub_stable_diffusion_runner PUBLIC ${_common_include_directories} +) +target_link_libraries( + qaihub_stable_diffusion_runner qnn_executorch_backend executorch_no_prim_ops + extension_data_loader extension_module gflags +) +target_compile_options( + qaihub_stable_diffusion_runner PUBLIC ${_common_compile_options} ) -target_compile_options(qaihub_stable_diffusion_runner PUBLIC ${_common_compile_options}) diff --git a/examples/sdk/CMakeLists.txt b/examples/sdk/CMakeLists.txt index af7e9b15bc..29248d1073 100644 --- a/examples/sdk/CMakeLists.txt +++ b/examples/sdk/CMakeLists.txt @@ -65,26 +65,25 @@ target_link_libraries( ) if(EXECUTORCH_BUILD_COREML) -find_library(ACCELERATE_FRAMEWORK Accelerate) -find_library(COREML_FRAMEWORK CoreML) -find_library(FOUNDATION_FRAMEWORK Foundation) -find_library(SQLITE_LIBRARY sqlite3) - -set(PROTOBUF_LIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/../../backends/apple/coreml/third-party/coremltools/deps/protobuf/cmake) -find_library(PROTOBUF_LITE REQUIRED NAMES libprotobuf-lite.a PATHS ${PROTOBUF_LIB_DIR} NO_DEFAULT_PATH) - -target_link_libraries( - sdk_example_runner - "-Wl,-force_load" - coremldelegate -) - -target_link_libraries( - sdk_example_runner - ${PROTOBUF_LITE} - ${ACCELERATE_FRAMEWORK} - ${COREML_FRAMEWORK} - ${FOUNDATION_FRAMEWORK} - ${SQLITE_LIBRARY} -) + find_library(ACCELERATE_FRAMEWORK Accelerate) + find_library(COREML_FRAMEWORK CoreML) + find_library(FOUNDATION_FRAMEWORK Foundation) + find_library(SQLITE_LIBRARY sqlite3) + + set(PROTOBUF_LIB_DIR + ${CMAKE_CURRENT_BINARY_DIR}/../../backends/apple/coreml/third-party/coremltools/deps/protobuf/cmake + ) + find_library( + PROTOBUF_LITE REQUIRED + NAMES libprotobuf-lite.a + PATHS ${PROTOBUF_LIB_DIR} + NO_DEFAULT_PATH + ) + + target_link_libraries(sdk_example_runner "-Wl,-force_load" coremldelegate) + + target_link_libraries( + sdk_example_runner ${PROTOBUF_LITE} ${ACCELERATE_FRAMEWORK} + ${COREML_FRAMEWORK} ${FOUNDATION_FRAMEWORK} ${SQLITE_LIBRARY} + ) endif() diff --git a/exir/backend/test/demos/rpc/CMakeLists.txt b/exir/backend/test/demos/rpc/CMakeLists.txt index cf39248c38..cd1b6e73ff 100644 --- a/exir/backend/test/demos/rpc/CMakeLists.txt +++ b/exir/backend/test/demos/rpc/CMakeLists.txt @@ -26,10 +26,10 @@ include(${EXECUTORCH_ROOT}/build/Utils.cmake) set(_common_include_directories ${EXECUTORCH_ROOT}/..) set(_common_compile_options -Wno-deprecated-declarations -fPIC) -add_library(executor_backend STATIC ExecutorBackendRegister.cpp ExecutorBackend.cpp) -target_link_libraries( - executor_backend PRIVATE executorch_no_prim_ops +add_library( + executor_backend STATIC ExecutorBackendRegister.cpp ExecutorBackend.cpp ) +target_link_libraries(executor_backend PRIVATE executorch_no_prim_ops) target_include_directories( executor_backend PUBLIC ${_common_include_directories} @@ -38,4 +38,5 @@ install( TARGETS executor_backend DESTINATION lib INCLUDES - DESTINATION ${_common_include_directories}) + DESTINATION ${_common_include_directories} +) diff --git a/extension/llm/custom_ops/CMakeLists.txt b/extension/llm/custom_ops/CMakeLists.txt index 8edfbfc85b..c1ffa95460 100644 --- a/extension/llm/custom_ops/CMakeLists.txt +++ b/extension/llm/custom_ops/CMakeLists.txt @@ -80,16 +80,15 @@ if(EXECUTORCH_BUILD_KERNELS_CUSTOM_AOT) # Add a AOT library find_package(Torch CONFIG REQUIRED) add_library( - custom_ops_aot_lib SHARED ${_custom_ops__srcs} - ${CMAKE_CURRENT_SOURCE_DIR}/op_sdpa_aot.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/op_tile_crop.cpp + custom_ops_aot_lib SHARED + ${_custom_ops__srcs} ${CMAKE_CURRENT_SOURCE_DIR}/op_sdpa_aot.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/op_tile_crop.cpp ) target_include_directories( custom_ops_aot_lib PUBLIC "${_common_include_directories}" ) target_include_directories( - custom_ops_aot_lib - PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../../../include" + custom_ops_aot_lib PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../../../include" ) if(TARGET portable_lib) # If we have portable_lib built, custom_ops_aot_lib gives the ability to use @@ -103,8 +102,8 @@ if(EXECUTORCH_BUILD_KERNELS_CUSTOM_AOT) target_link_libraries(custom_ops_aot_lib PUBLIC cpublas torch) if(WIN32) - # There is no direct replacement for libpthread.so on Windows. - # For the Windows build, link directly against pthreadpool and cpuinfo. + # There is no direct replacement for libpthread.so on Windows. For the + # Windows build, link directly against pthreadpool and cpuinfo. target_link_libraries(custom_ops_aot_lib PUBLIC pthreadpool cpuinfo) endif() target_compile_options( diff --git a/kernels/prim_ops/test/CMakeLists.txt b/kernels/prim_ops/test/CMakeLists.txt index 93d53523a0..a25e15acc4 100644 --- a/kernels/prim_ops/test/CMakeLists.txt +++ b/kernels/prim_ops/test/CMakeLists.txt @@ -26,6 +26,4 @@ target_link_options_shared_lib(executorch) set(_test_srcs prim_ops_test.cpp) -et_cxx_test( - kernels_prim_ops_test SOURCES ${_test_srcs} -) +et_cxx_test(kernels_prim_ops_test SOURCES ${_test_srcs}) diff --git a/kernels/quantized/CMakeLists.txt b/kernels/quantized/CMakeLists.txt index dbc9edcb97..f073835c93 100644 --- a/kernels/quantized/CMakeLists.txt +++ b/kernels/quantized/CMakeLists.txt @@ -88,13 +88,14 @@ if(NOT CMAKE_GENERATOR STREQUAL "Xcode" LIB_NAME "quantized_ops_aot_lib" KERNEL_SOURCES "${_quantized_sources}" ) - # Register quantized ops to portable_lib, so that they're available - # via pybindings. + # Register quantized ops to portable_lib, so that they're available via + # pybindings. if(TARGET portable_lib) add_library(quantized_pybind_kernels_lib ${_quantized_kernels__srcs}) target_link_libraries(quantized_pybind_kernels_lib PRIVATE portable_lib) target_compile_options( - quantized_pybind_kernels_lib PUBLIC ${_common_compile_options}) + quantized_pybind_kernels_lib PUBLIC ${_common_compile_options} + ) target_include_directories( quantized_pybind_kernels_lib PUBLIC "${_common_include_directories}" ) @@ -104,18 +105,14 @@ if(NOT CMAKE_GENERATOR STREQUAL "Xcode" generate_bindings_for_kernels( LIB_NAME "quantized_ops_pybind_lib" CUSTOM_OPS_YAML "${_yaml_file}" ) - # Build a library for pybind usage. - # quantized_ops_pybind_lib: Register quantized ops kernels into - # Executorch runtime for pybind. + # Build a library for pybind usage. quantized_ops_pybind_lib: Register + # quantized ops kernels into Executorch runtime for pybind. gen_operators_lib( - LIB_NAME "quantized_ops_pybind_lib" - KERNEL_LIBS quantized_pybind_kernels_lib - DEPS portable_lib + LIB_NAME "quantized_ops_pybind_lib" KERNEL_LIBS + quantized_pybind_kernels_lib DEPS portable_lib ) target_link_libraries( - quantized_ops_aot_lib - PUBLIC - quantized_ops_pybind_lib + quantized_ops_aot_lib PUBLIC quantized_ops_pybind_lib ) endif() endif() diff --git a/kernels/test/CMakeLists.txt b/kernels/test/CMakeLists.txt index 92350a2c0d..791c2184e9 100644 --- a/kernels/test/CMakeLists.txt +++ b/kernels/test/CMakeLists.txt @@ -31,7 +31,8 @@ foreach(kernel ${_kernels}) add_custom_command( OUTPUT "${_wrapper_path}" COMMAND mkdir -p ${_wrapper_dir} - COMMAND echo "#include " > "${_wrapper_path}" + COMMAND echo "#include " > + "${_wrapper_path}" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" COMMENT "Generating ${_wrapper_path}" VERBATIM @@ -243,11 +244,19 @@ set(_optimized_kernels_test_sources ) # We don't have sleef on OSS so we don't have gelu and log_softmax -list(REMOVE_ITEM _optimized_kernels_test_sources "op_gelu_test.cpp" "op_log_softmax_test.cpp") +list(REMOVE_ITEM _optimized_kernels_test_sources "op_gelu_test.cpp" + "op_log_softmax_test.cpp" +) et_cxx_test( - optimized_kernels_test SOURCES ${_optimized_kernels_test_sources} EXTRA_LIBS - optimized_kernels optimized_ops_lib portable_kernels eigen_blas + optimized_kernels_test + SOURCES + ${_optimized_kernels_test_sources} + EXTRA_LIBS + optimized_kernels + optimized_ops_lib + portable_kernels + eigen_blas ) add_dependencies(optimized_kernels_test generate_wrapper) target_include_directories( diff --git a/runtime/core/portable_type/test/CMakeLists.txt b/runtime/core/portable_type/test/CMakeLists.txt index f89381f512..21eb4feae0 100644 --- a/runtime/core/portable_type/test/CMakeLists.txt +++ b/runtime/core/portable_type/test/CMakeLists.txt @@ -23,8 +23,8 @@ set(EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../../..) include(${EXECUTORCH_ROOT}/build/Test.cmake) -set(_test_srcs optional_test.cpp tensor_test.cpp half_test.cpp - scalar_test.cpp tensor_impl_test.cpp +set(_test_srcs optional_test.cpp tensor_test.cpp half_test.cpp scalar_test.cpp + tensor_impl_test.cpp ) et_cxx_test(runtime_core_portable_type_test SOURCES ${_test_srcs} EXTRA_LIBS) diff --git a/schema/CMakeLists.txt b/schema/CMakeLists.txt index a69f751bf2..5a4013f43e 100644 --- a/schema/CMakeLists.txt +++ b/schema/CMakeLists.txt @@ -49,7 +49,8 @@ function(generate_program_schema _schema_srcs _schema_name) # and some users need an alignment larger than the default, which is typically # 32. target_compile_definitions( - ${_schema_name} INTERFACE FLATBUFFERS_MAX_ALIGNMENT=1024) + ${_schema_name} INTERFACE FLATBUFFERS_MAX_ALIGNMENT=1024 + ) target_include_directories( ${_schema_name} diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1cd4c82497..5dbe47c867 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -62,8 +62,9 @@ endif() # add_executable(size_test_all_ops ${_size_test__srcs}) target_link_options_shared_lib(portable_ops_lib) -target_link_libraries(size_test_all_ops executorch - portable_ops_lib portable_kernels) +target_link_libraries( + size_test_all_ops executorch portable_ops_lib portable_kernels +) if(CMAKE_BUILD_TYPE EQUAL "Release") target_link_options(size_test_all_ops PRIVATE "LINKER:--gc-sections") endif()