aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin May <kevin.may@arm.com>2024-05-10 15:40:08 +0100
committerColm Donelan <colm.donelan@arm.com>2024-05-10 20:31:46 +0100
commit2c2f3aa6fbdd50ab5157bfc40f9335337f14abac (patch)
tree3bfbdabf5ebfd94838c038b2b94704737235ac96
parent8723eb9c8f1160f9c3e677679dd1840fde5b61aa (diff)
downloadarmnn-2c2f3aa6fbdd50ab5157bfc40f9335337f14abac.tar.gz
MLCE-1276 Fix for ExecuteNetwork abort after inference
* The abort is caused during destruction of flatbuffers::ClassicLocale * Set FLATBUFFERS_LOCALE_INDEPENDENT=0 in delegates and parser so that ClassicLocale is not included Signed-off-by: Kevin May <kevin.may@arm.com> Change-Id: I34584b05998a62bae2263a2281414fcf8c12d668 Signed-off-by: Colm Donelan <colm.donelan@arm.com>
-rw-r--r--delegate/CMakeLists.txt3
-rw-r--r--docs/FAQ.md13
-rw-r--r--src/armnnTfLiteParser/TfLiteParser.cpp4
3 files changed, 20 insertions, 0 deletions
diff --git a/delegate/CMakeLists.txt b/delegate/CMakeLists.txt
index f8b0300976..ebde7c69ce 100644
--- a/delegate/CMakeLists.txt
+++ b/delegate/CMakeLists.txt
@@ -17,6 +17,9 @@ option(BUILD_SHARED_LIBS "Build share libs" ON)
option(BUILD_DELEGATE_JNI_INTERFACE "Builds a library to allow accessing the Arm NN delegate from Java code.
This is an experimental feature." ON)
+## Do not include flatbuffers::ClassicLocale which can cause abort when destroyed
+add_definitions(-DFLATBUFFERS_LOCALE_INDEPENDENT=0)
+
set(armnnDelegate_sources)
list(APPEND armnnDelegate_sources
common/include/DelegateOptions.hpp
diff --git a/docs/FAQ.md b/docs/FAQ.md
index 12fcdad052..797413ad87 100644
--- a/docs/FAQ.md
+++ b/docs/FAQ.md
@@ -78,3 +78,16 @@ Running multiple inferences in multiple threads concurrently is not supported, b
ArmNN supports multithreading at kernel level and this is implemented in Arm Compute Library (ACL) (https://github.com/ARM-software/ComputeLibrary/).
During inference, at the operator level, the main thread will create multiple threads and execute the same kernel on different parts of the data. At runtime ACL will detect the number of CPU cores in the system and use one thread per cpu core for each kernel.
Multithreading at operator level is not supported due to limitations in ACL, for more information please refer to https://arm-software.github.io/ComputeLibrary/latest/architecture.xhtml#architecture_thread_safety
+
+On Android, Executables containing Arm NN delegate or Arm NN TfLite Parser occasionally SIGABORT during destruction of Flatbuffers.
+------------------------------
+Unloading some TfLite models occasionally throws a SIGABORT. The error looks similar to this:
+~~~
+#0  0x0000007ff22df5c4 in abort () from target:/apex/com.android.runtime/lib64/bionic/libc.so
+#1  0x0000007ff22ca61c in scudo::die() () from target:/apex/com.android.runtime/lib64/bionic/libc.so
+#2  0x0000007ff22cb244 in scudo::ScopedErrorReport::~ScopedErrorReport() () from target:/apex/com.android.runtime/lib64/bionic/libc.so
+#3  0x0000007ff22cb768 in scudo::reportInvalidChunkState(scudo::AllocatorAction, void*) () from target:/apex/com.android.runtime/lib64/bionic/libc.so
+#4  0x0000007ff22cd520 in scudo::Allocator<scudo::AndroidConfig, &scudo_malloc_postinit>::deallocate(void*, scudo::Chunk::Origin, unsigned long, unsigned long) () from target:/apex/com.android.runtime/lib64/bionic/libc.so
+#5  0x0000007fee6f96f8 in flatbuffers::ClassicLocale::~ClassicLocale() () from target:/data/local/tmp/build.android.aarch64/armnn/libarmnnTfLiteParser.so
+~~~
+The solution to set the flag "-DFLATBUFFERS_LOCALE_INDEPENDENT=0" in the build. By default, this is already done for our internal executables, for example, ExecuteNetwork.
diff --git a/src/armnnTfLiteParser/TfLiteParser.cpp b/src/armnnTfLiteParser/TfLiteParser.cpp
index 3fd81ff973..3a4c084301 100644
--- a/src/armnnTfLiteParser/TfLiteParser.cpp
+++ b/src/armnnTfLiteParser/TfLiteParser.cpp
@@ -3,6 +3,10 @@
// SPDX-License-Identifier: MIT
//
+// Do not include flatbuffers::ClassicLocale which can cause abort when destroyed
+// This define must be added before the include or it causes a macro redefine error
+#define FLATBUFFERS_LOCALE_INDEPENDENT 0
+
#include "TfLiteParser.hpp"
#include "armnnTfLiteParser/Version.hpp"