summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralexander <alexander.efremov@arm.com>2022-02-11 13:23:22 +0000
committerKshitij Sisodia <kshitij.sisodia@arm.com>2022-02-11 18:11:35 +0000
commitcb8a987ce714283b66db49d1bc9d5b108caaa707 (patch)
treeb00f86587c8b15d0391691d415220b2bbbcf6ea9
parent31ae9f09bb3535975595e999fbc7baca889e46e8 (diff)
downloadml-embedded-evaluation-kit-cb8a987ce714283b66db49d1bc9d5b108caaa707.tar.gz
MLECO-2752: Minor refactoring for native global steps.
And further optimisations of extendability for platform build steps. Added a list for excluded use-cases. Change-Id: I5a9398bbeb595a5bf2ea39b81623e4f20238f948 Signed-off-by: alexander <alexander.efremov@arm.com>
-rw-r--r--CMakeLists.txt12
-rw-r--r--scripts/cmake/platforms/native/build_configuration.cmake41
-rw-r--r--scripts/cmake/tensorflow.cmake18
-rw-r--r--scripts/cmake/util_functions.cmake17
-rw-r--r--source/hal/platform/mps3/CMakeLists.txt2
-rw-r--r--source/hal/platform/mps3/cmake/subsystem-profiles/sse-300.cmake (renamed from source/hal/platform/mps3/cmake/subsystem-profiles/corstone-sse-300.cmake)0
6 files changed, 47 insertions, 43 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5a7f1f2..51e21eb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -57,7 +57,8 @@ else()
endif()
include(${CMAKE_SCRIPTS_DIR}/common_user_options.cmake)
-include(${CMAKE_SCRIPTS_DIR}/platforms/${TARGET_PLATFORM}/build_configuration.cmake)
+
+add_platform_build_configuration(TARGET_PLATFORM ${TARGET_PLATFORM})
set_platform_global_defaults()
@@ -88,9 +89,6 @@ set(SRC_PATH ${CMAKE_CURRENT_SOURCE_DIR}/source)
set(TEST_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/tests)
list(APPEND USE_CASES_TESTS_SEARCH_DIR_LIST ${TEST_SRCS}/use_case)
-if (CPU_PROFILE_ENABLED)
- set(PROFILING_OPT "${PROFILING_OPT} -DCPU_PROFILE_ENABLED")
-endif()
# We include log target
add_subdirectory(${SRC_PATH}/log ${CMAKE_BINARY_DIR}/log)
@@ -147,6 +145,8 @@ else()
set(USE_CASES ${USE_CASE_BUILD})
endif()
+list(REMOVE_ITEM USE_CASES "" ${EXCLUDED_USE_CASES})
+message(STATUS "Use-cases excluded by platform configuration: ${EXCLUDED_USE_CASES}")
message(STATUS "Building use-cases: ${USE_CASES}.")
foreach(use_case ${USE_CASES})
@@ -220,6 +220,10 @@ foreach(use_case ${USE_CASES})
target_compile_definitions(${UC_LIB_NAME} PUBLIC
"ACTIVATION_BUF_SZ=${${use_case}_ACTIVATION_BUF_SZ}")
+ # Set the CPU profiling defintiion
+ target_compile_definitions(${UC_LIB_NAME} PRIVATE
+ $<$<BOOL:${CPU_PROFILE_ENABLED}>:CPU_PROFILE_ENABLED>)
+
target_link_libraries(${UC_LIB_NAME} PUBLIC
log
arm_math
diff --git a/scripts/cmake/platforms/native/build_configuration.cmake b/scripts/cmake/platforms/native/build_configuration.cmake
index c87ac89..bf6f980 100644
--- a/scripts/cmake/platforms/native/build_configuration.cmake
+++ b/scripts/cmake/platforms/native/build_configuration.cmake
@@ -15,19 +15,6 @@
# limitations under the License.
#----------------------------------------------------------------------------
-set(TEST_TPIP ${DOWNLOAD_DEP_DIR}/test)
-
-file(MAKE_DIRECTORY ${TEST_TPIP})
-set(TEST_TPIP_INCLUDE ${TEST_TPIP}/include)
-file(MAKE_DIRECTORY ${TEST_TPIP_INCLUDE})
-
-ExternalProject_Add(catch2-headers
- URL https://github.com/catchorg/Catch2/releases/download/v2.11.1/catch.hpp
- DOWNLOAD_NO_EXTRACT 1
- CONFIGURE_COMMAND ""
- BUILD_COMMAND bash -c "cp -R <DOWNLOAD_DIR>/catch.hpp ${TEST_TPIP_INCLUDE}"
- INSTALL_COMMAND "")
-
function(set_platform_global_defaults)
message(STATUS "Platform: Native (Linux based x86_64/aarch64 system)")
if (NOT DEFINED CMAKE_TOOLCHAIN_FILE)
@@ -35,6 +22,24 @@ function(set_platform_global_defaults)
CACHE FILEPATH "Toolchain file")
endif()
+ set(TEST_TPIP ${DOWNLOAD_DEP_DIR}/test)
+
+ file(MAKE_DIRECTORY ${TEST_TPIP})
+ set(TEST_TPIP_INCLUDE ${TEST_TPIP}/include)
+ file(MAKE_DIRECTORY ${TEST_TPIP_INCLUDE})
+
+ ExternalProject_Add(catch2-headers
+ URL https://github.com/catchorg/Catch2/releases/download/v2.11.1/catch.hpp
+ DOWNLOAD_NO_EXTRACT 1
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ${CMAKE_COMMAND} -E copy <DOWNLOAD_DIR>/catch.hpp ${TEST_TPIP_INCLUDE}
+ INSTALL_COMMAND "")
+
+ add_library(catch2 INTERFACE)
+ target_include_directories(catch2
+ INTERFACE
+ ${TEST_TPIP_INCLUDE})
+
endfunction()
function(platform_custom_post_build)
@@ -98,16 +103,10 @@ function(platform_custom_post_build)
set(TEST_TARGET_NAME "${CMAKE_PROJECT_NAME}-${use_case}-tests")
add_executable(${TEST_TARGET_NAME} ${TEST_SOURCES})
- target_include_directories(${TEST_TARGET_NAME} PUBLIC
- ${TEST_TPIP_INCLUDE} ${TEST_RESOURCES_INCLUDE})
- target_link_libraries(${TEST_TARGET_NAME} PUBLIC ${UC_LIB_NAME})
+ target_include_directories(${TEST_TARGET_NAME} PRIVATE ${TEST_RESOURCES_INCLUDE})
+ target_link_libraries(${TEST_TARGET_NAME} PRIVATE ${UC_LIB_NAME} catch2)
target_compile_definitions(${TEST_TARGET_NAME} PRIVATE
"ACTIVATION_BUF_SZ=${${use_case}_ACTIVATION_BUF_SZ}"
TESTS)
-
- add_dependencies(
- "${TEST_TARGET_NAME}"
- "catch2-headers"
- )
endif ()
endfunction() \ No newline at end of file
diff --git a/scripts/cmake/tensorflow.cmake b/scripts/cmake/tensorflow.cmake
index 9a4066d..9d72405 100644
--- a/scripts/cmake/tensorflow.cmake
+++ b/scripts/cmake/tensorflow.cmake
@@ -1,5 +1,5 @@
#----------------------------------------------------------------------------
-# Copyright (c) 2021 Arm Limited. All rights reserved.
+# Copyright (c) 2021 - 2022 Arm Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -65,22 +65,6 @@ else()
DESTINATION ${TENSORFLOW_LITE_MICRO_PATH}/tools/make/targets/)
endif()
-#TODO: this thing fails the TF build, when the driver is compiled, fatal error: 'ethosETHOSU_ARCH_interface.h' file not found
-#if (CMAKE_SYSTEM_PROCESSOR STREQUAL cortex-m55)
-# set(TENSORFLOW_LITE_MICRO_TARGET "cortex_m_generic")
-# set(TENSORFLOW_LITE_MICRO_TARGET_ARCH ${CMAKE_SYSTEM_PROCESSOR}${CPU_FEATURES})
-# if(ETHOS_U_NPU_ENABLED)
-# # Arm Ethos-U55 NPU is the co-processor for ML workload:
-# set(TENSORFLOW_LITE_MICRO_CO_PROCESSOR "ethos_u")
-# endif()
-#
-# set(TENSORFLOW_LITE_MICRO_OPTIMIZED_KERNEL "cmsis_nn")
-#
-#else()
-# set(TENSORFLOW_LITE_MICRO_TARGET "linux")
-# set(TENSORFLOW_LITE_MICRO_TARGET_ARCH x86_64)
-#endif()
-
if (TENSORFLOW_LITE_MICRO_CLEAN_DOWNLOADS)
list(APPEND MAKE_TARGETS_LIST "clean_downloads")
endif()
diff --git a/scripts/cmake/util_functions.cmake b/scripts/cmake/util_functions.cmake
index f9742f7..447265c 100644
--- a/scripts/cmake/util_functions.cmake
+++ b/scripts/cmake/util_functions.cmake
@@ -174,3 +174,20 @@ function(download_file_from_modelzoo model_zoo_version file_sub_path download_pa
endif()
endfunction()
+
+function(add_platform_build_configuration)
+
+ set(oneValueArgs TARGET_PLATFORM)
+ cmake_parse_arguments(PARSED "" "${oneValueArgs}" "" ${ARGN} )
+ message(STATUS "Searching for ${PARSED_TARGET_PLATFORM} build configuration")
+ list(APPEND PLATFORM_BUILD_CONFIG_DIRS ${CMAKE_SCRIPTS_DIR}/platforms)
+
+ FIND_PATH(PLATFORM_BUILD_CONFIG
+ NAMES build_configuration.cmake
+ PATH_SUFFIXES ${PARSED_TARGET_PLATFORM}
+ PATHS ${PLATFORM_BUILD_CONFIG_DIRS}
+ )
+
+ message(STATUS "Found build configuration: ${PLATFORM_BUILD_CONFIG}")
+ include(${PLATFORM_BUILD_CONFIG}/build_configuration.cmake)
+endfunction() \ No newline at end of file
diff --git a/source/hal/platform/mps3/CMakeLists.txt b/source/hal/platform/mps3/CMakeLists.txt
index ad510ee..46db2aa 100644
--- a/source/hal/platform/mps3/CMakeLists.txt
+++ b/source/hal/platform/mps3/CMakeLists.txt
@@ -33,7 +33,7 @@ endif()
# 2. Set the platform cmake descriptor file
if (NOT DEFINED PLATFORM_CMAKE_DESCRIPTOR_FILE)
set(PLATFORM_CMAKE_DESCRIPTOR_FILE
- cmake/subsystem-profiles/corstone-sse-300.cmake
+ cmake/subsystem-profiles/${TARGET_SUBSYSTEM}.cmake
CACHE PATH
"Platform's CMake descriptor file path")
endif()
diff --git a/source/hal/platform/mps3/cmake/subsystem-profiles/corstone-sse-300.cmake b/source/hal/platform/mps3/cmake/subsystem-profiles/sse-300.cmake
index eec6fde..eec6fde 100644
--- a/source/hal/platform/mps3/cmake/subsystem-profiles/corstone-sse-300.cmake
+++ b/source/hal/platform/mps3/cmake/subsystem-profiles/sse-300.cmake