aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadik Armagan <sadik.armagan@arm.com>2021-02-12 17:16:42 +0000
committerKevin May <kevin.may@arm.com>2021-02-15 16:50:24 +0000
commit188675fd7e7239f56212d72f8ac10598de87e76a (patch)
tree611876f7c43f81c88b8dec19ae86afcb6d6a1a64
parentcd639c98c347c1addae8c65eb1f4d8e75b468fdb (diff)
downloadandroid-nn-driver-188675fd7e7239f56212d72f8ac10598de87e76a.tar.gz
IVGCVSW-5665 Basic NN Driver support for next OS Version
Signed-off-by: Kevin May <kevin.may@arm.com> Signed-off-by: Sadik Armagan <sadik.armagan@arm.com> Change-Id: I1e1db52322092c6b1b7ac6183c3adc90aabcec24
-rw-r--r--1.0/ArmnnDriver.hpp2
-rw-r--r--1.0/ArmnnDriverImpl.hpp4
-rw-r--r--1.1/ArmnnDriver.hpp8
-rw-r--r--1.1/ArmnnDriverImpl.hpp4
-rw-r--r--1.2/ArmnnDriver.hpp16
-rw-r--r--1.2/ArmnnDriverImpl.cpp12
-rw-r--r--1.2/ArmnnDriverImpl.hpp4
-rw-r--r--1.3/ArmnnDriver.hpp34
-rw-r--r--1.3/ArmnnDriverImpl.cpp8
-rw-r--r--1.3/ArmnnDriverImpl.hpp6
-rw-r--r--Android.mk71
-rw-r--r--ArmnnDriverImpl.cpp4
-rw-r--r--ArmnnDriverImpl.hpp6
-rw-r--r--ArmnnPreparedModel.cpp15
-rw-r--r--ArmnnPreparedModel_1_2.cpp77
-rw-r--r--ArmnnPreparedModel_1_2.hpp14
-rw-r--r--ArmnnPreparedModel_1_3.cpp146
-rw-r--r--ArmnnPreparedModel_1_3.hpp22
-rw-r--r--ConversionUtils.hpp17
-rw-r--r--ModelToINetworkConverter.cpp9
-rw-r--r--Utils.cpp4
-rw-r--r--Utils.hpp3
-rw-r--r--test/1.1/Mean.cpp29
-rw-r--r--test/1.1/Transpose.cpp29
-rw-r--r--test/1.2/Capabilities.cpp2
-rw-r--r--test/1.3/QLstm.cpp2
-rw-r--r--test/1.3/QosTests.cpp30
-rw-r--r--test/Android.mk38
-rw-r--r--test/Concat.cpp5
-rw-r--r--test/Concurrent.cpp31
-rw-r--r--test/Convolution2D.hpp32
-rw-r--r--test/DriverTestHelpers.hpp11
-rw-r--r--test/FullyConnected.cpp64
-rw-r--r--test/Lstm.hpp7
-rw-r--r--test/Tests.cpp4
35 files changed, 475 insertions, 295 deletions
diff --git a/1.0/ArmnnDriver.hpp b/1.0/ArmnnDriver.hpp
index b18f065..b601e87 100644
--- a/1.0/ArmnnDriver.hpp
+++ b/1.0/ArmnnDriver.hpp
@@ -58,7 +58,7 @@ public:
cb);
}
- Return<DeviceStatus> getStatus() override
+ Return<V1_0::DeviceStatus> getStatus() override
{
ALOGV("hal_1_0::ArmnnDriver::getStatus()");
diff --git a/1.0/ArmnnDriverImpl.hpp b/1.0/ArmnnDriverImpl.hpp
index bb93e2e..3abe751 100644
--- a/1.0/ArmnnDriverImpl.hpp
+++ b/1.0/ArmnnDriverImpl.hpp
@@ -15,6 +15,10 @@
using namespace android::nn::hal;
#endif
+#ifdef ARMNN_ANDROID_S
+using namespace android::hardware;
+#endif
+
namespace V1_0 = ::android::hardware::neuralnetworks::V1_0;
namespace armnn_driver
diff --git a/1.1/ArmnnDriver.hpp b/1.1/ArmnnDriver.hpp
index a6849ab..521b918 100644
--- a/1.1/ArmnnDriver.hpp
+++ b/1.1/ArmnnDriver.hpp
@@ -88,9 +88,9 @@ public:
{
ALOGV("hal_1_1::ArmnnDriver::prepareModel_1_1()");
- if (!(preference == ExecutionPreference::LOW_POWER ||
- preference == ExecutionPreference::FAST_SINGLE_ANSWER ||
- preference == ExecutionPreference::SUSTAINED_SPEED))
+ if (!(preference == V1_1::ExecutionPreference::LOW_POWER ||
+ preference == V1_1::ExecutionPreference::FAST_SINGLE_ANSWER ||
+ preference == V1_1::ExecutionPreference::SUSTAINED_SPEED))
{
ALOGV("hal_1_1::ArmnnDriver::prepareModel_1_1: Invalid execution preference");
cb->notify(V1_0::ErrorStatus::INVALID_ARGUMENT, nullptr);
@@ -106,7 +106,7 @@ public:
&& m_Options.GetFp16Enabled());
}
- Return<DeviceStatus> getStatus() override
+ Return<V1_0::DeviceStatus> getStatus() override
{
ALOGV("hal_1_1::ArmnnDriver::getStatus()");
diff --git a/1.1/ArmnnDriverImpl.hpp b/1.1/ArmnnDriverImpl.hpp
index f49dee0..c90e04b 100644
--- a/1.1/ArmnnDriverImpl.hpp
+++ b/1.1/ArmnnDriverImpl.hpp
@@ -15,6 +15,10 @@
using namespace android::nn::hal;
#endif
+#ifdef ARMNN_ANDROID_S
+using namespace android::hardware;
+#endif
+
namespace V1_0 = ::android::hardware::neuralnetworks::V1_0;
namespace V1_1 = ::android::hardware::neuralnetworks::V1_1;
diff --git a/1.2/ArmnnDriver.hpp b/1.2/ArmnnDriver.hpp
index 6dba2e9..5227272 100644
--- a/1.2/ArmnnDriver.hpp
+++ b/1.2/ArmnnDriver.hpp
@@ -93,9 +93,9 @@ public:
{
ALOGV("hal_1_2::ArmnnDriver::prepareModel_1_1()");
- if (!(preference == ExecutionPreference::LOW_POWER ||
- preference == ExecutionPreference::FAST_SINGLE_ANSWER ||
- preference == ExecutionPreference::SUSTAINED_SPEED))
+ if (!(preference == V1_1::ExecutionPreference::LOW_POWER ||
+ preference == V1_1::ExecutionPreference::FAST_SINGLE_ANSWER ||
+ preference == V1_1::ExecutionPreference::SUSTAINED_SPEED))
{
ALOGV("hal_1_2::ArmnnDriver::prepareModel_1_1: Invalid execution preference");
cb->notify(V1_0::ErrorStatus::INVALID_ARGUMENT, nullptr);
@@ -111,7 +111,7 @@ public:
&& m_Options.GetFp16Enabled());
}
- Return<DeviceStatus> getStatus() override
+ Return<V1_0::DeviceStatus> getStatus() override
{
ALOGV("hal_1_2::ArmnnDriver::getStatus()");
@@ -138,7 +138,7 @@ public:
const android::hardware::hidl_vec<android::hardware::hidl_handle>&,
const android::hardware::hidl_vec<android::hardware::hidl_handle>&,
const HidlToken&,
- const sp<V1_2::IPreparedModelCallback>& callback)
+ const android::sp<V1_2::IPreparedModelCallback>& callback)
{
ALOGV("hal_1_2::ArmnnDriver::prepareModelFromCache()");
callback->notify_1_2(V1_0::ErrorStatus::GENERAL_FAILURE, nullptr);
@@ -152,9 +152,9 @@ public:
{
ALOGV("hal_1_2::ArmnnDriver::prepareModel_1_2()");
- if (!(preference == ExecutionPreference::LOW_POWER ||
- preference == ExecutionPreference::FAST_SINGLE_ANSWER ||
- preference == ExecutionPreference::SUSTAINED_SPEED))
+ if (!(preference == V1_1::ExecutionPreference::LOW_POWER ||
+ preference == V1_1::ExecutionPreference::FAST_SINGLE_ANSWER ||
+ preference == V1_1::ExecutionPreference::SUSTAINED_SPEED))
{
ALOGV("hal_1_2::ArmnnDriver::prepareModel_1_2: Invalid execution preference");
cb->notify(V1_0::ErrorStatus::INVALID_ARGUMENT, nullptr);
diff --git a/1.2/ArmnnDriverImpl.cpp b/1.2/ArmnnDriverImpl.cpp
index 94fb3c8..d35826e 100644
--- a/1.2/ArmnnDriverImpl.cpp
+++ b/1.2/ArmnnDriverImpl.cpp
@@ -56,9 +56,9 @@ const char *g_OperandTypeInt32PerformanceExecTime = "Armnn.operandType
const char *g_OperandTypeInt32PerformancePowerUsage = "Armnn.operandTypeInt32Performance.powerUsage";
-void NotifyCallbackAndCheck(const sp<V1_2::IPreparedModelCallback>& callback,
+void NotifyCallbackAndCheck(const android::sp<V1_2::IPreparedModelCallback>& callback,
V1_0::ErrorStatus errorStatus,
- const sp<V1_2::IPreparedModel>& preparedModelPtr)
+ const android::sp<V1_2::IPreparedModel>& preparedModelPtr)
{
Return<void> returned = callback->notify_1_2(errorStatus, preparedModelPtr);
// This check is required, if the callback fails and it isn't checked it will bring down the service
@@ -71,7 +71,7 @@ void NotifyCallbackAndCheck(const sp<V1_2::IPreparedModelCallback>& callback,
Return<V1_0::ErrorStatus> FailPrepareModel(V1_0::ErrorStatus error,
const std::string& message,
- const sp<V1_2::IPreparedModelCallback>& callback)
+ const android::sp<V1_2::IPreparedModelCallback>& callback)
{
ALOGW("ArmnnDriverImpl::prepareModel: %s", message.c_str());
NotifyCallbackAndCheck(callback, error, nullptr);
@@ -90,7 +90,7 @@ Return<V1_0::ErrorStatus> ArmnnDriverImpl::prepareArmnnModel_1_2(
const armnn::IGpuAccTunedParametersPtr& clTunedParameters,
const DriverOptions& options,
const V1_2::Model& model,
- const sp<V1_2::IPreparedModelCallback>& cb,
+ const android::sp<V1_2::IPreparedModelCallback>& cb,
bool float32ToFloat16)
{
ALOGV("ArmnnDriverImpl::prepareArmnnModel_1_2()");
@@ -267,7 +267,7 @@ Return<void> ArmnnDriverImpl::getCapabilities_1_2(const armnn::IRuntimePtr& runt
ParseSystemProperty(g_RelaxedFloat32toFloat16PerformancePowerUsage, defaultValue);
// Set the base value for all operand types
- #ifdef ARMNN_ANDROID_R
+ #if defined(ARMNN_ANDROID_R) || defined(ARMNN_ANDROID_S)
capabilities.operandPerformance = nonExtensionOperandPerformance<HalVersion::V1_2>({FLT_MAX, FLT_MAX});
#else
capabilities.operandPerformance = nonExtensionOperandPerformance({FLT_MAX, FLT_MAX});
@@ -346,7 +346,7 @@ Return<void> ArmnnDriverImpl::getCapabilities_1_2(const armnn::IRuntimePtr& runt
capabilities.relaxedFloat32toFloat16PerformanceTensor.powerUsage = 0;
// Set the base value for all operand types
- #ifdef ARMNN_ANDROID_R
+ #if defined(ARMNN_ANDROID_R) || defined(ARMNN_ANDROID_S)
capabilities.operandPerformance = nonExtensionOperandPerformance<HalVersion::V1_2>({0.f, 0.0f});
#else
capabilities.operandPerformance = nonExtensionOperandPerformance({0.f, 0.0f});
diff --git a/1.2/ArmnnDriverImpl.hpp b/1.2/ArmnnDriverImpl.hpp
index 73ba133..eeb491b 100644
--- a/1.2/ArmnnDriverImpl.hpp
+++ b/1.2/ArmnnDriverImpl.hpp
@@ -15,6 +15,10 @@
using namespace android::nn::hal;
#endif
+#ifdef ARMNN_ANDROID_S
+using namespace android::hardware;
+#endif
+
namespace V1_0 = ::android::hardware::neuralnetworks::V1_0;
namespace V1_2 = ::android::hardware::neuralnetworks::V1_2;
diff --git a/1.3/ArmnnDriver.hpp b/1.3/ArmnnDriver.hpp
index b6b55fa..451b5ab 100644
--- a/1.3/ArmnnDriver.hpp
+++ b/1.3/ArmnnDriver.hpp
@@ -95,9 +95,9 @@ public:
{
ALOGV("hal_1_3::ArmnnDriver::prepareModel_1_1()");
- if (!(preference == ExecutionPreference::LOW_POWER ||
- preference == ExecutionPreference::FAST_SINGLE_ANSWER ||
- preference == ExecutionPreference::SUSTAINED_SPEED))
+ if (!(preference == V1_1::ExecutionPreference::LOW_POWER ||
+ preference == V1_1::ExecutionPreference::FAST_SINGLE_ANSWER ||
+ preference == V1_1::ExecutionPreference::SUSTAINED_SPEED))
{
ALOGV("hal_1_3::ArmnnDriver::prepareModel_1_1: Invalid execution preference");
cb->notify(V1_0::ErrorStatus::INVALID_ARGUMENT, nullptr);
@@ -138,9 +138,9 @@ public:
{
ALOGV("hal_1_3::ArmnnDriver::prepareModel_1_2()");
- if (!(preference == ExecutionPreference::LOW_POWER ||
- preference == ExecutionPreference::FAST_SINGLE_ANSWER ||
- preference == ExecutionPreference::SUSTAINED_SPEED))
+ if (!(preference == V1_1::ExecutionPreference::LOW_POWER ||
+ preference == V1_1::ExecutionPreference::FAST_SINGLE_ANSWER ||
+ preference == V1_1::ExecutionPreference::SUSTAINED_SPEED))
{
ALOGV("hal_1_3::ArmnnDriver::prepareModel_1_2: Invalid execution preference");
cb->notify(V1_0::ErrorStatus::INVALID_ARGUMENT, nullptr);
@@ -185,9 +185,9 @@ public:
{
ALOGV("hal_1_3::ArmnnDriver::prepareModel_1_3()");
- if (!(preference == ExecutionPreference::LOW_POWER ||
- preference == ExecutionPreference::FAST_SINGLE_ANSWER ||
- preference == ExecutionPreference::SUSTAINED_SPEED))
+ if (!(preference == V1_1::ExecutionPreference::LOW_POWER ||
+ preference == V1_1::ExecutionPreference::FAST_SINGLE_ANSWER ||
+ preference == V1_1::ExecutionPreference::SUSTAINED_SPEED))
{
ALOGV("hal_1_3::ArmnnDriver::prepareModel_1_3: Invalid execution preference");
cb->notify_1_3(V1_3::ErrorStatus::INVALID_ARGUMENT, nullptr);
@@ -226,7 +226,7 @@ public:
return Void();
}
- Return<DeviceStatus> getStatus() override
+ Return<V1_0::DeviceStatus> getStatus() override
{
ALOGV("hal_1_3::ArmnnDriver::getStatus()");
@@ -253,32 +253,32 @@ public:
const android::hardware::hidl_vec<android::hardware::hidl_handle>&,
const android::hardware::hidl_vec<android::hardware::hidl_handle>&,
const HidlToken&,
- const sp<V1_2::IPreparedModelCallback>& callback)
+ const android::sp<V1_2::IPreparedModelCallback>& callback)
{
ALOGV("hal_1_3::ArmnnDriver::prepareModelFromCache()");
callback->notify_1_2(V1_0::ErrorStatus::GENERAL_FAILURE, nullptr);
return V1_0::ErrorStatus::GENERAL_FAILURE;
}
- Return<ErrorStatus> prepareModelFromCache_1_3(
+ Return<V1_3::ErrorStatus> prepareModelFromCache_1_3(
const V1_3::OptionalTimePoint&,
const android::hardware::hidl_vec<android::hardware::hidl_handle>&,
const android::hardware::hidl_vec<android::hardware::hidl_handle>&,
const HidlToken&,
- const sp<V1_3::IPreparedModelCallback>& callback)
+ const android::sp<V1_3::IPreparedModelCallback>& callback)
{
ALOGV("hal_1_3::ArmnnDriver::prepareModelFromCache()");
- callback->notify_1_3(ErrorStatus::GENERAL_FAILURE, nullptr);
- return ErrorStatus::GENERAL_FAILURE;
+ callback->notify_1_3(V1_3::ErrorStatus::GENERAL_FAILURE, nullptr);
+ return V1_3::ErrorStatus::GENERAL_FAILURE;
}
Return<void> allocate(const V1_3::BufferDesc& /*desc*/,
- const hidl_vec<sp<V1_3::IPreparedModel>>& /*preparedModels*/,
+ const hidl_vec<android::sp<V1_3::IPreparedModel>>& /*preparedModels*/,
const hidl_vec<V1_3::BufferRole>& /*inputRoles*/,
const hidl_vec<V1_3::BufferRole>& /*outputRoles*/,
allocate_cb cb) {
ALOGV("hal_1_3::ArmnnDriver::allocate()");
- cb(ErrorStatus::GENERAL_FAILURE, nullptr, 0);
+ cb(V1_3::ErrorStatus::GENERAL_FAILURE, nullptr, 0);
return Void();
}
diff --git a/1.3/ArmnnDriverImpl.cpp b/1.3/ArmnnDriverImpl.cpp
index f5a6e85..6a69765 100644
--- a/1.3/ArmnnDriverImpl.cpp
+++ b/1.3/ArmnnDriverImpl.cpp
@@ -66,9 +66,9 @@ const char *g_OperandTypeInt32PerformanceExecTime = "Armnn.operandType
const char *g_OperandTypeInt32PerformancePowerUsage = "Armnn.operandTypeInt32Performance.powerUsage";
-void NotifyCallbackAndCheck(const sp<V1_3::IPreparedModelCallback>& callback,
+void NotifyCallbackAndCheck(const android::sp<V1_3::IPreparedModelCallback>& callback,
V1_3::ErrorStatus errorStatus,
- const sp<V1_3::IPreparedModel>& preparedModelPtr)
+ const android::sp<V1_3::IPreparedModel>& preparedModelPtr)
{
Return<void> returned = callback->notify_1_3(errorStatus, preparedModelPtr);
// This check is required, if the callback fails and it isn't checked it will bring down the service
@@ -81,7 +81,7 @@ void NotifyCallbackAndCheck(const sp<V1_3::IPreparedModelCallback>& callback,
Return<V1_3::ErrorStatus> FailPrepareModel(V1_3::ErrorStatus error,
const std::string& message,
- const sp<V1_3::IPreparedModelCallback>& callback)
+ const android::sp<V1_3::IPreparedModelCallback>& callback)
{
ALOGW("ArmnnDriverImpl::prepareModel: %s", message.c_str());
NotifyCallbackAndCheck(callback, error, nullptr);
@@ -100,7 +100,7 @@ Return<V1_3::ErrorStatus> ArmnnDriverImpl::prepareArmnnModel_1_3(
const armnn::IGpuAccTunedParametersPtr& clTunedParameters,
const DriverOptions& options,
const V1_3::Model& model,
- const sp<V1_3::IPreparedModelCallback>& cb,
+ const android::sp<V1_3::IPreparedModelCallback>& cb,
bool float32ToFloat16,
V1_3::Priority priority)
{
diff --git a/1.3/ArmnnDriverImpl.hpp b/1.3/ArmnnDriverImpl.hpp
index 2b39d4e..3c094fe 100644
--- a/1.3/ArmnnDriverImpl.hpp
+++ b/1.3/ArmnnDriverImpl.hpp
@@ -11,7 +11,13 @@
#include <armnn/ArmNN.hpp>
+#if !defined(ARMNN_ANDROID_S)
using namespace android::nn::hal;
+#endif
+
+#ifdef ARMNN_ANDROID_S
+using namespace android::hardware;
+#endif
namespace V1_0 = ::android::hardware::neuralnetworks::V1_0;
namespace V1_2 = ::android::hardware::neuralnetworks::V1_2;
diff --git a/Android.mk b/Android.mk
index 8b884e1..06b95a1 100644
--- a/Android.mk
+++ b/Android.mk
@@ -9,7 +9,9 @@ LOCAL_PATH := $(ANDROID_NN_DRIVER_LOCAL_PATH)
P_OR_LATER := 0
Q_OR_LATER := 0
R_OR_LATER := 0
+S_OR_LATER := 0
ANDROID_R := 0
+ANDROID_S := 0
ifeq ($(PLATFORM_VERSION),9)
P_OR_LATER := 1
@@ -41,6 +43,24 @@ R_OR_LATER := 1
ANDROID_R := 1
endif # PLATFORM_VERSION == 11
+ifeq ($(PLATFORM_VERSION),S)
+P_OR_LATER := 1
+Q_OR_LATER := 1
+R_OR_LATER := 1
+S_OR_LATER := 1
+ANDROID_R := 0
+ANDROID_S := 1
+endif # PLATFORM_VERSION == S
+
+ifeq ($(PLATFORM_VERSION),12)
+P_OR_LATER := 1
+Q_OR_LATER := 1
+R_OR_LATER := 1
+S_OR_LATER := 1
+ANDROID_R := 0
+ANDROID_S := 1
+endif # PLATFORM_VERSION == 12
+
CPP_VERSION := c++14
ifeq ($(Q_OR_LATER),1)
@@ -54,6 +74,9 @@ ARMNN_UTILS_HEADER_PATH := $(LOCAL_PATH)/armnn/src/armnnUtils
ARMNN_THIRD_PARTY_PATH := $(LOCAL_PATH)/armnn/third-party
OPENCL_HEADER_PATH := $(LOCAL_PATH)/clframework/include
NN_HEADER_PATH := $(LOCAL_PATH)/../../../frameworks/ml/nn/runtime/include
+ifeq ($(S_OR_LATER),1)
+NN_HEADER_PATH := $(LOCAL_PATH)/../../../packages/modules/NeuralNetworks/runtime/include
+endif
# Variables to control CL/NEON/reference backend support
# Set them to '0' to disable support for a specific backend
@@ -124,6 +147,11 @@ LOCAL_CFLAGS+= \
-DARMNN_ANDROID_R
endif
+ifeq ($(ANDROID_S),1)
+LOCAL_CFLAGS+= \
+ -DARMNN_ANDROID_S
+endif
+
ifeq ($(ARMNN_DRIVER_DEBUG),1)
LOCAL_CFLAGS+= \
-UNDEBUG
@@ -255,6 +283,11 @@ LOCAL_CFLAGS+= \
-DARMNN_ANDROID_R
endif
+ifeq ($(ANDROID_S),1)
+LOCAL_CFLAGS+= \
+ -DARMNN_ANDROID_S
+endif
+
ifeq ($(ARMNN_COMPUTE_CL_ENABLED),1)
LOCAL_CFLAGS += \
-DARMCOMPUTECL_ENABLED
@@ -373,6 +406,11 @@ LOCAL_CFLAGS+= \
-DARMNN_ANDROID_R
endif
+ifeq ($(ANDROID_S),1)
+LOCAL_CFLAGS+= \
+ -DARMNN_ANDROID_S
+endif
+
ifeq ($(ARMNN_COMPUTE_CL_ENABLED),1)
LOCAL_CFLAGS += \
-DARMCOMPUTECL_ENABLED
@@ -478,7 +516,16 @@ LOCAL_CFLAGS := \
-Werror \
-Wno-format-security \
-DARMNN_ANDROID_NN_V1_3 \
+
+ifeq ($(ANDROID_R),1)
+LOCAL_CFLAGS+= \
-DARMNN_ANDROID_R
+endif
+
+ifeq ($(ANDROID_S),1)
+LOCAL_CFLAGS+= \
+ -DARMNN_ANDROID_S
+endif
ifeq ($(ARMNN_DRIVER_DEBUG),1)
LOCAL_CFLAGS+= \
@@ -603,6 +650,11 @@ LOCAL_CFLAGS+= \
-DARMNN_ANDROID_R
endif
+ifeq ($(ANDROID_S),1)
+LOCAL_CFLAGS+= \
+ -DARMNN_ANDROID_S
+endif
+
LOCAL_SRC_FILES := \
service.cpp
@@ -700,6 +752,11 @@ LOCAL_CFLAGS+= \
-DARMNN_ANDROID_R
endif
+ifeq ($(ANDROID_S),1)
+LOCAL_CFLAGS+= \
+ -DARMNN_ANDROID_S
+endif
+
LOCAL_SRC_FILES := \
service.cpp
@@ -788,6 +845,11 @@ LOCAL_CFLAGS+= \
-DARMNN_ANDROID_R
endif
+ifeq ($(ANDROID_S),1)
+LOCAL_CFLAGS+= \
+ -DARMNN_ANDROID_S
+endif
+
LOCAL_SRC_FILES := \
service.cpp
@@ -860,7 +922,16 @@ LOCAL_CFLAGS := \
-std=$(CPP_VERSION) \
-fexceptions \
-DARMNN_ANDROID_NN_V1_3 \
+
+ifeq ($(ANDROID_R),1)
+LOCAL_CFLAGS+= \
-DARMNN_ANDROID_R
+endif
+
+ifeq ($(ANDROID_S),1)
+LOCAL_CFLAGS+= \
+ -DARMNN_ANDROID_S
+endif
ifeq ($(ARMNN_DRIVER_DEBUG),1)
LOCAL_CFLAGS += \
diff --git a/ArmnnDriverImpl.cpp b/ArmnnDriverImpl.cpp
index 2381595..5ce88da 100644
--- a/ArmnnDriverImpl.cpp
+++ b/ArmnnDriverImpl.cpp
@@ -292,11 +292,11 @@ Return<void> ArmnnDriverImpl<HalPolicy>::getSupportedOperations(const armnn::IRu
}
template<typename HalPolicy>
-Return<DeviceStatus> ArmnnDriverImpl<HalPolicy>::getStatus()
+Return<V1_0::DeviceStatus> ArmnnDriverImpl<HalPolicy>::getStatus()
{
ALOGV("ArmnnDriver::getStatus()");
- return DeviceStatus::AVAILABLE;
+ return V1_0::DeviceStatus::AVAILABLE;
}
///
diff --git a/ArmnnDriverImpl.hpp b/ArmnnDriverImpl.hpp
index cdff905..4785ef7 100644
--- a/ArmnnDriverImpl.hpp
+++ b/ArmnnDriverImpl.hpp
@@ -13,6 +13,10 @@
using namespace android::nn::hal;
#endif
+#ifdef ARMNN_ANDROID_S
+using namespace android::hardware;
+#endif
+
namespace V1_0 = ::android::hardware::neuralnetworks::V1_0;
namespace V1_1 = ::android::hardware::neuralnetworks::V1_1;
@@ -57,7 +61,7 @@ public:
const android::sp<V1_0::IPreparedModelCallback>& cb,
bool float32ToFloat16 = false);
- static Return<DeviceStatus> getStatus();
+ static Return<V1_0::DeviceStatus> getStatus();
};
diff --git a/ArmnnPreparedModel.cpp b/ArmnnPreparedModel.cpp
index c6b6b71..60beac4 100644
--- a/ArmnnPreparedModel.cpp
+++ b/ArmnnPreparedModel.cpp
@@ -15,6 +15,10 @@
#include <cassert>
#include <cinttypes>
+#ifdef ARMNN_ANDROID_S
+#include <LegacyUtils.h>
+#endif
+
using namespace android;
namespace
@@ -33,7 +37,7 @@ void NotifyCallbackAndCheck(const ::android::sp<V1_0::IExecutionCallback>& callb
}
}
-bool ValidateRequestArgument(const RequestArgument& requestArg, const armnn::TensorInfo& tensorInfo)
+bool ValidateRequestArgument(const V1_0::RequestArgument& requestArg, const armnn::TensorInfo& tensorInfo)
{
if (requestArg.dimensions.size() != 0)
{
@@ -58,7 +62,7 @@ bool ValidateRequestArgument(const RequestArgument& requestArg, const armnn::Ten
return true;
}
-armnn::Tensor GetTensorForRequestArgument(const RequestArgument& requestArg,
+armnn::Tensor GetTensorForRequestArgument(const V1_0::RequestArgument& requestArg,
const armnn::TensorInfo& tensorInfo,
const std::vector<::android::nn::RunTimePoolInfo>& requestPools)
{
@@ -164,12 +168,15 @@ Return<V1_0::ErrorStatus> ArmnnPreparedModel<HalVersion>::execute(
// map the memory pool into shared pointers
// use a shared memory pools vector on the heap, as it is passed to the request thread
auto pMemPools = std::make_shared<std::vector<android::nn::RunTimePoolInfo>>();
+#if !defined(ARMNN_ANDROID_S)
if (!setRunTimePoolInfosFromHidlMemories(pMemPools.get(), request.pools))
+#else
+ if (!setRunTimePoolInfosFromCanonicalMemories(pMemPools.get(), uncheckedConvert(request.pools)))
+#endif
{
NotifyCallbackAndCheck(callback, V1_0::ErrorStatus::GENERAL_FAILURE, "ArmnnPreparedModel::execute");
return V1_0::ErrorStatus::GENERAL_FAILURE;
}
-
// add the inputs and outputs with their data
try
{
@@ -277,7 +284,7 @@ void ArmnnPreparedModel<HalVersion>::ExecuteGraph(
{
// Type android::nn::RunTimePoolInfo has changed between Android P & Q and Android R, where
// update() has been removed and flush() added.
- #if defined(ARMNN_ANDROID_R) // Use the new Android implementation.
+ #if defined(ARMNN_ANDROID_R) || defined(ARMNN_ANDROID_S) // Use the new Android implementation.
pool.flush();
#else
pool.update();
diff --git a/ArmnnPreparedModel_1_2.cpp b/ArmnnPreparedModel_1_2.cpp
index c2148ba..a2148c2 100644
--- a/ArmnnPreparedModel_1_2.cpp
+++ b/ArmnnPreparedModel_1_2.cpp
@@ -16,12 +16,16 @@
#include <cassert>
#include <cinttypes>
+#ifdef ARMNN_ANDROID_S
+#include <LegacyUtils.h>
+#endif
+
using namespace android;
using namespace android::hardware;
namespace {
-static const Timing g_NoTiming = {.timeOnDevice = UINT64_MAX, .timeInDriver = UINT64_MAX};
+static const V1_2::Timing g_NoTiming = {.timeOnDevice = UINT64_MAX, .timeInDriver = UINT64_MAX};
using namespace armnn_driver;
using TimePoint = std::chrono::steady_clock::time_point;
@@ -38,8 +42,8 @@ unsigned long MicrosecondsDuration(TimePoint endPoint, TimePoint startPoint)
void NotifyCallbackAndCheck(const ::android::sp<V1_0::IExecutionCallback>& callback,
V1_0::ErrorStatus errorStatus,
- std::vector<OutputShape>,
- const Timing,
+ std::vector<V1_2::OutputShape>,
+ const V1_2::Timing,
std::string callingFunction)
{
Return<void> returned = callback->notify(errorStatus);
@@ -53,8 +57,8 @@ void NotifyCallbackAndCheck(const ::android::sp<V1_0::IExecutionCallback>& callb
void NotifyCallbackAndCheck(const ::android::sp<V1_2::IExecutionCallback>& callback,
V1_0::ErrorStatus errorStatus,
- std::vector<OutputShape> outputShapes,
- const Timing timing,
+ std::vector<V1_2::OutputShape> outputShapes,
+ const V1_2::Timing timing,
std::string callingFunction)
{
Return<void> returned = callback->notify_1_2(errorStatus, outputShapes, timing);
@@ -66,7 +70,7 @@ void NotifyCallbackAndCheck(const ::android::sp<V1_2::IExecutionCallback>& callb
}
}
-bool ValidateRequestArgument(const RequestArgument& requestArg, const armnn::TensorInfo& tensorInfo)
+bool ValidateRequestArgument(const V1_0::RequestArgument& requestArg, const armnn::TensorInfo& tensorInfo)
{
if (requestArg.dimensions.size() != 0)
{
@@ -91,7 +95,7 @@ bool ValidateRequestArgument(const RequestArgument& requestArg, const armnn::Ten
return true;
}
-armnn::Tensor GetTensorForRequestArgument(const RequestArgument& requestArg,
+armnn::Tensor GetTensorForRequestArgument(const V1_0::RequestArgument& requestArg,
const armnn::TensorInfo& tensorInfo,
const std::vector<::android::nn::RunTimePoolInfo>& requestPools)
{
@@ -178,20 +182,20 @@ Return <V1_0::ErrorStatus> ArmnnPreparedModel_1_2<HalVersion>::execute(const V1_
}
auto cb = [callback](V1_0::ErrorStatus errorStatus,
- std::vector<OutputShape> outputShapes,
- const Timing& timing,
+ std::vector<V1_2::OutputShape> outputShapes,
+ const V1_2::Timing& timing,
std::string callingFunction)
{
NotifyCallbackAndCheck(callback, errorStatus, outputShapes, timing, callingFunction);
};
- return Execute(request, MeasureTiming::NO, cb);
+ return Execute(request, V1_2::MeasureTiming::NO, cb);
}
template<typename HalVersion>
Return <V1_0::ErrorStatus> ArmnnPreparedModel_1_2<HalVersion>::execute_1_2(
const V1_0::Request& request,
- MeasureTiming measureTiming,
+ V1_2::MeasureTiming measureTiming,
const sp<V1_2::IExecutionCallback>& callback)
{
if (callback.get() == nullptr)
@@ -201,8 +205,8 @@ Return <V1_0::ErrorStatus> ArmnnPreparedModel_1_2<HalVersion>::execute_1_2(
}
auto cb = [callback](V1_0::ErrorStatus errorStatus,
- std::vector<OutputShape> outputShapes,
- const Timing& timing,
+ std::vector<V1_2::OutputShape> outputShapes,
+ const V1_2::Timing& timing,
std::string callingFunction)
{
NotifyCallbackAndCheck(callback, errorStatus, outputShapes, timing, callingFunction);
@@ -240,7 +244,7 @@ Return<V1_0::ErrorStatus> ArmnnPreparedModel_1_2<HalVersion>::PrepareMemoryForIn
template<typename HalVersion>
Return<V1_0::ErrorStatus> ArmnnPreparedModel_1_2<HalVersion>::PrepareMemoryForOutputs(
armnn::OutputTensors& outputs,
- std::vector<OutputShape> &outputShapes,
+ std::vector<V1_2::OutputShape> &outputShapes,
const V1_0::Request& request,
const std::vector<android::nn::RunTimePoolInfo>& memPools)
{
@@ -265,13 +269,23 @@ Return<V1_0::ErrorStatus> ArmnnPreparedModel_1_2<HalVersion>::PrepareMemoryForOu
return V1_0::ErrorStatus::OUTPUT_INSUFFICIENT_SIZE;
}
+#if !defined(ARMNN_ANDROID_S)
const size_t bufferSize = memPools.at(outputArg.location.poolIndex).getHidlMemory().size();
if (bufferSize < outputSize)
{
ALOGW("ArmnnPreparedModel_1_2::Execute failed: bufferSize < outputSize");
return V1_0::ErrorStatus::OUTPUT_INSUFFICIENT_SIZE;
}
-
+#else
+ const size_t bufferSize = memPools.at(outputArg.location.poolIndex).getMemory().size;
+ if (bufferSize < outputSize)
+ {
+ ALOGW("ArmnnPreparedModel_1_2::Execute failed bufferSize (%s) < outputSize (%s)",
+ std::to_string(bufferSize).c_str(), std::to_string(outputSize).c_str());
+ outputShapes[i].isSufficient = false;
+ return V1_0::ErrorStatus::OUTPUT_INSUFFICIENT_SIZE;
+ }
+#endif
outputs.emplace_back(i, outputTensor);
outputShapes[i] = ComputeShape(outputTensorInfo);
}
@@ -287,12 +301,15 @@ Return<V1_0::ErrorStatus> ArmnnPreparedModel_1_2<HalVersion>::PrepareMemoryForIO
const V1_0::Request& request,
CallbackAsync_1_2 callback)
{
+#if !defined(ARMNN_ANDROID_S)
if (!setRunTimePoolInfosFromHidlMemories(&memPools, request.pools))
+#else
+ if (!setRunTimePoolInfosFromCanonicalMemories(&memPools, uncheckedConvert(request.pools)))
+#endif
{
callback(V1_0::ErrorStatus::GENERAL_FAILURE, {}, g_NoTiming, "ArmnnPreparedModel_1_2::execute");
return V1_0::ErrorStatus::GENERAL_FAILURE;
}
-
// add the inputs and outputs with their data
try
{
@@ -302,7 +319,7 @@ Return<V1_0::ErrorStatus> ArmnnPreparedModel_1_2<HalVersion>::PrepareMemoryForIO
return V1_0::ErrorStatus::GENERAL_FAILURE;
}
- std::vector<OutputShape> outputShapes(request.outputs.size());
+ std::vector<V1_2::OutputShape> outputShapes(request.outputs.size());
auto errorStatus = PrepareMemoryForOutputs(outputs, outputShapes, request, memPools);
if (errorStatus != V1_0::ErrorStatus::NONE)
@@ -332,7 +349,7 @@ Return<V1_0::ErrorStatus> ArmnnPreparedModel_1_2<HalVersion>::PrepareMemoryForIO
template<typename HalVersion>
Return<void> ArmnnPreparedModel_1_2<HalVersion>::executeSynchronously(const V1_0::Request& request,
- MeasureTiming measureTiming,
+ V1_2::MeasureTiming measureTiming,
executeSynchronously_cb cb)
{
ALOGV("ArmnnPreparedModel_1_2::executeSynchronously(): %s", GetModelSummary(m_Model).c_str());
@@ -346,7 +363,7 @@ Return<void> ArmnnPreparedModel_1_2<HalVersion>::executeSynchronously(const V1_0
TimePoint driverStart;
- if (measureTiming == MeasureTiming::YES)
+ if (measureTiming == V1_2::MeasureTiming::YES)
{
driverStart = Now();
}
@@ -359,8 +376,8 @@ Return<void> ArmnnPreparedModel_1_2<HalVersion>::executeSynchronously(const V1_0
}
auto cbWrapper = [cb](V1_0::ErrorStatus errorStatus,
- std::vector<OutputShape> outputShapes,
- const Timing& timing,
+ std::vector<V1_2::OutputShape> outputShapes,
+ const V1_2::Timing& timing,
std::string)
{
cb(errorStatus, outputShapes, timing);
@@ -405,7 +422,7 @@ bool ArmnnPreparedModel_1_2<HalVersion>::ExecuteGraph(
DumpTensorsIfRequired("Input", inputTensors);
- std::vector<OutputShape> outputShapes(outputTensors.size());
+ std::vector<V1_2::OutputShape> outputShapes(outputTensors.size());
for (unsigned int i = 0; i < outputTensors.size(); i++)
{
std::pair<int, armnn::Tensor> outputTensorPair = outputTensors[i];
@@ -418,14 +435,14 @@ bool ArmnnPreparedModel_1_2<HalVersion>::ExecuteGraph(
// run it
try
{
- if (cb.ctx.measureTimings == MeasureTiming::YES)
+ if (cb.ctx.measureTimings == V1_2::MeasureTiming::YES)
{
deviceStart = Now();
}
armnn::Status status = m_Runtime->EnqueueWorkload(m_NetworkId, inputTensors, outputTensors);
- if (cb.ctx.measureTimings == MeasureTiming::YES)
+ if (cb.ctx.measureTimings == V1_2::MeasureTiming::YES)
{
deviceEnd = Now();
}
@@ -454,10 +471,10 @@ bool ArmnnPreparedModel_1_2<HalVersion>::ExecuteGraph(
DumpTensorsIfRequired("Output", outputTensors);
- if (cb.ctx.measureTimings == MeasureTiming::YES)
+ if (cb.ctx.measureTimings == V1_2::MeasureTiming::YES)
{
driverEnd = Now();
- Timing timing;
+ V1_2::Timing timing;
timing.timeOnDevice = MicrosecondsDuration(deviceEnd, deviceStart);
timing.timeInDriver = MicrosecondsDuration(driverEnd, cb.ctx.driverStart);
ALOGV("ArmnnPreparedModel_1_2::execute timing - Device = %lu Driver = %lu", timing.timeOnDevice,
@@ -494,10 +511,10 @@ bool ArmnnPreparedModel_1_2<HalVersion>::ExecuteWithDummyInputs()
outputTensors.emplace_back(i, outputTensor);
}
- auto nullCallback = [](V1_0::ErrorStatus, std::vector<OutputShape>, const Timing&, std::string) {};
+ auto nullCallback = [](V1_0::ErrorStatus, std::vector<V1_2::OutputShape>, const V1_2::Timing&, std::string) {};
CallbackContext_1_2 callbackContext;
callbackContext.callback = nullCallback;
- callbackContext.ctx.measureTimings = MeasureTiming::NO;
+ callbackContext.ctx.measureTimings = V1_2::MeasureTiming::NO;
auto memPools = std::make_shared<std::vector<::android::nn::RunTimePoolInfo>>();
return ExecuteGraph(memPools,
inputTensors,
@@ -507,11 +524,11 @@ bool ArmnnPreparedModel_1_2<HalVersion>::ExecuteWithDummyInputs()
template<typename HalVersion>
Return <V1_0::ErrorStatus> ArmnnPreparedModel_1_2<HalVersion>::Execute(const V1_0::Request& request,
- MeasureTiming measureTiming,
+ V1_2::MeasureTiming measureTiming,
CallbackAsync_1_2 callback)
{
ExecutionContext_1_2 ctx;
- if (measureTiming == MeasureTiming::YES)
+ if (measureTiming == V1_2::MeasureTiming::YES)
{
ctx.measureTimings = measureTiming;
ctx.driverStart = Now();
diff --git a/ArmnnPreparedModel_1_2.hpp b/ArmnnPreparedModel_1_2.hpp
index e68614a..13d7494 100644
--- a/ArmnnPreparedModel_1_2.hpp
+++ b/ArmnnPreparedModel_1_2.hpp
@@ -49,17 +49,17 @@ public:
virtual ~ArmnnPreparedModel_1_2();
virtual Return<V1_0::ErrorStatus> execute(const V1_0::Request& request,
- const sp<V1_0::IExecutionCallback>& callback) override;
+ const ::android::sp<V1_0::IExecutionCallback>& callback) override;
- virtual Return<V1_0::ErrorStatus> execute_1_2(const V1_0::Request& request, MeasureTiming measure,
- const sp<V1_2::IExecutionCallback>& callback) override;
+ virtual Return<V1_0::ErrorStatus> execute_1_2(const V1_0::Request& request, V1_2::MeasureTiming measure,
+ const ::android::sp<V1_2::IExecutionCallback>& callback) override;
virtual Return<void> executeSynchronously(const V1_0::Request &request,
- MeasureTiming measure,
+ V1_2::MeasureTiming measure,
V1_2::IPreparedModel::executeSynchronously_cb cb) override;
virtual Return<void> configureExecutionBurst(
- const sp<V1_2::IBurstCallback>& callback,
+ const ::android::sp<V1_2::IBurstCallback>& callback,
const android::hardware::MQDescriptorSync<V1_2::FmqRequestDatum>& requestChannel,
const android::hardware::MQDescriptorSync<V1_2::FmqResultDatum>& resultChannel,
configureExecutionBurst_cb cb) override;
@@ -77,7 +77,7 @@ public:
private:
Return<V1_0::ErrorStatus> Execute(const V1_0::Request& request,
- MeasureTiming measureTiming,
+ V1_2::MeasureTiming measureTiming,
CallbackAsync_1_2 callback);
Return<V1_0::ErrorStatus> PrepareMemoryForInputs(
@@ -87,7 +87,7 @@ private:
Return<V1_0::ErrorStatus> PrepareMemoryForOutputs(
armnn::OutputTensors& outputs,
- std::vector<OutputShape> &outputShapes,
+ std::vector<V1_2::OutputShape> &outputShapes,
const V1_0::Request& request,
const std::vector<android::nn::RunTimePoolInfo>& memPools);
diff --git a/ArmnnPreparedModel_1_3.cpp b/ArmnnPreparedModel_1_3.cpp
index aed4fa1..2970e8f 100644
--- a/ArmnnPreparedModel_1_3.cpp
+++ b/ArmnnPreparedModel_1_3.cpp
@@ -22,12 +22,16 @@
#include <cassert>
#include <cinttypes>
+#ifdef ARMNN_ANDROID_S
+#include <LegacyUtils.h>
+#endif
+
using namespace android;
using namespace android::hardware;
namespace {
-static const Timing g_NoTiming = {.timeOnDevice = UINT64_MAX, .timeInDriver = UINT64_MAX};
+static const V1_2::Timing g_NoTiming = {.timeOnDevice = UINT64_MAX, .timeInDriver = UINT64_MAX};
using namespace armnn_driver;
using TimePoint = std::chrono::steady_clock::time_point;
@@ -44,8 +48,8 @@ unsigned long MicrosecondsDuration(TimePoint endPoint, TimePoint startPoint)
void NotifyCallbackAndCheck(const ::android::sp<V1_0::IExecutionCallback>& callback,
V1_3::ErrorStatus errorStatus,
- std::vector<OutputShape>,
- const Timing,
+ std::vector<V1_2::OutputShape>,
+ const V1_2::Timing,
std::string callingFunction)
{
Return<void> returned = callback->notify(convertToV1_0(errorStatus));
@@ -59,8 +63,8 @@ void NotifyCallbackAndCheck(const ::android::sp<V1_0::IExecutionCallback>& callb
void NotifyCallbackAndCheck(const ::android::sp<V1_2::IExecutionCallback>& callback,
V1_3::ErrorStatus errorStatus,
- std::vector<OutputShape> outputShapes,
- const Timing timing,
+ std::vector<V1_2::OutputShape> outputShapes,
+ const V1_2::Timing timing,
std::string callingFunction)
{
Return<void> returned = callback->notify_1_2(convertToV1_0(errorStatus), outputShapes, timing);
@@ -74,8 +78,8 @@ void NotifyCallbackAndCheck(const ::android::sp<V1_2::IExecutionCallback>& callb
void NotifyCallbackAndCheck(const ::android::sp<V1_3::IExecutionCallback>& callback,
V1_3::ErrorStatus errorStatus,
- std::vector<OutputShape> outputShapes,
- const Timing timing,
+ std::vector<V1_2::OutputShape> outputShapes,
+ const V1_2::Timing timing,
std::string callingFunction)
{
Return<void> returned = callback->notify_1_3(errorStatus, outputShapes, timing);
@@ -87,7 +91,7 @@ void NotifyCallbackAndCheck(const ::android::sp<V1_3::IExecutionCallback>& callb
}
}
-bool ValidateRequestArgument(const RequestArgument& requestArg, const armnn::TensorInfo& tensorInfo)
+bool ValidateRequestArgument(const V1_0::RequestArgument& requestArg, const armnn::TensorInfo& tensorInfo)
{
if (requestArg.dimensions.size() != 0)
{
@@ -112,7 +116,7 @@ bool ValidateRequestArgument(const RequestArgument& requestArg, const armnn::Ten
return true;
}
-armnn::Tensor GetTensorForRequestArgument(const RequestArgument& requestArg,
+armnn::Tensor GetTensorForRequestArgument(const V1_0::RequestArgument& requestArg,
const armnn::TensorInfo& tensorInfo,
const std::vector<::android::nn::RunTimePoolInfo>& requestPools)
{
@@ -201,21 +205,21 @@ Return <V1_0::ErrorStatus> ArmnnPreparedModel_1_3<HalVersion>::execute(const V1_
}
auto cb = [callback](V1_3::ErrorStatus errorStatus,
- std::vector<OutputShape> outputShapes,
- const Timing& timing,
+ std::vector<V1_2::OutputShape> outputShapes,
+ const V1_2::Timing& timing,
std::string callingFunction)
{
NotifyCallbackAndCheck(callback, errorStatus, outputShapes, timing, callingFunction);
};
- return convertToV1_0(Execute(convertToV1_3(request), MeasureTiming::NO, cb));
+ return convertToV1_0(Execute(convertToV1_3(request), V1_2::MeasureTiming::NO, cb));
}
template<typename HalVersion>
Return <V1_0::ErrorStatus> ArmnnPreparedModel_1_3<HalVersion>::execute_1_2(
const V1_0::Request& request,
- MeasureTiming measureTiming,
+ V1_2::MeasureTiming measureTiming,
const sp<V1_2::IExecutionCallback>& callback)
{
if (callback.get() == nullptr)
@@ -225,8 +229,8 @@ Return <V1_0::ErrorStatus> ArmnnPreparedModel_1_3<HalVersion>::execute_1_2(
}
auto cb = [callback](V1_3::ErrorStatus errorStatus,
- std::vector<OutputShape> outputShapes,
- const Timing& timing,
+ std::vector<V1_2::OutputShape> outputShapes,
+ const V1_2::Timing& timing,
std::string callingFunction)
{
NotifyCallbackAndCheck(callback, errorStatus, outputShapes, timing, callingFunction);
@@ -238,7 +242,7 @@ Return <V1_0::ErrorStatus> ArmnnPreparedModel_1_3<HalVersion>::execute_1_2(
template<typename HalVersion>
Return <V1_3::ErrorStatus> ArmnnPreparedModel_1_3<HalVersion>::execute_1_3(
const V1_3::Request& request,
- MeasureTiming measureTiming,
+ V1_2::MeasureTiming measureTiming,
const V1_3::OptionalTimePoint&,
const V1_3::OptionalTimeoutDuration&,
const sp<V1_3::IExecutionCallback>& callback)
@@ -250,8 +254,8 @@ Return <V1_3::ErrorStatus> ArmnnPreparedModel_1_3<HalVersion>::execute_1_3(
}
auto cb = [callback](V1_3::ErrorStatus errorStatus,
- std::vector<OutputShape> outputShapes,
- const Timing& timing,
+ std::vector<V1_2::OutputShape> outputShapes,
+ const V1_2::Timing& timing,
std::string callingFunction)
{
NotifyCallbackAndCheck(callback, errorStatus, outputShapes, timing, callingFunction);
@@ -266,7 +270,7 @@ Return <V1_3::ErrorStatus> ArmnnPreparedModel_1_3<HalVersion>::execute_1_3(
class ArmnnFencedExecutionCallback : public V1_3::IFencedExecutionCallback
{
public:
- ArmnnFencedExecutionCallback(V1_3::ErrorStatus errorStatus, Timing timing, Timing fenceTiming)
+ ArmnnFencedExecutionCallback(V1_3::ErrorStatus errorStatus, V1_2::Timing timing, V1_2::Timing fenceTiming)
: m_ErrorStatus(errorStatus), m_Timing(timing), m_FenceTiming(fenceTiming) {}
~ArmnnFencedExecutionCallback() {}
@@ -277,33 +281,33 @@ public:
}
private:
V1_3::ErrorStatus m_ErrorStatus;
- Timing m_Timing;
- Timing m_FenceTiming;
+ V1_2::Timing m_Timing;
+ V1_2::Timing m_FenceTiming;
};
template<typename HalVersion>
Return<void> ArmnnPreparedModel_1_3<HalVersion>::executeFenced(const V1_3::Request& request,
const hidl_vec<hidl_handle>& fenceWaitFor,
- MeasureTiming measureTiming,
- const OptionalTimePoint& deadline,
- const OptionalTimeoutDuration& loopTimeoutDuration,
- const OptionalTimeoutDuration&,
+ V1_2::MeasureTiming measureTiming,
+ const V1_3::OptionalTimePoint& deadline,
+ const V1_3::OptionalTimeoutDuration& loopTimeoutDuration,
+ const V1_3::OptionalTimeoutDuration&,
executeFenced_cb cb)
{
ALOGV("ArmnnPreparedModel_1_3::executeFenced(...)");
if (cb == nullptr)
{
ALOGE("ArmnnPreparedModel_1_3::executeFenced invalid callback passed");
- cb(ErrorStatus::INVALID_ARGUMENT, hidl_handle(nullptr), nullptr);
+ cb(V1_3::ErrorStatus::INVALID_ARGUMENT, hidl_handle(nullptr), nullptr);
return Void();
}
- if (deadline.getDiscriminator() != OptionalTimePoint::hidl_discriminator::none)
+ if (deadline.getDiscriminator() != V1_3::OptionalTimePoint::hidl_discriminator::none)
{
ALOGW("ArmnnPreparedModel_1_3::executeFenced parameter deadline is set but not supported.");
}
- if (loopTimeoutDuration.getDiscriminator() != OptionalTimeoutDuration::hidl_discriminator::none)
+ if (loopTimeoutDuration.getDiscriminator() != V1_3::OptionalTimeoutDuration::hidl_discriminator::none)
{
ALOGW("ArmnnPreparedModel_1_3::executeFenced parameter loopTimeoutDuration is set but not supported.");
}
@@ -311,12 +315,12 @@ Return<void> ArmnnPreparedModel_1_3<HalVersion>::executeFenced(const V1_3::Reque
if (!android::nn::validateRequest(request, m_Model, /*allowUnspecifiedOutput=*/false))
{
ALOGV("ArmnnPreparedModel_1_3::executeFenced outputs must be specified for fenced execution ");
- cb(ErrorStatus::INVALID_ARGUMENT, hidl_handle(nullptr), nullptr);
+ cb(V1_3::ErrorStatus::INVALID_ARGUMENT, hidl_handle(nullptr), nullptr);
return Void();
}
ExecutionContext_1_3 ctx;
- if (measureTiming == MeasureTiming::YES)
+ if (measureTiming == V1_2::MeasureTiming::YES)
{
ctx.measureTimings = measureTiming;
ctx.driverStart = Now();
@@ -339,20 +343,20 @@ Return<void> ArmnnPreparedModel_1_3<HalVersion>::executeFenced(const V1_3::Reque
auto fenceNativeHandle = fenceWaitFor[index].getNativeHandle();
if (!fenceNativeHandle)
{
- cb(ErrorStatus::INVALID_ARGUMENT, hidl_handle(nullptr), nullptr);
+ cb(V1_3::ErrorStatus::INVALID_ARGUMENT, hidl_handle(nullptr), nullptr);
return Void();
}
if (sync_wait(fenceNativeHandle->data[0], -1) < 0)
{
ALOGE("ArmnnPreparedModel_1_3::executeFenced sync fence failed.");
- cb(ErrorStatus::GENERAL_FAILURE, hidl_handle(nullptr), nullptr);
+ cb(V1_3::ErrorStatus::GENERAL_FAILURE, hidl_handle(nullptr), nullptr);
return Void();
}
}
TimePoint fenceExecutionStart;
- if (measureTiming == MeasureTiming::YES)
+ if (measureTiming == V1_2::MeasureTiming::YES)
{
fenceExecutionStart = Now();
}
@@ -368,14 +372,14 @@ Return<void> ArmnnPreparedModel_1_3<HalVersion>::executeFenced(const V1_3::Reque
auto [status, outShapes, timings, message] = PrepareMemoryForIO(*inputs, *outputs, *memPools, request);
if (status != V1_3::ErrorStatus::NONE)
{
- cb(ErrorStatus::INVALID_ARGUMENT, hidl_handle(nullptr), nullptr);
+ cb(V1_3::ErrorStatus::INVALID_ARGUMENT, hidl_handle(nullptr), nullptr);
return Void();
}
ALOGV("ArmnnPreparedModel_1_3::executeFenced(...) before ExecuteGraph");
// call it with nullCallback for now as we will report the error status from here..
- auto nullCallback = [](V1_3::ErrorStatus, std::vector<OutputShape>, const Timing&, std::string) {};
+ auto nullCallback = [](V1_3::ErrorStatus, std::vector<V1_2::OutputShape>, const V1_2::Timing&, std::string) {};
CallbackContext_1_3 cbCtx;
cbCtx.callback = nullCallback;
cbCtx.ctx = ctx;
@@ -388,9 +392,9 @@ Return<void> ArmnnPreparedModel_1_3<HalVersion>::executeFenced(const V1_3::Reque
}
ALOGV("ArmnnPreparedModel_1_3::executeFenced(...) after ExecuteGraph");
- Timing timing = g_NoTiming;
- Timing fenceTiming = g_NoTiming;
- if (measureTiming == MeasureTiming::YES)
+ V1_2::Timing timing = g_NoTiming;
+ V1_2::Timing fenceTiming = g_NoTiming;
+ if (measureTiming == V1_2::MeasureTiming::YES)
{
fenceTiming.timeOnDevice = MicrosecondsDuration(ctx.deviceEnd, ctx.deviceStart);
fenceTiming.timeInDriver = MicrosecondsDuration(ctx.driverEnd, fenceExecutionStart);
@@ -399,8 +403,8 @@ Return<void> ArmnnPreparedModel_1_3<HalVersion>::executeFenced(const V1_3::Reque
}
sp<ArmnnFencedExecutionCallback> armnnFencedExecutionCallback =
- new ArmnnFencedExecutionCallback(ErrorStatus::NONE, timing, fenceTiming);
- cb(ErrorStatus::NONE, hidl_handle(nullptr), armnnFencedExecutionCallback);
+ new ArmnnFencedExecutionCallback(V1_3::ErrorStatus::NONE, timing, fenceTiming);
+ cb(V1_3::ErrorStatus::NONE, hidl_handle(nullptr), armnnFencedExecutionCallback);
return Void();
}
@@ -433,7 +437,7 @@ Return<V1_3::ErrorStatus> ArmnnPreparedModel_1_3<HalVersion>::PrepareMemoryForIn
template<typename HalVersion>
Return<V1_3::ErrorStatus> ArmnnPreparedModel_1_3<HalVersion>::PrepareMemoryForOutputs(
armnn::OutputTensors& outputs,
- std::vector<OutputShape> &outputShapes,
+ std::vector<V1_2::OutputShape> &outputShapes,
const V1_3::Request& request,
const std::vector<android::nn::RunTimePoolInfo>& memPools)
{
@@ -478,7 +482,13 @@ Return<V1_3::ErrorStatus> ArmnnPreparedModel_1_3<HalVersion>::PrepareMemoryForOu
return V1_3::ErrorStatus::OUTPUT_INSUFFICIENT_SIZE;
}
- const size_t bufferSize = memPools.at(outputArg.location.poolIndex).getHidlMemory().size();
+ size_t bufferSize = 0;
+#if !defined(ARMNN_ANDROID_S)
+ bufferSize = memPools.at(outputArg.location.poolIndex).getHidlMemory().size();
+ if (bufferSize < outputSize)
+#else
+ bufferSize = memPools.at(outputArg.location.poolIndex).getMemory().size;
+#endif
if (bufferSize < outputSize)
{
ALOGW("ArmnnPreparedModel_1_3::Execute failed bufferSize (%s) < outputSize (%s)",
@@ -492,15 +502,19 @@ Return<V1_3::ErrorStatus> ArmnnPreparedModel_1_3<HalVersion>::PrepareMemoryForOu
}
template<typename HalVersion>
-std::tuple<V1_3::ErrorStatus, hidl_vec<OutputShape>, Timing, std::string>
+std::tuple<V1_3::ErrorStatus, hidl_vec<V1_2::OutputShape>, V1_2::Timing, std::string>
ArmnnPreparedModel_1_3<HalVersion>::PrepareMemoryForIO(armnn::InputTensors& inputs,
armnn::OutputTensors& outputs,
std::vector<android::nn::RunTimePoolInfo>& memPools,
const V1_3::Request& request)
{
+#if !defined(ARMNN_ANDROID_S)
if (!setRunTimePoolInfosFromMemoryPools(&memPools, request.pools))
+#else
+ if (!setRunTimePoolInfosFromMemoryPools(&memPools, uncheckedConvert(request.pools)))
+#endif
{
- return {ErrorStatus::INVALID_ARGUMENT, {}, g_NoTiming, "ArmnnPreparedModel_1_3::execute"};
+ return {V1_3::ErrorStatus::INVALID_ARGUMENT, {}, g_NoTiming, "ArmnnPreparedModel_1_3::execute"};
}
// add the inputs and outputs with their data
@@ -508,10 +522,10 @@ std::tuple<V1_3::ErrorStatus, hidl_vec<OutputShape>, Timing, std::string>
{
if (PrepareMemoryForInputs(inputs, request, memPools) != V1_3::ErrorStatus::NONE)
{
- return {ErrorStatus::GENERAL_FAILURE, {}, g_NoTiming, "ArmnnPreparedModel_1_3::execute"};
+ return {V1_3::ErrorStatus::GENERAL_FAILURE, {}, g_NoTiming, "ArmnnPreparedModel_1_3::execute"};
}
- std::vector<OutputShape> outputShapes(request.outputs.size());
+ std::vector<V1_2::OutputShape> outputShapes(request.outputs.size());
auto errorStatus = PrepareMemoryForOutputs(outputs, outputShapes, request, memPools);
if (errorStatus != V1_3::ErrorStatus::NONE)
@@ -522,12 +536,12 @@ std::tuple<V1_3::ErrorStatus, hidl_vec<OutputShape>, Timing, std::string>
catch (armnn::Exception& e)
{
ALOGW("armnn::Exception caught while preparing for EnqueueWorkload: %s", e.what());
- return {ErrorStatus::GENERAL_FAILURE, {}, g_NoTiming, "ArmnnPreparedModel_1_3::execute"};
+ return {V1_3::ErrorStatus::GENERAL_FAILURE, {}, g_NoTiming, "ArmnnPreparedModel_1_3::execute"};
}
catch (std::exception& e)
{
ALOGE("std::exception caught while preparing for EnqueueWorkload: %s", e.what());
- return {ErrorStatus::GENERAL_FAILURE, {}, g_NoTiming, "ArmnnPreparedModel_1_3::execute"};
+ return {V1_3::ErrorStatus::GENERAL_FAILURE, {}, g_NoTiming, "ArmnnPreparedModel_1_3::execute"};
}
return {V1_3::ErrorStatus::NONE, {}, g_NoTiming, "ArmnnPreparedModel_1_3::execute"};
@@ -538,7 +552,7 @@ template<typename CallbackContext>
Return<void> ArmnnPreparedModel_1_3<HalVersion>::ExecuteSynchronously(const V1_3::Request& request,
CallbackContext cbCtx)
{
- if (cbCtx.ctx.measureTimings == MeasureTiming::YES)
+ if (cbCtx.ctx.measureTimings == V1_2::MeasureTiming::YES)
{
cbCtx.ctx.driverStart = Now();
}
@@ -587,7 +601,7 @@ Return<void> ArmnnPreparedModel_1_3<HalVersion>::ExecuteSynchronously(const V1_3
template<typename HalVersion>
Return<void> ArmnnPreparedModel_1_3<HalVersion>::executeSynchronously(const V1_0::Request& request,
- MeasureTiming measureTiming,
+ V1_2::MeasureTiming measureTiming,
executeSynchronously_cb cb)
{
ALOGV("ArmnnPreparedModel_1_3::executeSynchronously(): %s", GetModelSummary(m_Model).c_str());
@@ -600,8 +614,8 @@ Return<void> ArmnnPreparedModel_1_3<HalVersion>::executeSynchronously(const V1_0
}
auto cbWrapper = [cb](V1_3::ErrorStatus errorStatus,
- std::vector<OutputShape> outputShapes,
- const Timing& timing,
+ std::vector<V1_2::OutputShape> outputShapes,
+ const V1_2::Timing& timing,
std::string)
{
cb(convertToV1_0(errorStatus), outputShapes, timing);
@@ -618,7 +632,7 @@ Return<void> ArmnnPreparedModel_1_3<HalVersion>::executeSynchronously(const V1_0
template<typename HalVersion>
Return<void> ArmnnPreparedModel_1_3<HalVersion>::executeSynchronously_1_3(
const V1_3::Request& request,
- MeasureTiming measureTiming,
+ V1_2::MeasureTiming measureTiming,
const V1_3::OptionalTimePoint& deadline,
const V1_3::OptionalTimeoutDuration& loopTimeoutDuration,
executeSynchronously_1_3_cb cb)
@@ -632,20 +646,20 @@ Return<void> ArmnnPreparedModel_1_3<HalVersion>::executeSynchronously_1_3(
return Void();
}
- if (deadline.getDiscriminator() != OptionalTimePoint::hidl_discriminator::none)
+ if (deadline.getDiscriminator() != V1_3::OptionalTimePoint::hidl_discriminator::none)
{
ALOGW("ArmnnPreparedModel_1_3::executeSynchronously_1_3 parameter deadline is set but not supported.");
}
- if (loopTimeoutDuration.getDiscriminator() != OptionalTimeoutDuration::hidl_discriminator::none)
+ if (loopTimeoutDuration.getDiscriminator() != V1_3::OptionalTimeoutDuration::hidl_discriminator::none)
{
ALOGW(
"ArmnnPreparedModel_1_3::executeSynchronously_1_3 parameter loopTimeoutDuration is set but not supported.");
}
auto cbWrapper = [cb](V1_3::ErrorStatus errorStatus,
- std::vector<OutputShape> outputShapes,
- const Timing& timing,
+ std::vector<V1_2::OutputShape> outputShapes,
+ const V1_2::Timing& timing,
std::string)
{
cb(errorStatus, outputShapes, timing);
@@ -695,7 +709,7 @@ Return <V1_3::ErrorStatus> ArmnnPreparedModel_1_3<HalVersion>::ExecuteGraph(
DumpTensorsIfRequired("Input", inputTensors);
- std::vector<OutputShape> outputShapes(outputTensors.size());
+ std::vector<V1_2::OutputShape> outputShapes(outputTensors.size());
for (unsigned int i = 0; i < outputTensors.size(); i++)
{
std::pair<int, armnn::Tensor> outputTensorPair = outputTensors[i];
@@ -708,14 +722,14 @@ Return <V1_3::ErrorStatus> ArmnnPreparedModel_1_3<HalVersion>::ExecuteGraph(
// run it
try
{
- if (cb.ctx.measureTimings == MeasureTiming::YES)
+ if (cb.ctx.measureTimings == V1_2::MeasureTiming::YES)
{
cb.ctx.deviceStart = Now();
}
armnn::Status status = m_Runtime->EnqueueWorkload(m_NetworkId, inputTensors, outputTensors);
- if (cb.ctx.measureTimings == MeasureTiming::YES)
+ if (cb.ctx.measureTimings == V1_2::MeasureTiming::YES)
{
cb.ctx.deviceEnd = Now();
}
@@ -743,10 +757,10 @@ Return <V1_3::ErrorStatus> ArmnnPreparedModel_1_3<HalVersion>::ExecuteGraph(
DumpTensorsIfRequired("Output", outputTensors);
- if (cb.ctx.measureTimings == MeasureTiming::YES)
+ if (cb.ctx.measureTimings == V1_2::MeasureTiming::YES)
{
cb.ctx.driverEnd = Now();
- Timing timing;
+ V1_2::Timing timing;
timing.timeOnDevice = MicrosecondsDuration(cb.ctx.deviceEnd, cb.ctx.deviceStart);
timing.timeInDriver = MicrosecondsDuration(cb.ctx.driverEnd, cb.ctx.driverStart);
ALOGV("ArmnnPreparedModel_1_3::execute timing - Device = %lu Driver = %lu", timing.timeOnDevice,
@@ -783,10 +797,10 @@ bool ArmnnPreparedModel_1_3<HalVersion>::ExecuteWithDummyInputs()
outputTensors.emplace_back(i, outputTensor);
}
- auto nullCallback = [](V1_3::ErrorStatus, std::vector<OutputShape>, const Timing&, std::string) {};
+ auto nullCallback = [](V1_3::ErrorStatus, std::vector<V1_2::OutputShape>, const V1_2::Timing&, std::string) {};
CallbackContext_1_3 callbackContext;
callbackContext.callback = nullCallback;
- callbackContext.ctx.measureTimings = MeasureTiming::NO;
+ callbackContext.ctx.measureTimings = V1_2::MeasureTiming::NO;
auto memPools = std::make_shared<std::vector<::android::nn::RunTimePoolInfo>>();
auto errorStatus = ExecuteGraph(memPools,
@@ -798,11 +812,11 @@ bool ArmnnPreparedModel_1_3<HalVersion>::ExecuteWithDummyInputs()
template<typename HalVersion>
Return <V1_3::ErrorStatus> ArmnnPreparedModel_1_3<HalVersion>::Execute(const V1_3::Request& request,
- MeasureTiming measureTiming,
+ V1_2::MeasureTiming measureTiming,
CallbackAsync_1_3 callback)
{
ExecutionContext_1_3 ctx;
- if (measureTiming == MeasureTiming::YES)
+ if (measureTiming == V1_2::MeasureTiming::YES)
{
ctx.measureTimings = measureTiming;
ctx.driverStart = Now();
diff --git a/ArmnnPreparedModel_1_3.hpp b/ArmnnPreparedModel_1_3.hpp
index 5010bbd..c6cdcdc 100644
--- a/ArmnnPreparedModel_1_3.hpp
+++ b/ArmnnPreparedModel_1_3.hpp
@@ -56,37 +56,37 @@ public:
virtual ~ArmnnPreparedModel_1_3();
Return<V1_0::ErrorStatus> execute(const V1_0::Request& request,
- const sp<V1_0::IExecutionCallback>& callback) override;
+ const ::android::sp<V1_0::IExecutionCallback>& callback) override;
- Return<V1_0::ErrorStatus> execute_1_2(const V1_0::Request& request, MeasureTiming measure,
- const sp<V1_2::IExecutionCallback>& callback) override;
+ Return<V1_0::ErrorStatus> execute_1_2(const V1_0::Request& request, V1_2::MeasureTiming measure,
+ const ::android::sp<V1_2::IExecutionCallback>& callback) override;
Return<V1_3::ErrorStatus> execute_1_3(const V1_3::Request& request,
V1_2::MeasureTiming measure,
const V1_3::OptionalTimePoint&,
const V1_3::OptionalTimeoutDuration&,
- const sp<V1_3::IExecutionCallback>& callback) override;
+ const ::android::sp<V1_3::IExecutionCallback>& callback) override;
Return<void> executeSynchronously(const V1_0::Request &request,
- MeasureTiming measure,
+ V1_2::MeasureTiming measure,
V1_3::IPreparedModel::executeSynchronously_cb cb) override;
Return<void> executeSynchronously_1_3(const V1_3::Request &request,
- MeasureTiming measure,
+ V1_2::MeasureTiming measure,
const V1_3::OptionalTimePoint& deadline,
const V1_3::OptionalTimeoutDuration& loopTimeoutDuration,
V1_3::IPreparedModel::executeSynchronously_1_3_cb cb) override;
Return<void> executeFenced(const V1_3::Request& request,
const android::hardware::hidl_vec<android::hardware::hidl_handle>& fenceWaitFor,
- MeasureTiming measure,
+ V1_2::MeasureTiming measure,
const V1_3::OptionalTimePoint& deadline,
const V1_3::OptionalTimeoutDuration& loopTimeoutDuration,
const V1_3::OptionalTimeoutDuration& duration,
executeFenced_cb callback) override;
Return<void> configureExecutionBurst(
- const sp<V1_2::IBurstCallback>& callback,
+ const ::android::sp<V1_2::IBurstCallback>& callback,
const android::hardware::MQDescriptorSync<V1_2::FmqRequestDatum>& requestChannel,
const android::hardware::MQDescriptorSync<V1_2::FmqResultDatum>& resultChannel,
configureExecutionBurst_cb cb) override;
@@ -110,7 +110,7 @@ public:
private:
Return <V1_3::ErrorStatus> Execute(const V1_3::Request& request,
- MeasureTiming measureTiming,
+ V1_2::MeasureTiming measureTiming,
CallbackAsync_1_3 callback);
Return<V1_3::ErrorStatus> PrepareMemoryForInputs(
@@ -120,11 +120,11 @@ private:
Return<V1_3::ErrorStatus> PrepareMemoryForOutputs(
armnn::OutputTensors& outputs,
- std::vector<OutputShape> &outputShapes,
+ std::vector<V1_2::OutputShape> &outputShapes,
const V1_3::Request& request,
const std::vector<android::nn::RunTimePoolInfo>& memPools);
- std::tuple<V1_3::ErrorStatus, hidl_vec<OutputShape>, Timing, std::string> PrepareMemoryForIO(
+ std::tuple<V1_3::ErrorStatus, hidl_vec<V1_2::OutputShape>, V1_2::Timing, std::string> PrepareMemoryForIO(
armnn::InputTensors& inputs,
armnn::OutputTensors& outputs,
std::vector<android::nn::RunTimePoolInfo>& memPools,
diff --git a/ConversionUtils.hpp b/ConversionUtils.hpp
index c484f33..3432d9f 100644
--- a/ConversionUtils.hpp
+++ b/ConversionUtils.hpp
@@ -39,6 +39,11 @@ namespace armnn_driver
using OperandType = android::nn::hal::OperandType;
#endif
+#ifdef ARMNN_ANDROID_S
+#include <nnapi/Types.h>
+#endif
+
+
struct ConversionData
{
ConversionData(const std::vector<armnn::BackendId>& backends)
@@ -965,8 +970,8 @@ bool GetInputActivationFunctionImpl(const HalOperation& operation,
return Fail("%s: unexpected operand type: %s (should be %s or %s)",
__func__,
toString(type).c_str(),
- toString(OperandType::INT32).c_str(),
- toString(OperandType::TENSOR_INT32).c_str());
+ toString(HalOperandType::INT32).c_str(),
+ toString(HalOperandType::TENSOR_INT32).c_str());
}
int32_t activationFunctionAsInt;
@@ -3441,9 +3446,6 @@ bool ConvertMul(const HalOperation& operation, const HalModel& model, Conversion
armnn::IConnectableLayer* const startLayer = data.m_Network->AddMultiplicationLayer();
- const armnn::TensorInfo& inputTensorInfo0 = input0.GetTensorInfo();
- const armnn::TensorInfo& inputTensorInfo1 = input1.GetTensorInfo();
-
bool isReshapeSupported = BroadcastTensor(input0, input1, startLayer, data);
if (!isReshapeSupported)
{
@@ -3671,9 +3673,6 @@ bool ConvertSub(const HalOperation& operation, const HalModel& model, Conversion
armnn::IConnectableLayer* const startLayer = data.m_Network->AddSubtractionLayer();
- const armnn::TensorInfo& inputTensorInfo0 = input0.GetTensorInfo();
- const armnn::TensorInfo& inputTensorInfo1 = input1.GetTensorInfo();
-
bool isReshapeSupported = BroadcastTensor(input0, input1, startLayer, data);
if (!isReshapeSupported)
{
@@ -3881,8 +3880,6 @@ bool ConvertStridedSlice(const HalOperation& operation, const HalModel& model, C
for (unsigned int i = 0; i < inputShape.GetNumDimensions(); i++)
{
int stride = descriptor.m_Stride[i];
- int start = descriptor.GetStartForAxis(inputShape, i);
- int stop = descriptor.GetStopForAxis(inputShape, i, start);
if (descriptor.m_ShrinkAxisMask & (1 << i))
{
diff --git a/ModelToINetworkConverter.cpp b/ModelToINetworkConverter.cpp
index c205a57..41716b0 100644
--- a/ModelToINetworkConverter.cpp
+++ b/ModelToINetworkConverter.cpp
@@ -11,6 +11,10 @@
#include <log/log.h>
#include <type_traits>
+#ifdef ARMNN_ANDROID_S
+#include <LegacyUtils.h>
+#endif
+
namespace armnn_driver
{
@@ -46,13 +50,18 @@ void ModelToINetworkConverter<HalPolicy>::Convert()
// map the memory pool into shared pointers
m_Data.m_MemPools.clear();
+#if !defined(ARMNN_ANDROID_S)
if (!setRunTimePoolInfosFromHidlMemories(&m_Data.m_MemPools, m_Model.pools))
+#else
+ if (!setRunTimePoolInfosFromCanonicalMemories(&m_Data.m_MemPools, uncheckedConvert(m_Model.pools)))
+#endif
{
Fail("%s: Setting of run time pool infos from Hidl Memories has failed.", __func__);
m_ConversionResult = ConversionResult::ErrorMappingPools;
return;
}
+
uint32_t totalPoolSize = 0;
for (auto&& pool : m_Model.pools)
{
diff --git a/Utils.cpp b/Utils.cpp
index 53877ba..930c2b2 100644
--- a/Utils.cpp
+++ b/Utils.cpp
@@ -65,7 +65,7 @@ void SwizzleAndroidNn4dTensorToArmNn(const armnn::TensorInfo& tensor, const void
}
}
-void* GetMemoryFromPool(DataLocation location, const std::vector<android::nn::RunTimePoolInfo>& memPools)
+void* GetMemoryFromPool(V1_0::DataLocation location, const std::vector<android::nn::RunTimePoolInfo>& memPools)
{
// find the location within the pool
assert(location.poolIndex < memPools.size());
@@ -695,7 +695,7 @@ void CommitPools(std::vector<::android::nn::RunTimePoolInfo>& memPools)
{
// Type android::nn::RunTimePoolInfo has changed between Android P & Q and Android R, where
// update() has been removed and flush() added.
-#if defined(ARMNN_ANDROID_R) // Use the new Android implementation.
+#if defined(ARMNN_ANDROID_R) || defined(ARMNN_ANDROID_S) // Use the new Android implementation.
pool.flush();
#else
pool.update();
diff --git a/Utils.hpp b/Utils.hpp
index c4d89f7..f68747b 100644
--- a/Utils.hpp
+++ b/Utils.hpp
@@ -9,6 +9,7 @@
#include <CpuExecutor.h>
#include <HalInterfaces.h>
#include <NeuralNetworks.h>
+#include <Utils.h>
#include <vector>
#include <string>
@@ -63,7 +64,7 @@ void SwizzleAndroidNn4dTensorToArmNn(const armnn::TensorInfo& tensor, const void
const armnn::PermutationVector& mappings);
/// Returns a pointer to a specific location in a pool
-void* GetMemoryFromPool(DataLocation location,
+void* GetMemoryFromPool(V1_0::DataLocation location,
const std::vector<android::nn::RunTimePoolInfo>& memPools);
/// Can throw UnsupportedOperand
diff --git a/test/1.1/Mean.cpp b/test/1.1/Mean.cpp
index 8c52d23..c9a5a6d 100644
--- a/test/1.1/Mean.cpp
+++ b/test/1.1/Mean.cpp
@@ -19,6 +19,7 @@ using namespace driverTestHelpers;
using namespace armnn_driver;
using HalPolicy = hal_1_1::HalPolicy;
+using RequestArgument = V1_0::RequestArgument;
namespace
{
@@ -61,22 +62,22 @@ void MeanTestImpl(const TestTensor& input,
android::sp<V1_0::IPreparedModel> preparedModel = PrepareModel(model, *driver);
// The request's memory pools will follow the same order as the inputs
- DataLocation inLoc = {};
- inLoc.poolIndex = 0;
- inLoc.offset = 0;
- inLoc.length = input.GetNumElements() * sizeof(float);
- RequestArgument inArg = {};
- inArg.location = inLoc;
- inArg.dimensions = input.GetDimensions();
+ V1_0::DataLocation inLoc = {};
+ inLoc.poolIndex = 0;
+ inLoc.offset = 0;
+ inLoc.length = input.GetNumElements() * sizeof(float);
+ RequestArgument inArg = {};
+ inArg.location = inLoc;
+ inArg.dimensions = input.GetDimensions();
// An additional memory pool is needed for the output
- DataLocation outLoc = {};
- outLoc.poolIndex = 1;
- outLoc.offset = 0;
- outLoc.length = expectedOutput.GetNumElements() * sizeof(float);
- RequestArgument outArg = {};
- outArg.location = outLoc;
- outArg.dimensions = expectedOutput.GetDimensions();
+ V1_0::DataLocation outLoc = {};
+ outLoc.poolIndex = 1;
+ outLoc.offset = 0;
+ outLoc.length = expectedOutput.GetNumElements() * sizeof(float);
+ RequestArgument outArg = {};
+ outArg.location = outLoc;
+ outArg.dimensions = expectedOutput.GetDimensions();
// Make the request based on the arguments
V1_0::Request request = {};
diff --git a/test/1.1/Transpose.cpp b/test/1.1/Transpose.cpp
index 9d24000..206f9b9 100644
--- a/test/1.1/Transpose.cpp
+++ b/test/1.1/Transpose.cpp
@@ -24,6 +24,7 @@ using namespace driverTestHelpers;
using namespace armnn_driver;
using HalPolicy = hal_1_1::HalPolicy;
+using RequestArgument = V1_0::RequestArgument;
namespace
{
@@ -58,22 +59,22 @@ void TransposeTestImpl(const TestTensor & inputs, int32_t perm[],
// the request's memory pools will follow the same order as
// the inputs
- DataLocation inloc = {};
- inloc.poolIndex = 0;
- inloc.offset = 0;
- inloc.length = inputs.GetNumElements() * sizeof(float);
- RequestArgument input = {};
- input.location = inloc;
- input.dimensions = inputs.GetDimensions();
+ V1_0::DataLocation inloc = {};
+ inloc.poolIndex = 0;
+ inloc.offset = 0;
+ inloc.length = inputs.GetNumElements() * sizeof(float);
+ RequestArgument input = {};
+ input.location = inloc;
+ input.dimensions = inputs.GetDimensions();
// and an additional memory pool is needed for the output
- DataLocation outloc = {};
- outloc.poolIndex = 1;
- outloc.offset = 0;
- outloc.length = expectedOutputTensor.GetNumElements() * sizeof(float);
- RequestArgument output = {};
- output.location = outloc;
- output.dimensions = expectedOutputTensor.GetDimensions();
+ V1_0::DataLocation outloc = {};
+ outloc.poolIndex = 1;
+ outloc.offset = 0;
+ outloc.length = expectedOutputTensor.GetNumElements() * sizeof(float);
+ RequestArgument output = {};
+ output.location = outloc;
+ output.dimensions = expectedOutputTensor.GetDimensions();
// make the request based on the arguments
V1_0::Request request = {};
diff --git a/test/1.2/Capabilities.cpp b/test/1.2/Capabilities.cpp
index f25723d..15ecf96 100644
--- a/test/1.2/Capabilities.cpp
+++ b/test/1.2/Capabilities.cpp
@@ -61,7 +61,7 @@ struct CapabilitiesFixture
void CheckOperandType(const V1_2::Capabilities& capabilities, V1_2::OperandType type, float execTime, float powerUsage)
{
using namespace armnn_driver::hal_1_2;
- PerformanceInfo perfInfo = android::nn::lookup(capabilities.operandPerformance, type);
+ V1_0::PerformanceInfo perfInfo = android::nn::lookup(capabilities.operandPerformance, type);
ARMNN_ASSERT(perfInfo.execTime == execTime);
ARMNN_ASSERT(perfInfo.powerUsage == powerUsage);
}
diff --git a/test/1.3/QLstm.cpp b/test/1.3/QLstm.cpp
index 2dbd8b3..27e52a6 100644
--- a/test/1.3/QLstm.cpp
+++ b/test/1.3/QLstm.cpp
@@ -32,7 +32,7 @@ namespace
template<typename T>
RequestArgument CreateRequestArgument(const std::vector<T>& value, unsigned int poolIndex)
{
- DataLocation inputInloc = {};
+ V1_0::DataLocation inputInloc = {};
inputInloc.poolIndex = poolIndex;
inputInloc.offset = 0;
inputInloc.length = value.size() * sizeof(T);
diff --git a/test/1.3/QosTests.cpp b/test/1.3/QosTests.cpp
index d51152b..9fd6688 100644
--- a/test/1.3/QosTests.cpp
+++ b/test/1.3/QosTests.cpp
@@ -105,21 +105,21 @@ BOOST_AUTO_TEST_CASE(ConcurrentExecuteWithQosPriority)
BOOST_TEST(maxRequests == preparedModelsSize);
// construct the request data
- DataLocation inloc = {};
- inloc.poolIndex = 0;
- inloc.offset = 0;
- inloc.length = 3 * sizeof(float);
- RequestArgument input = {};
- input.location = inloc;
- input.dimensions = hidl_vec<uint32_t>{};
-
- DataLocation outloc = {};
- outloc.poolIndex = 1;
- outloc.offset = 0;
- outloc.length = 1 * sizeof(float);
- RequestArgument output = {};
- output.location = outloc;
- output.dimensions = hidl_vec<uint32_t>{};
+ V1_0::DataLocation inloc = {};
+ inloc.poolIndex = 0;
+ inloc.offset = 0;
+ inloc.length = 3 * sizeof(float);
+ RequestArgument input = {};
+ input.location = inloc;
+ input.dimensions = hidl_vec<uint32_t>{};
+
+ V1_0::DataLocation outloc = {};
+ outloc.poolIndex = 1;
+ outloc.offset = 0;
+ outloc.length = 1 * sizeof(float);
+ RequestArgument output = {};
+ output.location = outloc;
+ output.dimensions = hidl_vec<uint32_t>{};
// build the requests
V1_0::Request requests[maxRequests];
diff --git a/test/Android.mk b/test/Android.mk
index 2b87a41..1da26e4 100644
--- a/test/Android.mk
+++ b/test/Android.mk
@@ -8,12 +8,16 @@ LOCAL_PATH := $(call my-dir)
# Configure these paths if you move the source or Khronos headers
#
OPENCL_HEADER_PATH := $(LOCAL_PATH)/../../mali/product/khronos/original
-NN_HEADER_PATH := $(LOCAL_PATH)/../../../../frameworks/ml/nn/runtime/include
ARMNN_HEADER_PATH := $(LOCAL_PATH)/../armnn/include
ARMNN_THIRD_PARTY_PATH := $(LOCAL_PATH)/../armnn/third-party
ARMNN_UTILS_HEADER_PATH := $(LOCAL_PATH)/../armnn/src/armnnUtils
ARMNN_DRIVER_HEADER_PATH := $(LOCAL_PATH)/..
+NN_HEADER_PATH := $(LOCAL_PATH)/../../../../frameworks/ml/nn/runtime/include
+ifeq ($(S_OR_LATER),1)
+NN_HEADER_PATH := $(LOCAL_PATH)/../../../../packages/modules/NeuralNetworks/runtime/include
+endif
+
##########################
# armnn-driver-tests@1.0 #
##########################
@@ -47,11 +51,16 @@ LOCAL_CFLAGS := \
-UNDEBUG
# Required to build with the changes made to the Android ML framework specific to Android R
-ifeq ($(R_OR_LATER),1)
+ifeq ($(ANDROID_R),1)
LOCAL_CFLAGS+= \
-DARMNN_ANDROID_R
endif # R or later
+ifeq ($(ANDROID_S),1)
+LOCAL_CFLAGS+= \
+ -DARMNN_ANDROID_S
+endif # S or later
+
ifeq ($(Q_OR_LATER),1)
LOCAL_CFLAGS += \
-DBOOST_NO_AUTO_PTR
@@ -159,11 +168,16 @@ LOCAL_CFLAGS := \
-DARMNN_ANDROID_NN_V1_1
# Required to build with the changes made to the Android ML framework specific to Android R
-ifeq ($(R_OR_LATER),1)
+ifeq ($(ANDROID_R),1)
LOCAL_CFLAGS+= \
-DARMNN_ANDROID_R
endif # R or later
+ifeq ($(ANDROID_S),1)
+LOCAL_CFLAGS+= \
+ -DARMNN_ANDROID_S
+endif # S or later
+
ifeq ($(Q_OR_LATER),1)
LOCAL_CFLAGS += \
-DBOOST_NO_AUTO_PTR
@@ -267,11 +281,16 @@ LOCAL_CFLAGS := \
-DARMNN_ANDROID_NN_V1_2
# Required to build with the changes made to the Android ML framework specific to Android R
-ifeq ($(R_OR_LATER),1)
+ifeq ($(ANDROID_R),1)
LOCAL_CFLAGS+= \
-DARMNN_ANDROID_R
endif # R or later
+ifeq ($(ANDROID_S),1)
+LOCAL_CFLAGS+= \
+ -DARMNN_ANDROID_S
+endif # S or later
+
LOCAL_SRC_FILES := \
1.0/Convolution2D.cpp \
1.1/Convolution2D.cpp \
@@ -366,9 +385,18 @@ LOCAL_CFLAGS := \
-O0 \
-UNDEBUG \
-DBOOST_NO_AUTO_PTR \
- -DARMNN_ANDROID_R \
-DARMNN_ANDROID_NN_V1_3
+ifeq ($(ANDROID_R),1)
+LOCAL_CFLAGS+= \
+ -DARMNN_ANDROID_R
+endif
+
+ifeq ($(ANDROID_S),1)
+LOCAL_CFLAGS+= \
+ -DARMNN_ANDROID_S
+endif
+
LOCAL_SRC_FILES := \
1.0/Convolution2D.cpp \
1.1/Convolution2D.cpp \
diff --git a/test/Concat.cpp b/test/Concat.cpp
index 0bc5424..54ee8a2 100644
--- a/test/Concat.cpp
+++ b/test/Concat.cpp
@@ -21,6 +21,7 @@ using namespace driverTestHelpers;
using namespace armnn_driver;
using HalPolicy = hal_1_0::HalPolicy;
+using RequestArgument = V1_0::RequestArgument;
namespace
{
@@ -89,7 +90,7 @@ ConcatTestImpl(const std::vector<const TestTensor*> & inputs,
// the inputs
for (uint32_t i = 0; i<inputs.size(); ++i)
{
- DataLocation inloc = {};
+ V1_0::DataLocation inloc = {};
inloc.poolIndex = i;
inloc.offset = 0;
inloc.length = inputs[i]->GetNumElements() * sizeof(float);
@@ -101,7 +102,7 @@ ConcatTestImpl(const std::vector<const TestTensor*> & inputs,
// and an additional memory pool is needed for the output
{
- DataLocation outloc = {};
+ V1_0::DataLocation outloc = {};
outloc.poolIndex = inputs.size();
outloc.offset = 0;
outloc.length = expectedOutputTensor.GetNumElements() * sizeof(float);
diff --git a/test/Concurrent.cpp b/test/Concurrent.cpp
index aeea17f..50ba0e9 100644
--- a/test/Concurrent.cpp
+++ b/test/Concurrent.cpp
@@ -15,6 +15,7 @@ BOOST_AUTO_TEST_SUITE(ConcurrentDriverTests)
using ArmnnDriver = armnn_driver::ArmnnDriver;
using DriverOptions = armnn_driver::DriverOptions;
using HalPolicy = armnn_driver::hal_1_0::HalPolicy;
+using RequestArgument = V1_0::RequestArgument;
using namespace android::nn;
using namespace android::hardware;
@@ -66,21 +67,21 @@ BOOST_AUTO_TEST_CASE(ConcurrentExecute)
BOOST_TEST(maxRequests == preparedModelsSize);
// construct the request data
- DataLocation inloc = {};
- inloc.poolIndex = 0;
- inloc.offset = 0;
- inloc.length = 3 * sizeof(float);
- RequestArgument input = {};
- input.location = inloc;
- input.dimensions = hidl_vec<uint32_t>{};
-
- DataLocation outloc = {};
- outloc.poolIndex = 1;
- outloc.offset = 0;
- outloc.length = 1 * sizeof(float);
- RequestArgument output = {};
- output.location = outloc;
- output.dimensions = hidl_vec<uint32_t>{};
+ V1_0::DataLocation inloc = {};
+ inloc.poolIndex = 0;
+ inloc.offset = 0;
+ inloc.length = 3 * sizeof(float);
+ RequestArgument input = {};
+ input.location = inloc;
+ input.dimensions = hidl_vec<uint32_t>{};
+
+ V1_0::DataLocation outloc = {};
+ outloc.poolIndex = 1;
+ outloc.offset = 0;
+ outloc.length = 1 * sizeof(float);
+ RequestArgument output = {};
+ output.location = outloc;
+ output.dimensions = hidl_vec<uint32_t>{};
// build the requests
V1_0::Request requests[maxRequests];
diff --git a/test/Convolution2D.hpp b/test/Convolution2D.hpp
index c471fbd..c3f9d48 100644
--- a/test/Convolution2D.hpp
+++ b/test/Convolution2D.hpp
@@ -18,6 +18,8 @@ using namespace android::hardware;
using namespace driverTestHelpers;
using namespace armnn_driver;
+using RequestArgument = V1_0::RequestArgument;
+
namespace driverTestHelpers
{
#define ARMNN_ANDROID_FP16_TEST(result, fp16Expectation, fp32Expectation, fp16Enabled) \
@@ -75,21 +77,21 @@ void PaddingTestImpl(android::nn::PaddingScheme paddingScheme, bool fp16Enabled
android::sp<V1_0::IPreparedModel> preparedModel = PrepareModel(model, *driver);
// construct the request
- DataLocation inloc = {};
- inloc.poolIndex = 0;
- inloc.offset = 0;
- inloc.length = 6 * sizeof(float);
- RequestArgument input = {};
- input.location = inloc;
- input.dimensions = hidl_vec<uint32_t>{};
-
- DataLocation outloc = {};
- outloc.poolIndex = 1;
- outloc.offset = 0;
- outloc.length = outSize * sizeof(float);
- RequestArgument output = {};
- output.location = outloc;
- output.dimensions = hidl_vec<uint32_t>{};
+ V1_0::DataLocation inloc = {};
+ inloc.poolIndex = 0;
+ inloc.offset = 0;
+ inloc.length = 6 * sizeof(float);
+ RequestArgument input = {};
+ input.location = inloc;
+ input.dimensions = hidl_vec<uint32_t>{};
+
+ V1_0::DataLocation outloc = {};
+ outloc.poolIndex = 1;
+ outloc.offset = 0;
+ outloc.length = outSize * sizeof(float);
+ RequestArgument output = {};
+ output.location = outloc;
+ output.dimensions = hidl_vec<uint32_t>{};
V1_0::Request request = {};
request.inputs = hidl_vec<RequestArgument>{input};
diff --git a/test/DriverTestHelpers.hpp b/test/DriverTestHelpers.hpp
index 05b7892..d37fbf2 100644
--- a/test/DriverTestHelpers.hpp
+++ b/test/DriverTestHelpers.hpp
@@ -14,8 +14,11 @@
#include <android/hidl/allocator/1.0/IAllocator.h>
+using RequestArgument = V1_0::RequestArgument;
using ::android::hidl::allocator::V1_0::IAllocator;
+using ::android::hidl::memory::V1_0::IMemory;
+
namespace android
{
namespace hardware
@@ -202,7 +205,7 @@ void AddBoolOperand(HalModel& model, bool value, uint32_t numberOfConsumers = 1)
using HalOperandType = typename HalPolicy::OperandType;
using HalOperandLifeTime = typename HalPolicy::OperandLifeTime;
- DataLocation location = {};
+ V1_0::DataLocation location = {};
location.offset = model.operandValues.size();
location.length = sizeof(uint8_t);
@@ -420,7 +423,7 @@ void AddTensorOperand(HalModel& model,
totalElements *= dim;
}
- DataLocation location = {};
+ V1_0::DataLocation location = {};
location.length = totalElements * sizeof(T);
if(operandLifeTime == HalOperandLifeTime::CONSTANT_COPY)
@@ -477,7 +480,7 @@ void AddIntOperand(HalModel& model, int32_t value, uint32_t numberOfConsumers =
using HalOperandType = typename HalPolicy::OperandType;
using HalOperandLifeTime = typename HalPolicy::OperandLifeTime;
- DataLocation location = {};
+ V1_0::DataLocation location = {};
location.offset = model.operandValues.size();
location.length = sizeof(int32_t);
@@ -503,7 +506,7 @@ void AddFloatOperand(HalModel& model,
using HalOperandType = typename HalPolicy::OperandType;
using HalOperandLifeTime = typename HalPolicy::OperandLifeTime;
- DataLocation location = {};
+ V1_0::DataLocation location = {};
location.offset = model.operandValues.size();
location.length = sizeof(float);
diff --git a/test/FullyConnected.cpp b/test/FullyConnected.cpp
index 2f9cd4b..8550c8d 100644
--- a/test/FullyConnected.cpp
+++ b/test/FullyConnected.cpp
@@ -48,7 +48,7 @@ BOOST_AUTO_TEST_CASE(FullyConnected)
android::sp<V1_0::IPreparedModel> preparedModel = PrepareModel(model, *driver);
// construct the request
- DataLocation inloc = {};
+ V1_0::DataLocation inloc = {};
inloc.poolIndex = 0;
inloc.offset = 0;
inloc.length = 3 * sizeof(float);
@@ -56,7 +56,7 @@ BOOST_AUTO_TEST_CASE(FullyConnected)
input.location = inloc;
input.dimensions = hidl_vec<uint32_t>{};
- DataLocation outloc = {};
+ V1_0::DataLocation outloc = {};
outloc.poolIndex = 1;
outloc.offset = 0;
outloc.length = 1 * sizeof(float);
@@ -130,21 +130,21 @@ BOOST_AUTO_TEST_CASE(TestFullyConnected4dInput)
android::sp<V1_0::IPreparedModel> preparedModel = PrepareModel(model, *driver);
// construct the request
- DataLocation inloc = {};
- inloc.poolIndex = 0;
- inloc.offset = 0;
- inloc.length = 8 * sizeof(float);
- RequestArgument input = {};
- input.location = inloc;
- input.dimensions = hidl_vec<uint32_t>{};
-
- DataLocation outloc = {};
- outloc.poolIndex = 1;
- outloc.offset = 0;
- outloc.length = 8 * sizeof(float);
- RequestArgument output = {};
- output.location = outloc;
- output.dimensions = hidl_vec<uint32_t>{};
+ V1_0::DataLocation inloc = {};
+ inloc.poolIndex = 0;
+ inloc.offset = 0;
+ inloc.length = 8 * sizeof(float);
+ RequestArgument input = {};
+ input.location = inloc;
+ input.dimensions = hidl_vec<uint32_t>{};
+
+ V1_0::DataLocation outloc = {};
+ outloc.poolIndex = 1;
+ outloc.offset = 0;
+ outloc.length = 8 * sizeof(float);
+ RequestArgument output = {};
+ output.location = outloc;
+ output.dimensions = hidl_vec<uint32_t>{};
V1_0::Request request = {};
request.inputs = hidl_vec<RequestArgument>{input};
@@ -219,21 +219,21 @@ BOOST_AUTO_TEST_CASE(TestFullyConnected4dInputReshape)
android::sp<V1_0::IPreparedModel> preparedModel = PrepareModel(model, *driver);
// construct the request
- DataLocation inloc = {};
- inloc.poolIndex = 0;
- inloc.offset = 0;
- inloc.length = 8 * sizeof(float);
- RequestArgument input = {};
- input.location = inloc;
- input.dimensions = hidl_vec<uint32_t>{};
-
- DataLocation outloc = {};
- outloc.poolIndex = 1;
- outloc.offset = 0;
- outloc.length = 8 * sizeof(float);
- RequestArgument output = {};
- output.location = outloc;
- output.dimensions = hidl_vec<uint32_t>{};
+ V1_0::DataLocation inloc = {};
+ inloc.poolIndex = 0;
+ inloc.offset = 0;
+ inloc.length = 8 * sizeof(float);
+ RequestArgument input = {};
+ input.location = inloc;
+ input.dimensions = hidl_vec<uint32_t>{};
+
+ V1_0::DataLocation outloc = {};
+ outloc.poolIndex = 1;
+ outloc.offset = 0;
+ outloc.length = 8 * sizeof(float);
+ RequestArgument output = {};
+ output.location = outloc;
+ output.dimensions = hidl_vec<uint32_t>{};
V1_0::Request request = {};
request.inputs = hidl_vec<RequestArgument>{input};
diff --git a/test/Lstm.hpp b/test/Lstm.hpp
index 21056c3..2cb3c26 100644
--- a/test/Lstm.hpp
+++ b/test/Lstm.hpp
@@ -15,6 +15,11 @@
using ArmnnDriver = armnn_driver::ArmnnDriver;
using DriverOptions = armnn_driver::DriverOptions;
+using RequestArgument = V1_0::RequestArgument;
+
+#ifdef ARMNN_ANDROID_S
+#include <nnapi/Types.h>
+#endif
using namespace driverTestHelpers;
using namespace android::hardware;
@@ -25,7 +30,7 @@ namespace
template<typename T>
RequestArgument CreateRequestArgument(const std::vector<T>& value, unsigned int poolIndex)
{
- DataLocation inputInloc = {};
+ V1_0::DataLocation inputInloc = {};
inputInloc.poolIndex = poolIndex;
inputInloc.offset = 0;
inputInloc.length = value.size() * sizeof(T);
diff --git a/test/Tests.cpp b/test/Tests.cpp
index 3b629a7..0ef142d 100644
--- a/test/Tests.cpp
+++ b/test/Tests.cpp
@@ -20,9 +20,9 @@ BOOST_AUTO_TEST_CASE(Init)
// Making the driver object on the stack causes a weird libc error, so make it on the heap instead
auto driver = std::make_unique<ArmnnDriver>(DriverOptions(armnn::Compute::CpuRef));
- DeviceStatus status = driver->getStatus();
+ V1_0::DeviceStatus status = driver->getStatus();
// Note double-parentheses to avoid compile error from Boost trying to printf the DeviceStatus
- BOOST_TEST((status == DeviceStatus::AVAILABLE));
+ BOOST_TEST((status == V1_0::DeviceStatus::AVAILABLE));
}
BOOST_AUTO_TEST_CASE(TestCapabilities)