aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-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
13 files changed, 163 insertions, 121 deletions
diff --git a/test/1.1/Mean.cpp b/test/1.1/Mean.cpp
index 8c52d23d..c9a5a6d3 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 9d240004..206f9b98 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 f25723de..15ecf968 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 2dbd8b3e..27e52a60 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 d51152b5..9fd66880 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 2b87a41d..1da26e40 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 0bc54247..54ee8a23 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 aeea17fc..50ba0e9f 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 c471fbd7..c3f9d48c 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 05b78925..d37fbf26 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 2f9cd4b2..8550c8d9 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 21056c3d..2cb3c264 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 3b629a7a..0ef142d9 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)