blob: a528b96fd603f5f41b4aa72efc2a18b9ba10c2c7 [file] [log] [blame]
Matteo Martincigh79250ab2018-09-04 16:28:10 +01001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
David Beck93e48982018-09-05 13:05:09 +01003// SPDX-License-Identifier: MIT
Matteo Martincigh79250ab2018-09-04 16:28:10 +01004//
5
6#include "ArmnnDriverImpl.hpp"
Kevin DuBois30c34ae2020-08-26 13:53:41 -07007#include "NamespaceAdaptor.hpp"
Matteo Martincigh79250ab2018-09-04 16:28:10 +01008#include "../SystemPropertiesUtils.hpp"
9
10#include <log/log.h>
11
Matteo Martincigh79250ab2018-09-04 16:28:10 +010012namespace
13{
14
Kevin Mayec1e5b82020-02-26 17:00:39 +000015const char *g_Float32PerformanceExecTimeName = "ArmNN.float32Performance.execTime";
16const char *g_Float32PerformancePowerUsageName = "ArmNN.float32Performance.powerUsage";
17const char *g_Quantized8PerformanceExecTimeName = "ArmNN.quantized8Performance.execTime";
18const char *g_Quantized8PerformancePowerUsageName = "ArmNN.quantized8Performance.powerUsage";
19const char *g_RelaxedFloat32toFloat16PerformanceExecTime = "ArmNN.relaxedFloat32toFloat16Performance.execTime";
20const char *g_RelaxedFloat32toFloat16PerformancePowerUsageName = "ArmNN.relaxedFloat32toFloat16Performance.powerUsage";
Matteo Martincigh79250ab2018-09-04 16:28:10 +010021
22} // anonymous namespace
23
24namespace armnn_driver
25{
arovir01b0717b52018-09-05 17:03:25 +010026namespace hal_1_1
Matteo Martincigh79250ab2018-09-04 16:28:10 +010027{
28
arovir01b0717b52018-09-05 17:03:25 +010029Return<void> ArmnnDriverImpl::getCapabilities_1_1(const armnn::IRuntimePtr& runtime,
30 V1_1::IDevice::getCapabilities_1_1_cb cb)
Matteo Martincigh79250ab2018-09-04 16:28:10 +010031{
arovir01b0717b52018-09-05 17:03:25 +010032 ALOGV("hal_1_1::ArmnnDriverImpl::getCapabilities()");
Matteo Martincigh79250ab2018-09-04 16:28:10 +010033
arovir01b0717b52018-09-05 17:03:25 +010034 V1_1::Capabilities capabilities;
Matteo Martincigh79250ab2018-09-04 16:28:10 +010035 if (runtime)
36 {
37 capabilities.float32Performance.execTime =
38 ParseSystemProperty(g_Float32PerformanceExecTimeName, .1f);
39
40 capabilities.float32Performance.powerUsage =
41 ParseSystemProperty(g_Float32PerformancePowerUsageName, .1f);
42
43 capabilities.quantized8Performance.execTime =
44 ParseSystemProperty(g_Quantized8PerformanceExecTimeName, .1f);
45
46 capabilities.quantized8Performance.powerUsage =
47 ParseSystemProperty(g_Quantized8PerformancePowerUsageName, .1f);
48
49 capabilities.relaxedFloat32toFloat16Performance.execTime =
50 ParseSystemProperty(g_RelaxedFloat32toFloat16PerformanceExecTime, .1f);
51
Kevin Mayec1e5b82020-02-26 17:00:39 +000052 capabilities.relaxedFloat32toFloat16Performance.powerUsage =
53 ParseSystemProperty(g_RelaxedFloat32toFloat16PerformancePowerUsageName, .1f);
54
Kevin DuBois30c34ae2020-08-26 13:53:41 -070055 cb(V1_0::ErrorStatus::NONE, capabilities);
Matteo Martincigh79250ab2018-09-04 16:28:10 +010056 }
57 else
58 {
Kevin Mayec1e5b82020-02-26 17:00:39 +000059 capabilities.float32Performance.execTime = 0;
60 capabilities.float32Performance.powerUsage = 0;
61 capabilities.quantized8Performance.execTime = 0;
62 capabilities.quantized8Performance.powerUsage = 0;
63 capabilities.relaxedFloat32toFloat16Performance.execTime = 0;
64 capabilities.relaxedFloat32toFloat16Performance.powerUsage = 0;
Matteo Martincigh79250ab2018-09-04 16:28:10 +010065
Kevin DuBois30c34ae2020-08-26 13:53:41 -070066 cb(V1_0::ErrorStatus::DEVICE_UNAVAILABLE, capabilities);
Matteo Martincigh79250ab2018-09-04 16:28:10 +010067 }
68
69 return Void();
70}
71
arovir01b0717b52018-09-05 17:03:25 +010072} // namespace hal_1_1
Kevin DuBois1bb55392020-11-18 15:33:55 -080073} // namespace armnn_driver