blob: fbfbc43a33be3c72a66333df20c90c924d27dbf9 [file] [log] [blame]
Matteo Martincighe48bdff2018-09-03 13:50:50 +01001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
David Beck93e48982018-09-05 13:05:09 +01003// SPDX-License-Identifier: MIT
Matteo Martincighe48bdff2018-09-03 13:50:50 +01004//
5
6#pragma once
7
8#include <HalInterfaces.h>
9
10#include "DriverOptions.hpp"
11
12#include <armnn/ArmNN.hpp>
13
14namespace armnn_driver
15{
16
17struct HalVersion_1_0
18{
19 using Model = ::android::hardware::neuralnetworks::V1_0::Model;
Matteo Martincighe48bdff2018-09-03 13:50:50 +010020 using getSupportedOperations_cb = ::android::hardware::neuralnetworks::V1_0::IDevice::getSupportedOperations_cb;
21};
22
Matteo Martincigh79250ab2018-09-04 16:28:10 +010023#if defined(ARMNN_ANDROID_NN_V1_1) // Using ::android::hardware::neuralnetworks::V1_1.
Matteo Martincighe48bdff2018-09-03 13:50:50 +010024struct HalVersion_1_1
25{
26 using Model = ::android::hardware::neuralnetworks::V1_1::Model;
Matteo Martincighe48bdff2018-09-03 13:50:50 +010027 using getSupportedOperations_cb = ::android::hardware::neuralnetworks::V1_1::IDevice::getSupportedOperations_1_1_cb;
28};
29#endif
30
31template <typename HalVersion>
32class ArmnnDriverImpl
33{
34public:
35 using HalModel = typename HalVersion::Model;
Matteo Martincighe48bdff2018-09-03 13:50:50 +010036 using HalGetSupportedOperations_cb = typename HalVersion::getSupportedOperations_cb;
37
Matteo Martincighe48bdff2018-09-03 13:50:50 +010038 static Return<void> getSupportedOperations(
39 const armnn::IRuntimePtr& runtime,
40 const DriverOptions& options,
41 const HalModel& model,
42 HalGetSupportedOperations_cb);
43 static Return<ErrorStatus> prepareModel(
44 const armnn::IRuntimePtr& runtime,
45 const armnn::IGpuAccTunedParametersPtr& clTunedParameters,
46 const DriverOptions& options,
47 const HalModel& model,
48 const android::sp<IPreparedModelCallback>& cb,
49 bool float32ToFloat16 = false);
50 static Return<DeviceStatus> getStatus();
51};
52
53} // namespace armnn_driver