blob: c5b1778108d561d16e3bf4d3b806058b2ddefed2 [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
arovir01b0717b52018-09-05 17:03:25 +010026template<typename HalPolicy>
Matteo Martincighe48bdff2018-09-03 13:50:50 +010027class ArmnnDriverImpl
28{
29public:
arovir01b0717b52018-09-05 17:03:25 +010030 using HalModel = typename HalPolicy::Model;
31 using HalGetSupportedOperations_cb = typename HalPolicy::getSupportedOperations_cb;
Matteo Martincighe48bdff2018-09-03 13:50:50 +010032
Matteo Martincighe48bdff2018-09-03 13:50:50 +010033 static Return<void> getSupportedOperations(
34 const armnn::IRuntimePtr& runtime,
35 const DriverOptions& options,
36 const HalModel& model,
37 HalGetSupportedOperations_cb);
arovir01b0717b52018-09-05 17:03:25 +010038
Kevin Mayec1e5b82020-02-26 17:00:39 +000039 static Return<V1_0::ErrorStatus> prepareModel(
Matteo Martincighe48bdff2018-09-03 13:50:50 +010040 const armnn::IRuntimePtr& runtime,
41 const armnn::IGpuAccTunedParametersPtr& clTunedParameters,
42 const DriverOptions& options,
43 const HalModel& model,
Matthew Bentham912b3622019-05-03 15:49:14 +010044 const android::sp<V1_0::IPreparedModelCallback>& cb,
Matteo Martincighe48bdff2018-09-03 13:50:50 +010045 bool float32ToFloat16 = false);
arovir01b0717b52018-09-05 17:03:25 +010046
Matteo Martincighe48bdff2018-09-03 13:50:50 +010047 static Return<DeviceStatus> getStatus();
Mike Kellyb5fdf382019-06-11 16:35:25 +010048
Matteo Martincighe48bdff2018-09-03 13:50:50 +010049};
50
51} // namespace armnn_driver