aboutsummaryrefslogtreecommitdiff
path: root/1.2/ArmnnDriverImpl.cpp
diff options
context:
space:
mode:
authorFerran Balaguer <ferran.balaguer@arm.com>2019-07-01 13:37:44 +0100
committerFerran Balaguer <ferran.balaguer@arm.com>2019-07-01 13:53:09 +0100
commitd7c8eb93cb880e4bdc2fe721b22eeb1fa99bcf42 (patch)
treeb50ea098faa02a2e5a0600af37eab9dfe7fa43ee /1.2/ArmnnDriverImpl.cpp
parent3bb28a1615a958125b1b932f5d56332c2c053dbe (diff)
downloadandroid-nn-driver-d7c8eb93cb880e4bdc2fe721b22eeb1fa99bcf42.tar.gz
IVGCVSW-3282 Update getCapabilities_1_2
Signed-off-by: Ferran Balaguer <ferran.balaguer@arm.com> Change-Id: I65ae8669d8365bf372fbf0d1eceb48cbe06ef92a
Diffstat (limited to '1.2/ArmnnDriverImpl.cpp')
-rw-r--r--1.2/ArmnnDriverImpl.cpp93
1 files changed, 90 insertions, 3 deletions
diff --git a/1.2/ArmnnDriverImpl.cpp b/1.2/ArmnnDriverImpl.cpp
index 97cfa5de..87ef08c2 100644
--- a/1.2/ArmnnDriverImpl.cpp
+++ b/1.2/ArmnnDriverImpl.cpp
@@ -13,7 +13,37 @@
namespace
{
-const char *g_RelaxedFloat32toFloat16PerformanceExecTime = "ArmNN.relaxedFloat32toFloat16Performance.execTime";
+const char *g_RelaxedFloat32toFloat16PerformanceExecTime = "ArmNN.relaxedFloat32toFloat16Performance.execTime";
+
+const char *g_OperandTypeTensorFloat32PerformanceExecTime = "Armnn.operandTypeTensorFloat32Performance.execTime";
+const char *g_OperandTypeTensorFloat32PerformancePowerUsage = "Armnn.operandTypeTensorFloat32Performance.powerUsage";
+
+const char *g_OperandTypeFloat32PerformanceExecTime = "Armnn.operandTypeFloat32Performance.execTime";
+const char *g_OperandTypeFloat32PerformancePowerUsage = "Armnn.operandTypeFloat32Performance.powerUsage";
+
+const char *g_OperandTypeTensorFloat16PerformanceExecTime = "Armnn.operandTypeTensorFloat16Performance.execTime";
+const char *g_OperandTypeTensorFloat16PerformancePowerUsage = "Armnn.operandTypeTensorFloat16Performance.powerUsage";
+
+const char *g_OperandTypeFloat16PerformanceExecTime = "Armnn.operandTypeFloat16Performance.execTime";
+const char *g_OperandTypeFloat16PerformancePowerUsage = "Armnn.operandTypeFloat16Performance.powerUsage";
+
+const char *g_OperandTypeTensorQuant8AsymmPerformanceExecTime =
+ "Armnn.operandTypeTensorQuant8AsymmPerformance.execTime";
+const char *g_OperandTypeTensorQuant8AsymmPerformancePowerUsage =
+ "Armnn.operandTypeTensorQuant8AsymmPerformance.powerUsage";
+
+const char *g_OperandTypeTensorQuant16SymmPerformanceExecTime =
+ "Armnn.operandTypeTensorQuant16SymmPerformance.execTime";
+const char *g_OperandTypeTensorQuant16SymmPerformancePowerUsage =
+ "Armnn.operandTypeTensorQuant16SymmPerformance.powerUsage";
+
+const char *g_OperandTypeTensorInt32PerformanceExecTime = "Armnn.operandTypeTensorInt32Performance.execTime";
+const char *g_OperandTypeTensorInt32PerformancePowerUsage = "Armnn.operandTypeTensorInt32Performance.powerUsage";
+
+const char *g_OperandTypeInt32PerformanceExecTime = "Armnn.operandTypeInt32Performance.execTime";
+const char *g_OperandTypeInt32PerformancePowerUsage = "Armnn.operandTypeInt32Performance.powerUsage";
+
+
void NotifyCallbackAndCheck(const sp<V1_2::IPreparedModelCallback>& callback,
ErrorStatus errorStatus,
const sp<V1_2::IPreparedModel>& preparedModelPtr)
@@ -181,13 +211,67 @@ Return<void> ArmnnDriverImpl::getCapabilities_1_2(const armnn::IRuntimePtr& runt
V1_2::Capabilities capabilities;
+ float defaultValue = .1f;
+
if (runtime)
{
capabilities.relaxedFloat32toFloat16PerformanceScalar.execTime =
- ParseSystemProperty(g_RelaxedFloat32toFloat16PerformanceExecTime, .1f);
+ ParseSystemProperty(g_RelaxedFloat32toFloat16PerformanceExecTime, defaultValue);
capabilities.relaxedFloat32toFloat16PerformanceTensor.execTime =
- ParseSystemProperty(g_RelaxedFloat32toFloat16PerformanceExecTime, .1f);
+ ParseSystemProperty(g_RelaxedFloat32toFloat16PerformanceExecTime, defaultValue);
+
+ // Set the base value for all operand types
+ capabilities.operandPerformance = nonExtensionOperandPerformance({FLT_MAX, FLT_MAX});
+
+ // Load supported operand types
+ update(&capabilities.operandPerformance, OperandType::TENSOR_FLOAT32,
+ {
+ .execTime = ParseSystemProperty(g_OperandTypeTensorFloat32PerformanceExecTime, defaultValue),
+ .powerUsage = ParseSystemProperty(g_OperandTypeTensorFloat32PerformancePowerUsage, defaultValue)
+ });
+
+ update(&capabilities.operandPerformance, OperandType::FLOAT32,
+ {
+ .execTime = ParseSystemProperty(g_OperandTypeFloat32PerformanceExecTime, defaultValue),
+ .powerUsage = ParseSystemProperty(g_OperandTypeFloat32PerformancePowerUsage, defaultValue)
+ });
+
+ update(&capabilities.operandPerformance, OperandType::TENSOR_FLOAT16,
+ {
+ .execTime = ParseSystemProperty(g_OperandTypeTensorFloat16PerformanceExecTime, defaultValue),
+ .powerUsage = ParseSystemProperty(g_OperandTypeTensorFloat16PerformancePowerUsage, defaultValue)
+ });
+
+ update(&capabilities.operandPerformance, OperandType::FLOAT16,
+ {
+ .execTime = ParseSystemProperty(g_OperandTypeFloat16PerformanceExecTime, defaultValue),
+ .powerUsage = ParseSystemProperty(g_OperandTypeFloat16PerformancePowerUsage, defaultValue)
+ });
+
+ update(&capabilities.operandPerformance, OperandType::TENSOR_QUANT8_ASYMM,
+ {
+ .execTime = ParseSystemProperty(g_OperandTypeTensorQuant8AsymmPerformanceExecTime, defaultValue),
+ .powerUsage = ParseSystemProperty(g_OperandTypeTensorQuant8AsymmPerformancePowerUsage, defaultValue)
+ });
+
+ update(&capabilities.operandPerformance, OperandType::TENSOR_QUANT16_SYMM,
+ {
+ .execTime = ParseSystemProperty(g_OperandTypeTensorQuant16SymmPerformanceExecTime, defaultValue),
+ .powerUsage = ParseSystemProperty(g_OperandTypeTensorQuant16SymmPerformancePowerUsage, defaultValue)
+ });
+
+ update(&capabilities.operandPerformance, OperandType::TENSOR_INT32,
+ {
+ .execTime = ParseSystemProperty(g_OperandTypeTensorInt32PerformanceExecTime, defaultValue),
+ .powerUsage = ParseSystemProperty(g_OperandTypeTensorInt32PerformancePowerUsage, defaultValue)
+ });
+
+ update(&capabilities.operandPerformance, OperandType::INT32,
+ {
+ .execTime = ParseSystemProperty(g_OperandTypeInt32PerformanceExecTime, defaultValue),
+ .powerUsage = ParseSystemProperty(g_OperandTypeInt32PerformancePowerUsage, defaultValue)
+ });
cb(ErrorStatus::NONE, capabilities);
}
@@ -196,6 +280,9 @@ Return<void> ArmnnDriverImpl::getCapabilities_1_2(const armnn::IRuntimePtr& runt
capabilities.relaxedFloat32toFloat16PerformanceScalar.execTime = 0;
capabilities.relaxedFloat32toFloat16PerformanceTensor.execTime = 0;
+ // Set the base value for all operand types
+ capabilities.operandPerformance = nonExtensionOperandPerformance({0.f, 0.0f});
+
cb(ErrorStatus::DEVICE_UNAVAILABLE, capabilities);
}