From ec1e5b8d0a0eeba7eae0f1fdb5e32c72f8a8093c Mon Sep 17 00:00:00 2001 From: Kevin May Date: Wed, 26 Feb 2020 17:00:39 +0000 Subject: 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 Change-Id: I1787f1ed6784b3bbec017536d87d49197405e853 Signed-off-by: Kevin May --- test/1.2/Capabilities.cpp | 82 +++++++++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 39 deletions(-) (limited to 'test/1.2/Capabilities.cpp') 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; -- cgit v1.2.1