aboutsummaryrefslogtreecommitdiff
path: root/1.2/ArmnnDriverImpl.hpp
blob: 70f46cba4d704fd45af0ee70c8e874996804cba3 (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
63
//
// Copyright © 2017 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//

#pragma once

#include <HalInterfaces.h>

#include "../CacheDataHandler.hpp"
#include "../DriverOptions.hpp"

#include <armnn/ArmNN.hpp>

#include <NeuralNetworks.h>

#ifdef ARMNN_ANDROID_R
using namespace android::nn::hal;
#endif

#ifdef ARMNN_ANDROID_S
using namespace android::hardware;
#endif

namespace V1_0 = ::android::hardware::neuralnetworks::V1_0;
namespace V1_2 = ::android::hardware::neuralnetworks::V1_2;

namespace armnn_driver
{
namespace hal_1_2
{

class ArmnnDriverImpl
{
public:
    using HidlToken = android::hardware::hidl_array<uint8_t, ANEURALNETWORKS_BYTE_SIZE_OF_CACHE_TOKEN>;

    static Return<V1_0::ErrorStatus> prepareArmnnModel_1_2(
        const armnn::IRuntimePtr& runtime,
        const armnn::IGpuAccTunedParametersPtr& clTunedParameters,
        const DriverOptions& options,
        const V1_2::Model& model,
        const android::hardware::hidl_vec<android::hardware::hidl_handle>& modelCacheHandle,
        const android::hardware::hidl_vec<android::hardware::hidl_handle>& dataCacheHandle,
        const HidlToken& token,
        const android::sp<V1_2::IPreparedModelCallback>& cb,
        bool float32ToFloat16 = false);

    static Return<V1_0::ErrorStatus> prepareModelFromCache(
        const armnn::IRuntimePtr& runtime,
        const DriverOptions& options,
        const android::hardware::hidl_vec<android::hardware::hidl_handle>& modelCacheHandle,
        const android::hardware::hidl_vec<android::hardware::hidl_handle>& dataCacheHandle,
        const HidlToken& token,
        const android::sp<V1_2::IPreparedModelCallback>& cb,
        bool float32ToFloat16 = false);

    static Return<void> getCapabilities_1_2(const armnn::IRuntimePtr& runtime,
                                            V1_2::IDevice::getCapabilities_1_2_cb cb);
};

} // namespace hal_1_2
} // namespace armnn_driver