aboutsummaryrefslogtreecommitdiff
path: root/test/1.2/Capabilities.cpp
diff options
context:
space:
mode:
authorKevin May <kevin.may@arm.com>2020-02-26 17:00:39 +0000
committerDavid Monahan <david.monahan@arm.com>2020-03-03 08:40:23 +0000
commitec1e5b8d0a0eeba7eae0f1fdb5e32c72f8a8093c (patch)
treeac4e2d3194012e08241afa9c6691d52608c1a869 /test/1.2/Capabilities.cpp
parent4a9565870037150ad6ee060a3cd232d867711b60 (diff)
downloadandroid-nn-driver-ec1e5b8d0a0eeba7eae0f1fdb5e32c72f8a8093c.tar.gz
IVGCVSW-4473 Android R pre Hal 1_3 build changes
* Update ErrorStatus to V1_0::ErrorStatus * Update Request to V1_0::Request * Update OperandType to V1_2::OperandType * Add namespace android::nn::hal in ArmnnDriverImpl for R only * Add missing g_RelaxedFloat32toFloat16PerformancePowerUsageName * Add namespace V1_0 or V1_1 where necessary * Update Android.mk with R macro and android.hardware.neuralnetworks@1.3 * Remove androidnn.go * include IAllocator in DriverTestHelpers * Remove unused LOCAL_CFLAGS Signed-off-by: Kevin May <kevin.may@arm.com> Change-Id: I1787f1ed6784b3bbec017536d87d49197405e853 Signed-off-by: Kevin May <kevin.may@arm.com>
Diffstat (limited to 'test/1.2/Capabilities.cpp')
-rw-r--r--test/1.2/Capabilities.cpp82
1 files changed, 43 insertions, 39 deletions
diff --git a/test/1.2/Capabilities.cpp b/test/1.2/Capabilities.cpp
index 8a769db2..2bbd7bed 100644
--- a/test/1.2/Capabilities.cpp
+++ b/test/1.2/Capabilities.cpp
@@ -57,8 +57,9 @@ struct CapabilitiesFixture
}
};
-void CheckOperandType(const V1_2::Capabilities& capabilities, OperandType type, float execTime, float powerUsage)
+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);
BOOST_ASSERT(perfInfo.execTime == execTime);
BOOST_ASSERT(perfInfo.powerUsage == powerUsage);
@@ -71,28 +72,28 @@ BOOST_AUTO_TEST_CASE(PerformanceCapabilitiesWithRuntime)
using namespace armnn_driver::hal_1_2;
using namespace android::nn;
- auto getCapabilitiesFn = [&](ErrorStatus error, const V1_2::Capabilities& capabilities)
+ auto getCapabilitiesFn = [&](V1_0::ErrorStatus error, const V1_2::Capabilities& capabilities)
{
- CheckOperandType(capabilities, OperandType::TENSOR_FLOAT32, 2.0f, 2.1f);
- CheckOperandType(capabilities, OperandType::FLOAT32, 2.2f, 2.3f);
- CheckOperandType(capabilities, OperandType::TENSOR_FLOAT16, 2.4f, 2.5f);
- CheckOperandType(capabilities, OperandType::FLOAT16, 2.6f, 2.7f);
- CheckOperandType(capabilities, OperandType::TENSOR_QUANT8_ASYMM, 2.8f, 2.9f);
- CheckOperandType(capabilities, OperandType::TENSOR_QUANT16_SYMM, 3.0f, 3.1f);
- CheckOperandType(capabilities, OperandType::TENSOR_INT32, 3.2f, 3.3f);
- CheckOperandType(capabilities, OperandType::INT32, 3.4f, 3.5f);
- CheckOperandType(capabilities, OperandType::TENSOR_QUANT8_SYMM, 2.8f, 2.9f);
- CheckOperandType(capabilities, OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, 2.8f, 2.9f);
+ CheckOperandType(capabilities, V1_2::OperandType::TENSOR_FLOAT32, 2.0f, 2.1f);
+ CheckOperandType(capabilities, V1_2::OperandType::FLOAT32, 2.2f, 2.3f);
+ CheckOperandType(capabilities, V1_2::OperandType::TENSOR_FLOAT16, 2.4f, 2.5f);
+ CheckOperandType(capabilities, V1_2::OperandType::FLOAT16, 2.6f, 2.7f);
+ CheckOperandType(capabilities, V1_2::OperandType::TENSOR_QUANT8_ASYMM, 2.8f, 2.9f);
+ CheckOperandType(capabilities, V1_2::OperandType::TENSOR_QUANT16_SYMM, 3.0f, 3.1f);
+ CheckOperandType(capabilities, V1_2::OperandType::TENSOR_INT32, 3.2f, 3.3f);
+ CheckOperandType(capabilities, V1_2::OperandType::INT32, 3.4f, 3.5f);
+ CheckOperandType(capabilities, V1_2::OperandType::TENSOR_QUANT8_SYMM, 2.8f, 2.9f);
+ CheckOperandType(capabilities, V1_2::OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, 2.8f, 2.9f);
// Unsupported operands take FLT_MAX value
- CheckOperandType(capabilities, OperandType::UINT32, FLT_MAX, FLT_MAX);
- CheckOperandType(capabilities, OperandType::BOOL, FLT_MAX, FLT_MAX);
- CheckOperandType(capabilities, OperandType::TENSOR_QUANT16_ASYMM, FLT_MAX, FLT_MAX);
- CheckOperandType(capabilities, OperandType::TENSOR_BOOL8, FLT_MAX, FLT_MAX);
- CheckOperandType(capabilities, OperandType::OEM, FLT_MAX, FLT_MAX);
- CheckOperandType(capabilities, OperandType::TENSOR_OEM_BYTE, FLT_MAX, FLT_MAX);
-
- BOOST_ASSERT(error == ErrorStatus::NONE);
+ CheckOperandType(capabilities, V1_2::OperandType::UINT32, FLT_MAX, FLT_MAX);
+ CheckOperandType(capabilities, V1_2::OperandType::BOOL, FLT_MAX, FLT_MAX);
+ CheckOperandType(capabilities, V1_2::OperandType::TENSOR_QUANT16_ASYMM, FLT_MAX, FLT_MAX);
+ CheckOperandType(capabilities, V1_2::OperandType::TENSOR_BOOL8, FLT_MAX, FLT_MAX);
+ CheckOperandType(capabilities, V1_2::OperandType::OEM, FLT_MAX, FLT_MAX);
+ CheckOperandType(capabilities, V1_2::OperandType::TENSOR_OEM_BYTE, FLT_MAX, FLT_MAX);
+
+ BOOST_ASSERT(error == V1_0::ErrorStatus::NONE);
};
__system_property_set("Armnn.operandTypeTensorFloat32Performance.execTime", "2.0f");
@@ -129,28 +130,31 @@ BOOST_AUTO_TEST_CASE(PerformanceCapabilitiesUndefined)
float defaultValue = .1f;
- auto getCapabilitiesFn = [&](ErrorStatus error, const V1_2::Capabilities& capabilities)
+ auto getCapabilitiesFn = [&](V1_0::ErrorStatus error, const V1_2::Capabilities& capabilities)
{
- CheckOperandType(capabilities, OperandType::TENSOR_FLOAT32, defaultValue, defaultValue);
- CheckOperandType(capabilities, OperandType::FLOAT32, defaultValue, defaultValue);
- CheckOperandType(capabilities, OperandType::TENSOR_FLOAT16, defaultValue, defaultValue);
- CheckOperandType(capabilities, OperandType::FLOAT16, defaultValue, defaultValue);
- CheckOperandType(capabilities, OperandType::TENSOR_QUANT8_ASYMM, defaultValue, defaultValue);
- CheckOperandType(capabilities, OperandType::TENSOR_QUANT16_SYMM, defaultValue, defaultValue);
- CheckOperandType(capabilities, OperandType::TENSOR_INT32, defaultValue, defaultValue);
- CheckOperandType(capabilities, OperandType::INT32, defaultValue, defaultValue);
- CheckOperandType(capabilities, OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, defaultValue, defaultValue);
- CheckOperandType(capabilities, OperandType::TENSOR_QUANT8_SYMM, defaultValue, defaultValue);
+ CheckOperandType(capabilities, V1_2::OperandType::TENSOR_FLOAT32, defaultValue, defaultValue);
+ CheckOperandType(capabilities, V1_2::OperandType::FLOAT32, defaultValue, defaultValue);
+ CheckOperandType(capabilities, V1_2::OperandType::TENSOR_FLOAT16, defaultValue, defaultValue);
+ CheckOperandType(capabilities, V1_2::OperandType::FLOAT16, defaultValue, defaultValue);
+ CheckOperandType(capabilities, V1_2::OperandType::TENSOR_QUANT8_ASYMM, defaultValue, defaultValue);
+ CheckOperandType(capabilities, V1_2::OperandType::TENSOR_QUANT16_SYMM, defaultValue, defaultValue);
+ CheckOperandType(capabilities, V1_2::OperandType::TENSOR_INT32, defaultValue, defaultValue);
+ CheckOperandType(capabilities, V1_2::OperandType::INT32, defaultValue, defaultValue);
+ CheckOperandType(capabilities,
+ V1_2::OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL,
+ defaultValue,
+ defaultValue);
+ CheckOperandType(capabilities, V1_2::OperandType::TENSOR_QUANT8_SYMM, defaultValue, defaultValue);
// Unsupported operands take FLT_MAX value
- CheckOperandType(capabilities, OperandType::UINT32, FLT_MAX, FLT_MAX);
- CheckOperandType(capabilities, OperandType::BOOL, FLT_MAX, FLT_MAX);
- CheckOperandType(capabilities, OperandType::TENSOR_QUANT16_ASYMM, FLT_MAX, FLT_MAX);
- CheckOperandType(capabilities, OperandType::TENSOR_BOOL8, FLT_MAX, FLT_MAX);
- CheckOperandType(capabilities, OperandType::OEM, FLT_MAX, FLT_MAX);
- CheckOperandType(capabilities, OperandType::TENSOR_OEM_BYTE, FLT_MAX, FLT_MAX);
-
- BOOST_ASSERT(error == ErrorStatus::NONE);
+ CheckOperandType(capabilities, V1_2::OperandType::UINT32, FLT_MAX, FLT_MAX);
+ CheckOperandType(capabilities, V1_2::OperandType::BOOL, FLT_MAX, FLT_MAX);
+ CheckOperandType(capabilities, V1_2::OperandType::TENSOR_QUANT16_ASYMM, FLT_MAX, FLT_MAX);
+ CheckOperandType(capabilities, V1_2::OperandType::TENSOR_BOOL8, FLT_MAX, FLT_MAX);
+ CheckOperandType(capabilities, V1_2::OperandType::OEM, FLT_MAX, FLT_MAX);
+ CheckOperandType(capabilities, V1_2::OperandType::TENSOR_OEM_BYTE, FLT_MAX, FLT_MAX);
+
+ BOOST_ASSERT(error == V1_0::ErrorStatus::NONE);
};
armnn::IRuntime::CreationOptions options;