aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sloyan <matthew.sloyan@arm.com>2022-10-10 12:42:16 +0100
committerMatthew Sloyan <matthew.sloyan@arm.com>2022-10-27 12:03:21 +0100
commitd646b5504351ab3c3ab8152553465c8e36947e5b (patch)
treed67eb1a4f18b9cff1c5e5ff067ba4c4b92bff561
parent6a76e562019ef492a39d21de6850534d0a561782 (diff)
downloadarmnn-d646b5504351ab3c3ab8152553465c8e36947e5b.tar.gz
IVGCVSW-7273 Integrate TOSA Reference Model into Arm NN
Signed-off-by: Matthew Sloyan <matthew.sloyan@arm.com> Change-Id: Ie9aa1aa20a5bc837e005a7a36d4d07b4cd8d021b
-rw-r--r--CMakeLists.txt11
-rw-r--r--cmake/GlobalConfig.cmake25
-rw-r--r--src/backends/tosaReference/CMakeLists.txt1
3 files changed, 31 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 96f94be84a..ff05fb3f5a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -541,6 +541,17 @@ if (ARMNNTOSAREF)
target_link_libraries(armnn PUBLIC -Wl,--whole-archive ${TOSA_SERIALIZATION_LIB} -Wl,--no-whole-archive)
endif()
+
+ if (TOSA_REFERENCE_MODEL_LIB)
+ target_link_libraries(armnn PUBLIC -Wl,--whole-archive ${TOSA_REFERENCE_MODEL_LIB} -Wl,--no-whole-archive)
+ else()
+ find_library(TOSA_REFERENCE_MODEL_LIB
+ NAMES libtosa_reference_model_lib.a tosa_reference_model_lib
+ HINTS ${TOSA_REFERENCE_MODEL_ROOT}/lib /usr/local/lib /usr/lib)
+ message(STATUS "TOSA Reference Model set to ${TOSA_REFERENCE_MODEL_LIB}")
+
+ target_link_libraries(armnn PUBLIC -Wl,--whole-archive ${TOSA_REFERENCE_MODEL_LIB} -Wl,--no-whole-archive)
+ endif()
endif()
if(PROFILING_BACKEND_STREAMLINE AND (NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL Android)))
diff --git a/cmake/GlobalConfig.cmake b/cmake/GlobalConfig.cmake
index 9137fa33d8..fb70d1a0e0 100644
--- a/cmake/GlobalConfig.cmake
+++ b/cmake/GlobalConfig.cmake
@@ -11,7 +11,7 @@ option(BUILD_FOR_COVERAGE "Use no optimization and output .gcno and .gcda files"
option(ARMCOMPUTENEON "Build with ARM Compute NEON support" OFF)
option(ARMCOMPUTECL "Build with ARM Compute OpenCL support" OFF)
option(ARMNNREF "Build with ArmNN reference support" ON)
-option(ARMNNTOSAREF "Build with Tosa reference support" OFF)
+option(ARMNNTOSAREF "Build with TOSA reference support" OFF)
option(PROFILING_BACKEND_STREAMLINE "Forward the armNN profiling events to DS-5/Streamline as annotations" OFF)
# options used for heap profiling and leak checking
option(HEAP_PROFILING "Build with heap profiling enabled" OFF)
@@ -24,7 +24,8 @@ option(BUILD_ACCURACY_TOOL "Build Accuracy Tool" OFF)
option(FLATC_DIR "Path to Flatbuffers compiler" OFF)
option(TF_LITE_GENERATED_PATH "Tensorflow lite generated C++ schema location" OFF)
option(FLATBUFFERS_ROOT "Location where the flatbuffers 'include' and 'lib' folders to be found" Off)
-option(TOSA_SERIALIZATION_LIB_ROOT "Location where the TOSA serialization library 'include' and 'lib' folders can be found" OFF)
+option(TOSA_SERIALIZATION_LIB_ROOT "Location where the TOSA Serialization Library 'include' and 'lib' folders can be found" OFF)
+option(TOSA_REFERENCE_MODEL_ROOT "Location where the TOSA Reference Model 'include' and 'lib' folders can be found" OFF)
option(DYNAMIC_BACKEND_PATHS "Colon seperated list of paths where to load the dynamic backends from" "")
option(SAMPLE_DYNAMIC_BACKEND "Include the sample dynamic backend and its tests in the build" OFF)
option(BUILD_GATORD_MOCK "Build the Gatord simulator for external profiling testing." ON)
@@ -341,14 +342,26 @@ if(ARMNNTOSAREF)
# Locate the includes for the TOSA serialization library.
message(STATUS "TOSA serialization library root set to ${TOSA_SERIALIZATION_LIB_ROOT}")
- find_path(TOSA_SERIALIZATION_LIB_INCLUDE tosa_serialization_handler.h HINTS
- ${TOSA_SERIALIZATION_LIB_ROOT}/include)
+ find_path(TOSA_SERIALIZATION_LIB_INCLUDE tosa_serialization_handler.h
+ HINTS ${TOSA_SERIALIZATION_LIB_ROOT}/include)
message(STATUS "TOSA serialization library include directory located at: ${TOSA_SERIALIZATION_LIB_INCLUDE}")
find_library(TOSA_SERIALIZATION_LIB
- NAMES tosa_serialization_lib.a tosa_serialization_lib
- HINTS ${TOSA_SERIALIZATION_LIB_ROOT}/lib /usr/local/lib /usr/lib)
+ NAMES tosa_serialization_lib.a tosa_serialization_lib
+ HINTS ${TOSA_SERIALIZATION_LIB_ROOT}/lib /usr/local/lib /usr/lib)
message(STATUS "TOSA serialization library set to ${TOSA_SERIALIZATION_LIB}")
+
+ # Next, locate the includes for the TOSA Reference Model.
+ message(STATUS "TOSA Reference Model root set to ${TOSA_REFERENCE_MODEL_ROOT}")
+
+ find_path(TOSA_REFERENCE_MODEL_INCLUDE model_runner.h
+ HINTS ${TOSA_REFERENCE_MODEL_ROOT}/include)
+ message(STATUS "TOSA Reference Model include directory located at: ${TOSA_REFERENCE_MODEL_INCLUDE}")
+
+ find_library(TOSA_REFERENCE_MODEL_LIB
+ NAMES tosa_reference_model_lib.a tosa_reference_model_lib
+ HINTS ${TOSA_REFERENCE_MODEL_ROOT}/lib /usr/local/lib /usr/lib)
+ message(STATUS "TOSA Reference Model set to ${TOSA_REFERENCE_MODEL_LIB}")
endif()
# This is the root for the dynamic backend tests to search for dynamic
diff --git a/src/backends/tosaReference/CMakeLists.txt b/src/backends/tosaReference/CMakeLists.txt
index d1f9040393..fdec6d1106 100644
--- a/src/backends/tosaReference/CMakeLists.txt
+++ b/src/backends/tosaReference/CMakeLists.txt
@@ -5,6 +5,7 @@
include_directories(SYSTEM ${FLATBUFFERS_INCLUDE_PATH})
include_directories(SYSTEM ${TOSA_SERIALIZATION_LIB_INCLUDE})
+include_directories(SYSTEM ${TOSA_REFERENCE_MODEL_INCLUDE})
if(ARMNNTOSAREF)
list(APPEND armnnTosaRefBackend_sources