blob: 1d063cbce1355488c4a17e5aa8357fbc6a1da591 [file] [log] [blame]
Matteo Martincigh79250ab2018-09-04 16:28:10 +01001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
3// See LICENSE file in the project root for full license information.
4//
5
6#include "ArmnnDriverImpl.hpp"
7#include "../SystemPropertiesUtils.hpp"
8
9#include <log/log.h>
10
11using namespace std;
12using namespace android;
13using namespace android::nn;
14using namespace android::hardware;
15
16namespace
17{
18
19const char *g_Float32PerformanceExecTimeName = "ArmNN.float32Performance.execTime";
20const char *g_Float32PerformancePowerUsageName = "ArmNN.float32Performance.powerUsage";
21const char *g_Quantized8PerformanceExecTimeName = "ArmNN.quantized8Performance.execTime";
22const char *g_Quantized8PerformancePowerUsageName = "ArmNN.quantized8Performance.powerUsage";
23const char *g_RelaxedFloat32toFloat16PerformanceExecTime = "ArmNN.relaxedFloat32toFloat16Performance.execTime";
24
25} // anonymous namespace
26
27namespace armnn_driver
28{
29namespace V1_1
30{
31
32Return<void> ArmnnDriverImpl::getCapabilities_1_1(
33 const armnn::IRuntimePtr& runtime,
34 neuralnetworks::V1_1::IDevice::getCapabilities_1_1_cb cb)
35{
36 ALOGV("V1_1::ArmnnDriverImpl::getCapabilities()");
37
38 neuralnetworks::V1_1::Capabilities capabilities;
39 if (runtime)
40 {
41 capabilities.float32Performance.execTime =
42 ParseSystemProperty(g_Float32PerformanceExecTimeName, .1f);
43
44 capabilities.float32Performance.powerUsage =
45 ParseSystemProperty(g_Float32PerformancePowerUsageName, .1f);
46
47 capabilities.quantized8Performance.execTime =
48 ParseSystemProperty(g_Quantized8PerformanceExecTimeName, .1f);
49
50 capabilities.quantized8Performance.powerUsage =
51 ParseSystemProperty(g_Quantized8PerformancePowerUsageName, .1f);
52
53 capabilities.relaxedFloat32toFloat16Performance.execTime =
54 ParseSystemProperty(g_RelaxedFloat32toFloat16PerformanceExecTime, .1f);
55
56 cb(ErrorStatus::NONE, capabilities);
57 }
58 else
59 {
60 capabilities.float32Performance.execTime = 0;
61 capabilities.float32Performance.powerUsage = 0;
62 capabilities.quantized8Performance.execTime = 0;
63 capabilities.quantized8Performance.powerUsage = 0;
64 capabilities.relaxedFloat32toFloat16Performance.execTime = 0;
65
66 cb(ErrorStatus::DEVICE_UNAVAILABLE, capabilities);
67 }
68
69 return Void();
70}
71
72} // namespace armnn_driver::V1_1
73} // namespace armnn_driver