summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorKshitij Sisodia <kshitij.sisodia@arm.com>2024-06-05 17:02:32 +0100
committerKshitij Sisodia <kshitij.sisodia@arm.com>2024-06-07 08:25:52 +0100
commit325c916af5e379600b12b69622bcc7e0d65c941d (patch)
tree1ed411db2ab6df0805c4c3434d4c430da437003f /scripts
parent92725a6a53bb9434f4146785959848aa77f2c5d2 (diff)
downloadml-embedded-evaluation-kit-main.tar.gz
Fix for latest Arm CompilerHEAD24.05main
TensorFlow Lite Micro build produced warnings/errors with the latest Arm Compiler (version 6.22) because of conflict between floating point standard conformance and optimisation level. As the TensorFlow Lite Micro's Makefile uses `-ffp-mode=full` for the Arm Compiler, the fix is to use `-O3` for compiling the kernels. For CMSIS DSP library we set -ffp-mode=full` for all Arm Compilers. The issue was first raised here: https://discuss.mlplatform.org/t/tensorflow-build-failure-with-arm-compiler-6-22/287 Change-Id: I5c19c4016a922b596b84937a366d261fd9570090 Signed-off-by: Kshitij Sisodia <kshitij.sisodia@arm.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/cmake/cmsis-dsp.cmake8
-rw-r--r--scripts/cmake/tensorflow_lite_micro.cmake10
2 files changed, 14 insertions, 4 deletions
diff --git a/scripts/cmake/cmsis-dsp.cmake b/scripts/cmake/cmsis-dsp.cmake
index 2dc093d..f45bc7c 100644
--- a/scripts/cmake/cmsis-dsp.cmake
+++ b/scripts/cmake/cmsis-dsp.cmake
@@ -1,5 +1,6 @@
#----------------------------------------------------------------------------
-# SPDX-FileCopyrightText: Copyright 2021 Arm Limited and/or its affiliates <open-source-office@arm.com>
+# SPDX-FileCopyrightText: Copyright 2021, 2024 Arm Limited and/or its
+# affiliates <open-source-office@arm.com>
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -67,6 +68,11 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
"optimisation level")
target_compile_options(${CMSIS_DSP_TARGET} PUBLIC -O3)
endif()
+elseif (CMAKE_CXX_COMPILER_ID STREQUAL "ARMClang")
+ # For Arm Compiler the floating-point standard conformance is set to'std'
+ # by default. As we need NaN's and infinity definitions, we set the mode
+ # to 'full'.
+ target_compile_options(${CMSIS_DSP_TARGET} PRIVATE -ffp-mode=full)
endif ()
# 5. General compile definitions
diff --git a/scripts/cmake/tensorflow_lite_micro.cmake b/scripts/cmake/tensorflow_lite_micro.cmake
index cb45274..79e3e07 100644
--- a/scripts/cmake/tensorflow_lite_micro.cmake
+++ b/scripts/cmake/tensorflow_lite_micro.cmake
@@ -27,8 +27,12 @@ if (CMAKE_BUILD_TYPE STREQUAL Debug)
set(TENSORFLOW_LITE_MICRO_CORE_OPTIMIZATION_LEVEL "-O0")
set(TENSORFLOW_LITE_MICRO_KERNEL_OPTIMIZATION_LEVEL "-O0")
elseif (CMAKE_BUILD_TYPE STREQUAL Release)
- set(TENSORFLOW_LITE_MICRO_CORE_OPTIMIZATION_LEVEL "-Ofast")
- set(TENSORFLOW_LITE_MICRO_KERNEL_OPTIMIZATION_LEVEL "-Ofast")
+ # -Ofast is not an option as we set the floating-point conformance mode
+ # to 'full' in the TensorFlow Lite Micro Makefile. Although this is done
+ # only for Arm Compiler, we stick with the '-O3' optimisation level for
+ # all compilers.
+ set(TENSORFLOW_LITE_MICRO_CORE_OPTIMIZATION_LEVEL "-O3")
+ set(TENSORFLOW_LITE_MICRO_KERNEL_OPTIMIZATION_LEVEL "-O3")
endif()
assert_defined(TENSORFLOW_LITE_MICRO_BUILD_TYPE)
@@ -71,7 +75,7 @@ else()
if(ETHOS_U_NPU_ENABLED)
# Arm Ethos-U55 NPU is the co-processor for ML workload:
set(TENSORFLOW_LITE_MICRO_CO_PROCESSOR "ethos_u")
- set(TENSORFLOW_LITE_MICRO_CO_PROCESSOR_ARCH "u55") # Currently only u55 is supported by TFLite Micro.
+ string(TOLOWER ${ETHOS_U_NPU_ID} TENSORFLOW_LITE_MICRO_CO_PROCESSOR_ARCH)
endif()
set(TENSORFLOW_LITE_MICRO_OPTIMIZED_KERNEL "cmsis_nn")