aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/1.2/Lstm.cpp2
-rw-r--r--test/Concat.cpp1
-rw-r--r--test/Concurrent.cpp1
-rw-r--r--test/DriverTestHelpers.hpp88
-rw-r--r--test/GenericLayerTests.cpp28
5 files changed, 79 insertions, 41 deletions
diff --git a/test/1.2/Lstm.cpp b/test/1.2/Lstm.cpp
index 032b5373..03f7fe47 100644
--- a/test/1.2/Lstm.cpp
+++ b/test/1.2/Lstm.cpp
@@ -41,9 +41,11 @@ BOOST_DATA_TEST_CASE(LstmCifgPeepholeProjectionNoClippingLayerNormTest, COMPUTE_
LstmCifgPeepholeProjectionNoClippingLayerNorm<hal_1_2::HalPolicy>(sample);
}
+#if defined(ARMCOMPUTECL_ENABLED)
BOOST_DATA_TEST_CASE(QuantizedLstmTest, COMPUTE_DEVICES)
{
QuantizedLstm<hal_1_2::HalPolicy>(sample);
}
+#endif
BOOST_AUTO_TEST_SUITE_END()
diff --git a/test/Concat.cpp b/test/Concat.cpp
index b99e31cc..b4b650fa 100644
--- a/test/Concat.cpp
+++ b/test/Concat.cpp
@@ -128,6 +128,7 @@ ConcatTestImpl(const std::vector<const TestTensor*> & inputs,
float* outdata = static_cast<float*>(static_cast<void*>(outMemory->getPointer()));
// run the execution
+ ARMNN_ASSERT(preparedModel.get() != nullptr);
auto execStatus = Execute(preparedModel, request, expectedExecStatus);
BOOST_TEST(execStatus == expectedExecStatus);
diff --git a/test/Concurrent.cpp b/test/Concurrent.cpp
index 0694934c..aeea17fc 100644
--- a/test/Concurrent.cpp
+++ b/test/Concurrent.cpp
@@ -110,6 +110,7 @@ BOOST_AUTO_TEST_CASE(ConcurrentExecute)
ALOGI("ConcurrentExecute: waiting for callbacks");
for (size_t i = 0; i < maxRequests; ++i)
{
+ ARMNN_ASSERT(cb[i]);
cb[i]->wait();
}
diff --git a/test/DriverTestHelpers.hpp b/test/DriverTestHelpers.hpp
index 7a35b23e..66d6ac5c 100644
--- a/test/DriverTestHelpers.hpp
+++ b/test/DriverTestHelpers.hpp
@@ -142,7 +142,7 @@ void AddOperand(HalModel& model, const HalOperand& op)
}
template<typename HalPolicy, typename HalModel = typename HalPolicy::Model>
-void AddIntOperand(HalModel& model, int32_t value)
+void AddIntOperand(HalModel& model, int32_t value, uint32_t numberOfConsumers = 1)
{
using HalOperand = typename HalPolicy::Operand;
using HalOperandType = typename HalPolicy::OperandType;
@@ -152,11 +152,12 @@ void AddIntOperand(HalModel& model, int32_t value)
location.offset = model.operandValues.size();
location.length = sizeof(int32_t);
- HalOperand op = {};
- op.type = HalOperandType::INT32;
- op.dimensions = hidl_vec<uint32_t>{};
- op.lifetime = HalOperandLifeTime::CONSTANT_COPY;
- op.location = location;
+ HalOperand op = {};
+ op.type = HalOperandType::INT32;
+ op.dimensions = hidl_vec<uint32_t>{};
+ op.lifetime = HalOperandLifeTime::CONSTANT_COPY;
+ op.location = location;
+ op.numberOfConsumers = numberOfConsumers;
model.operandValues.resize(model.operandValues.size() + location.length);
*reinterpret_cast<int32_t*>(&model.operandValues[location.offset]) = value;
@@ -165,7 +166,7 @@ void AddIntOperand(HalModel& model, int32_t value)
}
template<typename HalPolicy, typename HalModel = typename HalPolicy::Model>
-void AddBoolOperand(HalModel& model, bool value)
+void AddBoolOperand(HalModel& model, bool value, uint32_t numberOfConsumers = 1)
{
using HalOperand = typename HalPolicy::Operand;
using HalOperandType = typename HalPolicy::OperandType;
@@ -175,11 +176,12 @@ void AddBoolOperand(HalModel& model, bool value)
location.offset = model.operandValues.size();
location.length = sizeof(uint8_t);
- HalOperand op = {};
- op.type = HalOperandType::BOOL;
- op.dimensions = hidl_vec<uint32_t>{};
- op.lifetime = HalOperandLifeTime::CONSTANT_COPY;
- op.location = location;
+ HalOperand op = {};
+ op.type = HalOperandType::BOOL;
+ op.dimensions = hidl_vec<uint32_t>{};
+ op.lifetime = HalOperandLifeTime::CONSTANT_COPY;
+ op.location = location;
+ op.numberOfConsumers = numberOfConsumers;
model.operandValues.resize(model.operandValues.size() + location.length);
*reinterpret_cast<uint8_t*>(&model.operandValues[location.offset]) = static_cast<uint8_t>(value);
@@ -207,7 +209,8 @@ void AddTensorOperand(HalModel& model,
HalOperandType operandType = HalOperandType::TENSOR_FLOAT32,
HalOperandLifeTime operandLifeTime = V1_0::OperandLifeTime::CONSTANT_COPY,
double scale = 0.f,
- int offset = 0)
+ int offset = 0,
+ uint32_t numberOfConsumers = 1)
{
using HalOperand = typename HalPolicy::Operand;
@@ -225,13 +228,14 @@ void AddTensorOperand(HalModel& model,
location.offset = model.operandValues.size();
}
- HalOperand op = {};
- op.type = operandType;
- op.dimensions = dimensions;
- op.scale = scale;
- op.zeroPoint = offset;
- op.lifetime = HalOperandLifeTime::CONSTANT_COPY;
- op.location = location;
+ HalOperand op = {};
+ op.type = operandType;
+ op.dimensions = dimensions;
+ op.scale = scale;
+ op.zeroPoint = offset;
+ op.lifetime = HalOperandLifeTime::CONSTANT_COPY;
+ op.location = location;
+ op.numberOfConsumers = numberOfConsumers;
model.operandValues.resize(model.operandValues.size() + location.length);
for (uint32_t i = 0; i < totalElements; i++)
@@ -253,9 +257,17 @@ void AddTensorOperand(HalModel& model,
HalOperandType operandType = HalPolicy::OperandType::TENSOR_FLOAT32,
HalOperandLifeTime operandLifeTime = V1_0::OperandLifeTime::CONSTANT_COPY,
double scale = 0.f,
- int offset = 0)
+ int offset = 0,
+ uint32_t numberOfConsumers = 1)
{
- AddTensorOperand<HalPolicy, T>(model, dimensions, values.data(), operandType, operandLifeTime, scale, offset);
+ AddTensorOperand<HalPolicy, T>(model,
+ dimensions,
+ values.data(),
+ operandType,
+ operandLifeTime,
+ scale,
+ offset,
+ numberOfConsumers);
}
template<typename HalPolicy,
@@ -265,17 +277,19 @@ void AddInputOperand(HalModel& model,
const hidl_vec<uint32_t>& dimensions,
HalOperandType operandType = HalOperandType::TENSOR_FLOAT32,
double scale = 0.f,
- int offset = 0)
+ int offset = 0,
+ uint32_t numberOfConsumers = 1)
{
using HalOperand = typename HalPolicy::Operand;
using HalOperandLifeTime = typename HalPolicy::OperandLifeTime;
- HalOperand op = {};
- op.type = operandType;
- op.scale = scale;
- op.zeroPoint = offset;
- op.dimensions = dimensions;
- op.lifetime = HalOperandLifeTime::MODEL_INPUT;
+ HalOperand op = {};
+ op.type = operandType;
+ op.scale = scale;
+ op.zeroPoint = offset;
+ op.dimensions = dimensions;
+ op.lifetime = HalOperandLifeTime::MODEL_INPUT;
+ op.numberOfConsumers = numberOfConsumers;
AddOperand<HalPolicy>(model, op);
@@ -290,17 +304,19 @@ void AddOutputOperand(HalModel& model,
const hidl_vec<uint32_t>& dimensions,
HalOperandType operandType = HalOperandType::TENSOR_FLOAT32,
double scale = 0.f,
- int offset = 0)
+ int offset = 0,
+ uint32_t numberOfConsumers = 0)
{
using HalOperand = typename HalPolicy::Operand;
using HalOperandLifeTime = typename HalPolicy::OperandLifeTime;
- HalOperand op = {};
- op.type = operandType;
- op.scale = scale;
- op.zeroPoint = offset;
- op.dimensions = dimensions;
- op.lifetime = HalOperandLifeTime::MODEL_OUTPUT;
+ HalOperand op = {};
+ op.type = operandType;
+ op.scale = scale;
+ op.zeroPoint = offset;
+ op.dimensions = dimensions;
+ op.lifetime = HalOperandLifeTime::MODEL_OUTPUT;
+ op.numberOfConsumers = numberOfConsumers;
AddOperand<HalPolicy>(model, op);
diff --git a/test/GenericLayerTests.cpp b/test/GenericLayerTests.cpp
index 961ab166..188c7b1c 100644
--- a/test/GenericLayerTests.cpp
+++ b/test/GenericLayerTests.cpp
@@ -87,9 +87,19 @@ BOOST_AUTO_TEST_CASE(GetSupportedOperations)
// Test Broadcast on add/mul operators
HalPolicy::Model model2 = {};
- AddInputOperand<HalPolicy>(model2, hidl_vec<uint32_t>{1, 1, 3, 4});
- AddInputOperand<HalPolicy>(model2, hidl_vec<uint32_t>{4});
- AddIntOperand<HalPolicy>(model2, actValue);
+ AddInputOperand<HalPolicy>(model2,
+ hidl_vec<uint32_t>{1, 1, 3, 4},
+ HalPolicy::OperandType::TENSOR_FLOAT32,
+ 0.0f,
+ 0,
+ 2);
+ AddInputOperand<HalPolicy>(model2,
+ hidl_vec<uint32_t>{4},
+ HalPolicy::OperandType::TENSOR_FLOAT32,
+ 0.0f,
+ 0,
+ 2);
+ AddIntOperand<HalPolicy>(model2, actValue, 2);
AddOutputOperand<HalPolicy>(model2, hidl_vec<uint32_t>{1, 1, 3, 4});
AddOutputOperand<HalPolicy>(model2, hidl_vec<uint32_t>{1, 1, 3, 4});
@@ -181,8 +191,16 @@ BOOST_AUTO_TEST_CASE(UnsupportedLayerContinueOnFailure)
HalPolicy::OperandType::TENSOR_INT32);
AddInputOperand<HalPolicy>(model,
hidl_vec<uint32_t>{4},
- HalPolicy::OperandType::TENSOR_INT32);
- AddInputOperand<HalPolicy>(model, hidl_vec<uint32_t>{1, 1, 3, 4});
+ HalPolicy::OperandType::TENSOR_INT32,
+ 0.0f,
+ 0,
+ 2);
+ AddInputOperand<HalPolicy>(model,
+ hidl_vec<uint32_t>{1, 1, 3, 4},
+ HalPolicy::OperandType::TENSOR_FLOAT32,
+ 0.0f,
+ 0,
+ 2);
AddOutputOperand<HalPolicy>(model, hidl_vec<uint32_t>{1, 1, 3, 4});
AddOutputOperand<HalPolicy>(model,