Matteo Martincigh | e48bdff | 2018-09-03 13:50:50 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
David Beck | 93e4898 | 2018-09-05 13:05:09 +0100 | [diff] [blame^] | 3 | // SPDX-License-Identifier: MIT |
Matteo Martincigh | e48bdff | 2018-09-03 13:50:50 +0100 | [diff] [blame] | 4 | // |
| 5 | |
| 6 | #pragma once |
| 7 | |
| 8 | #include <HalInterfaces.h> |
| 9 | |
| 10 | #include "DriverOptions.hpp" |
| 11 | |
| 12 | #include <armnn/ArmNN.hpp> |
| 13 | |
| 14 | namespace armnn_driver |
| 15 | { |
| 16 | |
| 17 | struct HalVersion_1_0 |
| 18 | { |
| 19 | using Model = ::android::hardware::neuralnetworks::V1_0::Model; |
Matteo Martincigh | e48bdff | 2018-09-03 13:50:50 +0100 | [diff] [blame] | 20 | using getSupportedOperations_cb = ::android::hardware::neuralnetworks::V1_0::IDevice::getSupportedOperations_cb; |
| 21 | }; |
| 22 | |
Matteo Martincigh | 79250ab | 2018-09-04 16:28:10 +0100 | [diff] [blame] | 23 | #if defined(ARMNN_ANDROID_NN_V1_1) // Using ::android::hardware::neuralnetworks::V1_1. |
Matteo Martincigh | e48bdff | 2018-09-03 13:50:50 +0100 | [diff] [blame] | 24 | struct HalVersion_1_1 |
| 25 | { |
| 26 | using Model = ::android::hardware::neuralnetworks::V1_1::Model; |
Matteo Martincigh | e48bdff | 2018-09-03 13:50:50 +0100 | [diff] [blame] | 27 | using getSupportedOperations_cb = ::android::hardware::neuralnetworks::V1_1::IDevice::getSupportedOperations_1_1_cb; |
| 28 | }; |
| 29 | #endif |
| 30 | |
| 31 | template <typename HalVersion> |
| 32 | class ArmnnDriverImpl |
| 33 | { |
| 34 | public: |
| 35 | using HalModel = typename HalVersion::Model; |
Matteo Martincigh | e48bdff | 2018-09-03 13:50:50 +0100 | [diff] [blame] | 36 | using HalGetSupportedOperations_cb = typename HalVersion::getSupportedOperations_cb; |
| 37 | |
Matteo Martincigh | e48bdff | 2018-09-03 13:50:50 +0100 | [diff] [blame] | 38 | 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 |