• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include "ArmnnDriverImpl.hpp"
7 #include "../NamespaceAdaptor.hpp"
8 #include "../SystemPropertiesUtils.hpp"
9 
10 #include <log/log.h>
11 
12 namespace
13 {
14 
15 const char *g_Float32PerformanceExecTimeName      = "ArmNN.float32Performance.execTime";
16 const char *g_Float32PerformancePowerUsageName    = "ArmNN.float32Performance.powerUsage";
17 const char *g_Quantized8PerformanceExecTimeName   = "ArmNN.quantized8Performance.execTime";
18 const char *g_Quantized8PerformancePowerUsageName = "ArmNN.quantized8Performance.powerUsage";
19 
20 } // anonymous namespace
21 
22 namespace armnn_driver
23 {
24 namespace hal_1_0
25 {
26 
getCapabilities(const armnn::IRuntimePtr & runtime,V1_0::IDevice::getCapabilities_cb cb)27 Return<void> ArmnnDriverImpl::getCapabilities(const armnn::IRuntimePtr& runtime,
28                                               V1_0::IDevice::getCapabilities_cb cb)
29 {
30     ALOGV("hal_1_0::ArmnnDriverImpl::getCapabilities()");
31 
32     V1_0::Capabilities capabilities;
33     if (runtime)
34     {
35         capabilities.float32Performance.execTime =
36             ParseSystemProperty(g_Float32PerformanceExecTimeName, .1f);
37 
38         capabilities.float32Performance.powerUsage =
39             ParseSystemProperty(g_Float32PerformancePowerUsageName, .1f);
40 
41         capabilities.quantized8Performance.execTime =
42             ParseSystemProperty(g_Quantized8PerformanceExecTimeName, .1f);
43 
44         capabilities.quantized8Performance.powerUsage =
45             ParseSystemProperty(g_Quantized8PerformancePowerUsageName, .1f);
46 
47         cb(V1_0::ErrorStatus::NONE, capabilities);
48     }
49     else
50     {
51         capabilities.float32Performance.execTime      = 0;
52         capabilities.float32Performance.powerUsage    = 0;
53         capabilities.quantized8Performance.execTime   = 0;
54         capabilities.quantized8Performance.powerUsage = 0;
55 
56         cb(V1_0::ErrorStatus::DEVICE_UNAVAILABLE, capabilities);
57     }
58 
59     return Void();
60 }
61 
62 } // namespace hal_1_0
63 } // namespace armnn_driver
64