aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--1.2/ArmnnDriverImpl.cpp4
-rw-r--r--1.3/ArmnnDriverImpl.cpp4
-rw-r--r--Android.bp33
-rw-r--r--Android.mk8
-rw-r--r--ArmnnDriverImpl.cpp4
-rw-r--r--DriverOptions.cpp15
-rw-r--r--DriverOptions.hpp4
-rw-r--r--docs/FAQ.md18
-rwxr-xr-xsetup.sh15
-rw-r--r--test/Android.mk4
10 files changed, 100 insertions, 9 deletions
diff --git a/1.2/ArmnnDriverImpl.cpp b/1.2/ArmnnDriverImpl.cpp
index 6d713e06..d5539bc6 100644
--- a/1.2/ArmnnDriverImpl.cpp
+++ b/1.2/ArmnnDriverImpl.cpp
@@ -132,7 +132,9 @@ Return<V1_0::ErrorStatus> ArmnnDriverImpl::prepareArmnnModel_1_2(
armnn::BackendOptions gpuAcc("GpuAcc",
{
- { "FastMathEnabled", options.IsFastMathEnabled() }
+ { "FastMathEnabled", options.IsFastMathEnabled() },
+ { "SaveCachedNetwork", options.SaveCachedNetwork() },
+ { "CachedNetworkFilePath", options.GetCachedNetworkFilePath() }
});
armnn::BackendOptions cpuAcc("CpuAcc",
{
diff --git a/1.3/ArmnnDriverImpl.cpp b/1.3/ArmnnDriverImpl.cpp
index b2524d3b..595df0a9 100644
--- a/1.3/ArmnnDriverImpl.cpp
+++ b/1.3/ArmnnDriverImpl.cpp
@@ -143,7 +143,9 @@ Return<V1_3::ErrorStatus> ArmnnDriverImpl::prepareArmnnModel_1_3(
armnn::BackendOptions gpuAcc("GpuAcc",
{
- { "FastMathEnabled", options.IsFastMathEnabled() }
+ { "FastMathEnabled", options.IsFastMathEnabled() },
+ { "SaveCachedNetwork", options.SaveCachedNetwork() },
+ { "CachedNetworkFilePath", options.GetCachedNetworkFilePath() }
});
armnn::BackendOptions cpuAcc("CpuAcc",
{
diff --git a/Android.bp b/Android.bp
index 5dfe8694..fde01e83 100644
--- a/Android.bp
+++ b/Android.bp
@@ -51,6 +51,39 @@ cc_library_static {
],
}
+////////////////////////////////////////////
+// //
+// flatbuffers libs //
+// //
+////////////////////////////////////////////
+cc_defaults {
+ name: "libflatbuffers-defaults",
+ proprietary: true,
+ export_include_dirs: [ "flatbuffers-1.12.0/",
+ "flatbuffers-1.12.0/include",
+ ],
+ local_include_dirs: ["flatbuffers-1.12.0/include",],
+ cflags: [
+ "-O3",
+ "-fexceptions",
+ "-Wno-unused-parameter",
+ "-DFLATBUFFERS_BUILD_FLATC=1"
+ ],
+ cppflags: [
+ "-std=c++14"
+ ],
+ rtti: true,
+}
+
+cc_library_static {
+ name: "libflatbuffers-framework",
+ defaults: ["libflatbuffers-defaults"],
+ srcs: [
+ "flatbuffers-1.12.0/src/flatc.cpp",
+ "flatbuffers-1.12.0/src/flatc_main.cpp",
+ ],
+}
+
subdirs = [
"armnn",
]
diff --git a/Android.mk b/Android.mk
index 9cbf71f3..8b884e16 100644
--- a/Android.mk
+++ b/Android.mk
@@ -163,6 +163,7 @@ LOCAL_SRC_FILES := \
LOCAL_STATIC_LIBRARIES := \
libneuralnetworks_common \
+ libflatbuffers-framework \
arm_compute_library
LOCAL_WHOLE_STATIC_LIBRARIES := libarmnn
@@ -290,6 +291,7 @@ LOCAL_SRC_FILES := \
LOCAL_STATIC_LIBRARIES := \
libneuralnetworks_common \
+ libflatbuffers-framework \
arm_compute_library
LOCAL_WHOLE_STATIC_LIBRARIES := libarmnn
@@ -410,6 +412,7 @@ LOCAL_SRC_FILES := \
LOCAL_STATIC_LIBRARIES := \
libneuralnetworks_common \
+ libflatbuffers-framework \
arm_compute_library
LOCAL_WHOLE_STATIC_LIBRARIES := libarmnn
@@ -528,6 +531,7 @@ LOCAL_SRC_FILES := \
LOCAL_STATIC_LIBRARIES := \
libneuralnetworks_common \
+ libflatbuffers-framework \
arm_compute_library
LOCAL_WHOLE_STATIC_LIBRARIES := libarmnn
@@ -604,6 +608,7 @@ LOCAL_SRC_FILES := \
LOCAL_STATIC_LIBRARIES := \
libneuralnetworks_common \
+ libflatbuffers-framework \
arm_compute_library
LOCAL_WHOLE_STATIC_LIBRARIES := \
@@ -700,6 +705,7 @@ LOCAL_SRC_FILES := \
LOCAL_STATIC_LIBRARIES := \
libneuralnetworks_common \
+ libflatbuffers-framework \
arm_compute_library
LOCAL_WHOLE_STATIC_LIBRARIES := \
@@ -787,6 +793,7 @@ LOCAL_SRC_FILES := \
LOCAL_STATIC_LIBRARIES := \
libneuralnetworks_common \
+ libflatbuffers-framework \
arm_compute_library
LOCAL_WHOLE_STATIC_LIBRARIES := \
@@ -865,6 +872,7 @@ LOCAL_SRC_FILES := \
LOCAL_STATIC_LIBRARIES := \
libneuralnetworks_common \
+ libflatbuffers-framework \
arm_compute_library
LOCAL_WHOLE_STATIC_LIBRARIES := \
diff --git a/ArmnnDriverImpl.cpp b/ArmnnDriverImpl.cpp
index 0934e2c3..ef37cae6 100644
--- a/ArmnnDriverImpl.cpp
+++ b/ArmnnDriverImpl.cpp
@@ -107,7 +107,9 @@ Return<V1_0::ErrorStatus> ArmnnDriverImpl<HalPolicy>::prepareModel(
armnn::BackendOptions gpuAcc("GpuAcc",
{
- { "FastMathEnabled", options.IsFastMathEnabled() }
+ { "FastMathEnabled", options.IsFastMathEnabled() },
+ { "SaveCachedNetwork", options.SaveCachedNetwork() },
+ { "CachedNetworkFilePath", options.GetCachedNetworkFilePath() }
});
armnn::BackendOptions cpuAcc("CpuAcc",
{
diff --git a/DriverOptions.cpp b/DriverOptions.cpp
index 6f777e3c..c30a4406 100644
--- a/DriverOptions.cpp
+++ b/DriverOptions.cpp
@@ -36,6 +36,8 @@ DriverOptions::DriverOptions(armnn::Compute computeDevice, bool fp16Enabled)
, m_EnableGpuProfiling(false)
, m_fp16Enabled(fp16Enabled)
, m_FastMathEnabled(false)
+ , m_ShouldExit(false)
+ , m_SaveCachedNetwork(false)
{
}
@@ -47,6 +49,8 @@ DriverOptions::DriverOptions(const std::vector<armnn::BackendId>& backends, bool
, m_EnableGpuProfiling(false)
, m_fp16Enabled(fp16Enabled)
, m_FastMathEnabled(false)
+ , m_ShouldExit(false)
+ , m_SaveCachedNetwork(false)
{
}
@@ -58,6 +62,7 @@ DriverOptions::DriverOptions(int argc, char** argv)
, m_fp16Enabled(false)
, m_FastMathEnabled(false)
, m_ShouldExit(false)
+ , m_SaveCachedNetwork(false)
{
std::string unsupportedOperationsAsString;
std::string clTunedParametersModeAsString;
@@ -112,6 +117,16 @@ DriverOptions::DriverOptions(int argc, char** argv)
("p,gpu-profiling", "Turns GPU profiling on",
cxxopts::value<bool>(m_EnableGpuProfiling)->default_value("false"))
+ ("q,cached-network-file", "If non-empty, the given file will be used to load/save cached network. "
+ "If save-cached-network option is given will save the cached network to given file."
+ "If save-cached-network option is not given will load the cached network from given "
+ "file.",
+ cxxopts::value<std::string>(m_CachedNetworkFilePath)->default_value(""))
+
+ ("s,save-cached-network", "Enables saving the cached network to the file given with cached-network-file option."
+ " See also --cached-network-file",
+ cxxopts::value<bool>(m_SaveCachedNetwork)->default_value("false"))
+
("t,cl-tuned-parameters-file",
"If non-empty, the given file will be used to load/save CL tuned parameters. "
"See also --cl-tuned-parameters-mode",
diff --git a/DriverOptions.hpp b/DriverOptions.hpp
index 15236521..f3b441ca 100644
--- a/DriverOptions.hpp
+++ b/DriverOptions.hpp
@@ -36,6 +36,8 @@ public:
void SetBackends(const std::vector<armnn::BackendId>& backends) { m_Backends = backends; }
bool ShouldExit() const { return m_ShouldExit; }
int GetExitCode() const { return m_ExitCode; }
+ const std::string& GetCachedNetworkFilePath() const { return m_CachedNetworkFilePath; }
+ bool SaveCachedNetwork() const { return m_SaveCachedNetwork; }
private:
std::vector<armnn::BackendId> m_Backends;
@@ -51,6 +53,8 @@ private:
bool m_FastMathEnabled;
bool m_ShouldExit;
int m_ExitCode;
+ std::string m_CachedNetworkFilePath;
+ bool m_SaveCachedNetwork;
};
} // namespace armnn_driver
diff --git a/docs/FAQ.md b/docs/FAQ.md
index 84025719..bd79bb04 100644
--- a/docs/FAQ.md
+++ b/docs/FAQ.md
@@ -20,18 +20,21 @@ An acceptable workaround is to increase the timeout defined in AndroidTest.xml,
Problems seen when trying to build the android-nn-driver obtained from GitHub
-----------------------------------------------------------------------------
-Some users have encountered difficulties when attempting to build copies of the android-nn-driver obtained from GitHub. The build reports missing module source paths from armnn, clframework or boost_1_64_0. These errors can look like this:
+Some users have encountered difficulties when attempting to build copies of the android-nn-driver obtained from GitHub. The build reports missing module source paths from armnn, clframework, flatbuffers-1.12.0 or boost_1_64_0.
+These errors can look
+like this:
'error: vendor/arm/android-nn-driver/Android.bp:45:1: variant "android_arm64_armv7": module "armnn-arm_compute" "module source path "vendor/arm/android-nn-driver/clframework/build/android-arm64v8a/src/core/CL" does not exist'
These errors are due to missing dependencies or incompatiblities between the android-nn-driver and armnn or clframework versions. The android-nn-driver requires boost_1_64_0 to build unit tests. The versions of android-nn-driver, armnn and clframework will have to match for them to work together. For example, the 19.08 version of android-nn-driver, clframework and armnn will work together but none of them will work with earlier or later versions of the others.
-In order to ensure that the correct versions of boost, armnn and the clframework are obtained you can do the following:
+In order to ensure that the correct versions of flatbuffers, boost, armnn and the clframework are obtained you can do the following:
-1. Delete or move any boost, armnn or clframework directories from the android-nn-driver directory.
+1. Delete or move any flatbuffers, boost, armnn or clframework directories from the android-nn-driver directory.
2. Run the setup.sh script in the android-nn-driver directory.
-This will download the correct versions of boost, armnn and the clframework and the android-nn-driver should build correctly. Alternatively you can go to the GitHub pages for android-nn-driver, armnn and computelibrary (clframework) and download versions with the same release tag.
+This will download the correct versions of flatbuffers, boost, armnn and the clframework and the android-nn-driver should build
+correctly. Alternatively you can go to the GitHub pages for android-nn-driver, armnn and computelibrary (clframework) and download versions with the same release tag.
As an example, for 20.05 these would be:
@@ -43,6 +46,10 @@ The correct version of boost (1_64_0) can be downloaded from:
https://www.boost.org/
+The correct version of flatbuffers (1.12.0) can be downloaded from:
+
+https://github.com/google/flatbuffers/archive/v1.12.0.tar.gz
+
Instance Normalization test failures
------------------------------------
@@ -68,5 +75,4 @@ In order to fix these failures you will have to update to a version of Android Q
The Android 10 R3 CTS that can be downloaded from https://source.android.com/compatibility/cts/downloads contains all these patches.
-There is a known issue that even with these patches CTS tests "TestRandomGraph/RandomGraphTest#LargeGraph_TENSOR_FLOAT16_Rank3/41" and "TestRandomGraph/RandomGraphTest#LargeGraph_TENSOR_FLOAT16_Rank2/20 " will still fail on CpuRef. These failures are caused by a LogSoftmax layer followed by a Floor layer which blows up the slight difference between fp16 to fp32. This issue only affects CpuRef with Android Q. These tests are not failing for Android R.
-
+There is a known issue that even with these patches CTS tests "TestRandomGraph/RandomGraphTest#LargeGraph_TENSOR_FLOAT16_Rank3/41" and "TestRandomGraph/RandomGraphTest#LargeGraph_TENSOR_FLOAT16_Rank2/20 " will still fail on CpuRef. These failures are caused by a LogSoftmax layer followed by a Floor layer which blows up the slight difference between fp16 to fp32. This issue only affects CpuRef with Android Q. These tests are not failing for Android R. \ No newline at end of file
diff --git a/setup.sh b/setup.sh
index 1dfc5927..3ce0ed5f 100755
--- a/setup.sh
+++ b/setup.sh
@@ -26,6 +26,21 @@ if [ ! -d boost_1_64_0 ]; then
rm -rf $BOOST_PKG
fi
+
+if [ ! -d v1.12.0 ]; then
+ echo "++ Downloading FlatBuffers"
+
+ FLATBUFFERS_PKG=v1.12.0.tar.gz
+
+ curl -LOk https://github.com/google/flatbuffers/archive/v1.12.0.tar.gz
+ AssertZeroExitCode "Downloading FlatBuffers failed"
+
+ tar xzf $FLATBUFFERS_PKG
+ AssertZeroExitCode "Unpacking FlatBuffers failed"
+
+ rm -rf $FLATBUFFERS_PKG
+fi
+
if [ ! -d armnn ]; then
echo "++ Downloading armnn"
diff --git a/test/Android.mk b/test/Android.mk
index f6439c6f..2b87a41d 100644
--- a/test/Android.mk
+++ b/test/Android.mk
@@ -74,6 +74,7 @@ LOCAL_SRC_FILES := \
LOCAL_STATIC_LIBRARIES := \
libneuralnetworks_common \
libboost_unit_test_framework \
+ libflatbuffers-framework \
arm_compute_library
LOCAL_WHOLE_STATIC_LIBRARIES := \
@@ -188,6 +189,7 @@ LOCAL_SRC_FILES := \
LOCAL_STATIC_LIBRARIES := \
libneuralnetworks_common \
libboost_unit_test_framework \
+ libflatbuffers-framework \
arm_compute_library
LOCAL_WHOLE_STATIC_LIBRARIES := \
@@ -293,6 +295,7 @@ LOCAL_SRC_FILES := \
LOCAL_STATIC_LIBRARIES := \
libneuralnetworks_common \
libboost_unit_test_framework \
+ libflatbuffers-framework \
arm_compute_library
LOCAL_WHOLE_STATIC_LIBRARIES := \
@@ -391,6 +394,7 @@ LOCAL_SRC_FILES := \
LOCAL_STATIC_LIBRARIES := \
libneuralnetworks_common \
libboost_unit_test_framework \
+ libflatbuffers-framework \
arm_compute_library
LOCAL_WHOLE_STATIC_LIBRARIES := \