blob: dfaafb346f3b6f33b3b7ed4a715f0a46636cc4c8 [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
Matteo Martincighe48bdff2018-09-03 13:50:50 +01008#include "DriverOptions.hpp"
9
arovir01b0717b52018-09-05 17:03:25 +010010#include <HalInterfaces.h>
Matteo Martincighe48bdff2018-09-03 13:50:50 +010011
Kevin Mayec1e5b82020-02-26 17:00:39 +000012#ifdef ARMNN_ANDROID_R
13using namespace android::nn::hal;
14#endif
15
Matthew Bentham912b3622019-05-03 15:49:14 +010016namespace V1_0 = ::android::hardware::neuralnetworks::V1_0;
Mike Kellyb5fdf382019-06-11 16:35:25 +010017namespace V1_1 = ::android::hardware::neuralnetworks::V1_1;
18
19#ifdef ARMNN_ANDROID_NN_V1_2 // Using ::android::hardware::neuralnetworks::V1_2
20namespace V1_2 = ::android::hardware::neuralnetworks::V1_2;
21#endif
Matthew Bentham912b3622019-05-03 15:49:14 +010022
Matteo Martincighe48bdff2018-09-03 13:50:50 +010023namespace armnn_driver
24{
25
Derek Lamberti4de83c52020-03-17 13:40:18 +000026template <typename Callback, typename Context>
27struct CallbackContext
28{
29 Callback callback;
30 Context ctx;
31};
32
arovir01b0717b52018-09-05 17:03:25 +010033template<typename HalPolicy>
Matteo Martincighe48bdff2018-09-03 13:50:50 +010034class ArmnnDriverImpl
35{
36public:
arovir01b0717b52018-09-05 17:03:25 +010037 using HalModel = typename HalPolicy::Model;
38 using HalGetSupportedOperations_cb = typename HalPolicy::getSupportedOperations_cb;
Matteo Martincighe48bdff2018-09-03 13:50:50 +010039
Matteo Martincighe48bdff2018-09-03 13:50:50 +010040 static Return<void> getSupportedOperations(
41 const armnn::IRuntimePtr& runtime,
42 const DriverOptions& options,
43 const HalModel& model,
44 HalGetSupportedOperations_cb);
arovir01b0717b52018-09-05 17:03:25 +010045
Kevin Mayec1e5b82020-02-26 17:00:39 +000046 static Return<V1_0::ErrorStatus> prepareModel(
Matteo Martincighe48bdff2018-09-03 13:50:50 +010047 const armnn::IRuntimePtr& runtime,
48 const armnn::IGpuAccTunedParametersPtr& clTunedParameters,
49 const DriverOptions& options,
50 const HalModel& model,
Matthew Bentham912b3622019-05-03 15:49:14 +010051 const android::sp<V1_0::IPreparedModelCallback>& cb,
Matteo Martincighe48bdff2018-09-03 13:50:50 +010052 bool float32ToFloat16 = false);
arovir01b0717b52018-09-05 17:03:25 +010053
Matteo Martincighe48bdff2018-09-03 13:50:50 +010054 static Return<DeviceStatus> getStatus();
Mike Kellyb5fdf382019-06-11 16:35:25 +010055
Matteo Martincighe48bdff2018-09-03 13:50:50 +010056};
57
58} // namespace armnn_driver