aboutsummaryrefslogtreecommitdiff
path: root/1.0/ArmnnDriverImpl.cpp
blob: a35bb0e9437e56273aae1e028867b1897b0c32ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//
// Copyright © 2017 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//

#include "ArmnnDriverImpl.hpp"
#include "../SystemPropertiesUtils.hpp"

#include <log/log.h>

namespace
{

const char *g_Float32PerformanceExecTimeName      = "ArmNN.float32Performance.execTime";
const char *g_Float32PerformancePowerUsageName    = "ArmNN.float32Performance.powerUsage";
const char *g_Quantized8PerformanceExecTimeName   = "ArmNN.quantized8Performance.execTime";
const char *g_Quantized8PerformancePowerUsageName = "ArmNN.quantized8Performance.powerUsage";

} // anonymous namespace

namespace armnn_driver
{
namespace hal_1_0
{

Return<void> ArmnnDriverImpl::getCapabilities(const armnn::IRuntimePtr& runtime,
                                              V1_0::IDevice::getCapabilities_cb cb)
{
    ALOGV("hal_1_0::ArmnnDriverImpl::getCapabilities()");

    V1_0::Capabilities capabilities;
    if (runtime)
    {
        capabilities.float32Performance.execTime =
            ParseSystemProperty(g_Float32PerformanceExecTimeName, .1f);

        capabilities.float32Performance.powerUsage =
            ParseSystemProperty(g_Float32PerformancePowerUsageName, .1f);

        capabilities.quantized8Performance.execTime =
            ParseSystemProperty(g_Quantized8PerformanceExecTimeName, .1f);

        capabilities.quantized8Performance.powerUsage =
            ParseSystemProperty(g_Quantized8PerformancePowerUsageName, .1f);

        cb(ErrorStatus::NONE, capabilities);
    }
    else
    {
        capabilities.float32Performance.execTime      = 0;
        capabilities.float32Performance.powerUsage    = 0;
        capabilities.quantized8Performance.execTime   = 0;
        capabilities.quantized8Performance.powerUsage = 0;

        cb(ErrorStatus::DEVICE_UNAVAILABLE, capabilities);
    }

    return Void();
}

} // namespace hal_1_0
} // namespace armnn_driver