telsoa01 | ce3e84a | 2018-08-31 09:31:35 +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 |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 4 | // |
| 5 | |
Matteo Martincigh | e48bdff | 2018-09-03 13:50:50 +0100 | [diff] [blame] | 6 | #define LOG_TAG "ArmnnDriver" |
| 7 | |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 8 | #include "ArmnnDriverImpl.hpp" |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 9 | #include "ArmnnPreparedModel.hpp" |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 10 | |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 11 | #if defined(ARMNN_ANDROID_NN_V1_2) || defined(ARMNN_ANDROID_NN_V1_3) // Using ::android::hardware::neuralnetworks::V1_2 |
Mike Kelly | b5fdf38 | 2019-06-11 16:35:25 +0100 | [diff] [blame] | 12 | #include "ArmnnPreparedModel_1_2.hpp" |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 13 | #endif |
| 14 | |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 15 | #ifdef ARMNN_ANDROID_NN_V1_3 // Using ::android::hardware::neuralnetworks::V1_2 |
| 16 | #include "ArmnnPreparedModel_1_3.hpp" |
| 17 | #endif |
| 18 | |
| 19 | #include "Utils.hpp" |
| 20 | |
Mike Kelly | b5fdf38 | 2019-06-11 16:35:25 +0100 | [diff] [blame] | 21 | #include "ModelToINetworkConverter.hpp" |
| 22 | #include "SystemPropertiesUtils.hpp" |
Colm Donelan | 08d9a1c | 2020-09-09 17:56:55 +0100 | [diff] [blame] | 23 | |
Mike Kelly | b5fdf38 | 2019-06-11 16:35:25 +0100 | [diff] [blame] | 24 | #include <ValidateHal.h> |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 25 | #include <log/log.h> |
| 26 | |
| 27 | using namespace std; |
| 28 | using namespace android; |
| 29 | using namespace android::nn; |
| 30 | using namespace android::hardware; |
| 31 | |
| 32 | namespace |
| 33 | { |
| 34 | |
Matthew Bentham | 912b362 | 2019-05-03 15:49:14 +0100 | [diff] [blame] | 35 | void NotifyCallbackAndCheck(const sp<V1_0::IPreparedModelCallback>& callback, |
Kevin DuBois | 30c34ae | 2020-08-26 13:53:41 -0700 | [diff] [blame] | 36 | V1_0::ErrorStatus errorStatus, |
Matthew Bentham | 912b362 | 2019-05-03 15:49:14 +0100 | [diff] [blame] | 37 | const sp<V1_0::IPreparedModel>& preparedModelPtr) |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 38 | { |
| 39 | Return<void> returned = callback->notify(errorStatus, preparedModelPtr); |
| 40 | // This check is required, if the callback fails and it isn't checked it will bring down the service |
| 41 | if (!returned.isOk()) |
| 42 | { |
Matteo Martincigh | e48bdff | 2018-09-03 13:50:50 +0100 | [diff] [blame] | 43 | ALOGE("ArmnnDriverImpl::prepareModel: hidl callback failed to return properly: %s ", |
Mike Kelly | b5fdf38 | 2019-06-11 16:35:25 +0100 | [diff] [blame] | 44 | returned.description().c_str()); |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 45 | } |
| 46 | } |
| 47 | |
Kevin DuBois | 30c34ae | 2020-08-26 13:53:41 -0700 | [diff] [blame] | 48 | Return<V1_0::ErrorStatus> FailPrepareModel(V1_0::ErrorStatus error, |
Kevin May | ec1e5b8 | 2020-02-26 17:00:39 +0000 | [diff] [blame] | 49 | const string& message, |
| 50 | const sp<V1_0::IPreparedModelCallback>& callback) |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 51 | { |
Matteo Martincigh | e48bdff | 2018-09-03 13:50:50 +0100 | [diff] [blame] | 52 | ALOGW("ArmnnDriverImpl::prepareModel: %s", message.c_str()); |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 53 | NotifyCallbackAndCheck(callback, error, nullptr); |
| 54 | return error; |
| 55 | } |
| 56 | |
| 57 | } // namespace |
| 58 | |
| 59 | namespace armnn_driver |
| 60 | { |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 61 | |
arovir01 | b0717b5 | 2018-09-05 17:03:25 +0100 | [diff] [blame] | 62 | template<typename HalPolicy> |
Kevin DuBois | 30c34ae | 2020-08-26 13:53:41 -0700 | [diff] [blame] | 63 | Return<V1_0::ErrorStatus> ArmnnDriverImpl<HalPolicy>::prepareModel( |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 64 | const armnn::IRuntimePtr& runtime, |
| 65 | const armnn::IGpuAccTunedParametersPtr& clTunedParameters, |
| 66 | const DriverOptions& options, |
Matteo Martincigh | e48bdff | 2018-09-03 13:50:50 +0100 | [diff] [blame] | 67 | const HalModel& model, |
Matthew Bentham | 912b362 | 2019-05-03 15:49:14 +0100 | [diff] [blame] | 68 | const sp<V1_0::IPreparedModelCallback>& cb, |
Matteo Martincigh | e48bdff | 2018-09-03 13:50:50 +0100 | [diff] [blame] | 69 | bool float32ToFloat16) |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 70 | { |
Matteo Martincigh | e48bdff | 2018-09-03 13:50:50 +0100 | [diff] [blame] | 71 | ALOGV("ArmnnDriverImpl::prepareModel()"); |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 72 | |
| 73 | if (cb.get() == nullptr) |
| 74 | { |
Matteo Martincigh | e48bdff | 2018-09-03 13:50:50 +0100 | [diff] [blame] | 75 | ALOGW("ArmnnDriverImpl::prepareModel: Invalid callback passed to prepareModel"); |
Kevin DuBois | 30c34ae | 2020-08-26 13:53:41 -0700 | [diff] [blame] | 76 | return V1_0::ErrorStatus::INVALID_ARGUMENT; |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 77 | } |
| 78 | |
| 79 | if (!runtime) |
| 80 | { |
Kevin DuBois | 30c34ae | 2020-08-26 13:53:41 -0700 | [diff] [blame] | 81 | return FailPrepareModel(V1_0::ErrorStatus::DEVICE_UNAVAILABLE, "Device unavailable", cb); |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 82 | } |
| 83 | |
| 84 | if (!android::nn::validateModel(model)) |
| 85 | { |
Kevin DuBois | 30c34ae | 2020-08-26 13:53:41 -0700 | [diff] [blame] | 86 | return FailPrepareModel(V1_0::ErrorStatus::INVALID_ARGUMENT, "Invalid model passed as input", cb); |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 87 | } |
| 88 | |
| 89 | // Deliberately ignore any unsupported operations requested by the options - |
| 90 | // at this point we're being asked to prepare a model that we've already declared support for |
| 91 | // and the operation indices may be different to those in getSupportedOperations anyway. |
| 92 | set<unsigned int> unsupportedOperations; |
Nattapat Chaimanowong | d5fd976 | 2019-04-04 13:33:10 +0100 | [diff] [blame] | 93 | ModelToINetworkConverter<HalPolicy> modelConverter(options.GetBackends(), |
| 94 | model, |
| 95 | unsupportedOperations); |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 96 | |
| 97 | if (modelConverter.GetConversionResult() != ConversionResult::Success) |
| 98 | { |
Kevin DuBois | 30c34ae | 2020-08-26 13:53:41 -0700 | [diff] [blame] | 99 | FailPrepareModel(V1_0::ErrorStatus::GENERAL_FAILURE, "ModelToINetworkConverter failed", cb); |
| 100 | return V1_0::ErrorStatus::NONE; |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 101 | } |
| 102 | |
Matteo Martincigh | e48bdff | 2018-09-03 13:50:50 +0100 | [diff] [blame] | 103 | // Optimize the network |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 104 | armnn::IOptimizedNetworkPtr optNet(nullptr, nullptr); |
| 105 | armnn::OptimizerOptions OptOptions; |
| 106 | OptOptions.m_ReduceFp32ToFp16 = float32ToFloat16; |
| 107 | |
Mike Kelly | 7ed56dd | 2020-09-30 20:22:56 +0100 | [diff] [blame] | 108 | armnn::BackendOptions gpuAcc("GpuAcc", |
| 109 | { |
| 110 | { "FastMathEnabled", options.IsFastMathEnabled() } |
| 111 | }); |
| 112 | armnn::BackendOptions cpuAcc("CpuAcc", |
| 113 | { |
| 114 | { "FastMathEnabled", options.IsFastMathEnabled() } |
| 115 | }); |
| 116 | OptOptions.m_ModelOptions.push_back(gpuAcc); |
| 117 | OptOptions.m_ModelOptions.push_back(cpuAcc); |
| 118 | |
jimfly01 | 07dedda | 2018-10-09 12:29:41 +0100 | [diff] [blame] | 119 | std::vector<std::string> errMessages; |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 120 | try |
| 121 | { |
| 122 | optNet = armnn::Optimize(*modelConverter.GetINetwork(), |
Nattapat Chaimanowong | d5fd976 | 2019-04-04 13:33:10 +0100 | [diff] [blame] | 123 | options.GetBackends(), |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 124 | runtime->GetDeviceSpec(), |
jimfly01 | 07dedda | 2018-10-09 12:29:41 +0100 | [diff] [blame] | 125 | OptOptions, |
| 126 | errMessages); |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 127 | } |
Derek Lamberti | b9cb844 | 2019-11-28 13:34:48 +0000 | [diff] [blame] | 128 | catch (std::exception &e) |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 129 | { |
| 130 | stringstream message; |
Derek Lamberti | b9cb844 | 2019-11-28 13:34:48 +0000 | [diff] [blame] | 131 | message << "Exception (" << e.what() << ") caught from optimize."; |
Kevin DuBois | 30c34ae | 2020-08-26 13:53:41 -0700 | [diff] [blame] | 132 | FailPrepareModel(V1_0::ErrorStatus::GENERAL_FAILURE, message.str(), cb); |
| 133 | return V1_0::ErrorStatus::NONE; |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 134 | } |
| 135 | |
| 136 | // Check that the optimized network is valid. |
| 137 | if (!optNet) |
| 138 | { |
jimfly01 | 07dedda | 2018-10-09 12:29:41 +0100 | [diff] [blame] | 139 | stringstream message; |
Matteo Martincigh | 8d50f8f | 2018-10-25 15:39:33 +0100 | [diff] [blame] | 140 | message << "Invalid optimized network"; |
| 141 | for (const string& msg : errMessages) |
| 142 | { |
jimfly01 | 07dedda | 2018-10-09 12:29:41 +0100 | [diff] [blame] | 143 | message << "\n" << msg; |
| 144 | } |
Kevin DuBois | 30c34ae | 2020-08-26 13:53:41 -0700 | [diff] [blame] | 145 | FailPrepareModel(V1_0::ErrorStatus::GENERAL_FAILURE, message.str(), cb); |
| 146 | return V1_0::ErrorStatus::NONE; |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 147 | } |
| 148 | |
| 149 | // Export the optimized network graph to a dot file if an output dump directory |
| 150 | // has been specified in the drivers' arguments. |
Jim Flynn | 829ad30 | 2019-12-13 14:43:24 +0000 | [diff] [blame] | 151 | std::string dotGraphFileName = ExportNetworkGraphToDotFile(*optNet, options.GetRequestInputsAndOutputsDumpDir()); |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 152 | |
Matteo Martincigh | e48bdff | 2018-09-03 13:50:50 +0100 | [diff] [blame] | 153 | // Load it into the runtime. |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 154 | armnn::NetworkId netId = 0; |
| 155 | try |
| 156 | { |
| 157 | if (runtime->LoadNetwork(netId, move(optNet)) != armnn::Status::Success) |
| 158 | { |
Kevin DuBois | 30c34ae | 2020-08-26 13:53:41 -0700 | [diff] [blame] | 159 | return FailPrepareModel(V1_0::ErrorStatus::GENERAL_FAILURE, "Network could not be loaded", cb); |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 160 | } |
| 161 | } |
Derek Lamberti | b9cb844 | 2019-11-28 13:34:48 +0000 | [diff] [blame] | 162 | catch (std::exception& e) |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 163 | { |
| 164 | stringstream message; |
Derek Lamberti | b9cb844 | 2019-11-28 13:34:48 +0000 | [diff] [blame] | 165 | message << "Exception (" << e.what()<< ") caught from LoadNetwork."; |
Kevin DuBois | 30c34ae | 2020-08-26 13:53:41 -0700 | [diff] [blame] | 166 | FailPrepareModel(V1_0::ErrorStatus::GENERAL_FAILURE, message.str(), cb); |
| 167 | return V1_0::ErrorStatus::NONE; |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 168 | } |
| 169 | |
Jim Flynn | 829ad30 | 2019-12-13 14:43:24 +0000 | [diff] [blame] | 170 | // Now that we have a networkId for the graph rename the dump file to use it |
| 171 | // so that we can associate the graph file and the input/output tensor dump files |
| 172 | RenameGraphDotFile(dotGraphFileName, |
| 173 | options.GetRequestInputsAndOutputsDumpDir(), |
| 174 | netId); |
| 175 | |
Kevin May | d5e9465 | 2019-11-07 14:02:14 +0000 | [diff] [blame] | 176 | sp<ArmnnPreparedModel<HalPolicy>> preparedModel( |
Mike Kelly | b5fdf38 | 2019-06-11 16:35:25 +0100 | [diff] [blame] | 177 | new ArmnnPreparedModel<HalPolicy>( |
Matteo Martincigh | e48bdff | 2018-09-03 13:50:50 +0100 | [diff] [blame] | 178 | netId, |
| 179 | runtime.get(), |
| 180 | model, |
| 181 | options.GetRequestInputsAndOutputsDumpDir(), |
| 182 | options.IsGpuProfilingEnabled())); |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 183 | |
| 184 | // Run a single 'dummy' inference of the model. This means that CL kernels will get compiled (and tuned if |
| 185 | // this is enabled) before the first 'real' inference which removes the overhead of the first inference. |
Matthew Bentham | 16196e2 | 2019-04-01 17:17:58 +0100 | [diff] [blame] | 186 | if (!preparedModel->ExecuteWithDummyInputs()) |
| 187 | { |
Kevin DuBois | 30c34ae | 2020-08-26 13:53:41 -0700 | [diff] [blame] | 188 | return FailPrepareModel(V1_0::ErrorStatus::GENERAL_FAILURE, "Network could not be executed", cb); |
Matthew Bentham | 16196e2 | 2019-04-01 17:17:58 +0100 | [diff] [blame] | 189 | } |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 190 | |
| 191 | if (clTunedParameters && |
| 192 | options.GetClTunedParametersMode() == armnn::IGpuAccTunedParameters::Mode::UpdateTunedParameters) |
| 193 | { |
| 194 | // Now that we've done one inference the CL kernel parameters will have been tuned, so save the updated file. |
| 195 | try |
| 196 | { |
| 197 | clTunedParameters->Save(options.GetClTunedParametersFile().c_str()); |
| 198 | } |
Derek Lamberti | b9cb844 | 2019-11-28 13:34:48 +0000 | [diff] [blame] | 199 | catch (std::exception& error) |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 200 | { |
Matteo Martincigh | e48bdff | 2018-09-03 13:50:50 +0100 | [diff] [blame] | 201 | ALOGE("ArmnnDriverImpl::prepareModel: Failed to save CL tuned parameters file '%s': %s", |
Matteo Martincigh | 8d50f8f | 2018-10-25 15:39:33 +0100 | [diff] [blame] | 202 | options.GetClTunedParametersFile().c_str(), error.what()); |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 203 | } |
| 204 | } |
| 205 | |
Kevin DuBois | 30c34ae | 2020-08-26 13:53:41 -0700 | [diff] [blame] | 206 | NotifyCallbackAndCheck(cb, V1_0::ErrorStatus::NONE, preparedModel); |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 207 | |
Kevin DuBois | 30c34ae | 2020-08-26 13:53:41 -0700 | [diff] [blame] | 208 | return V1_0::ErrorStatus::NONE; |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 209 | } |
| 210 | |
arovir01 | b0717b5 | 2018-09-05 17:03:25 +0100 | [diff] [blame] | 211 | template<typename HalPolicy> |
Mike Kelly | b5fdf38 | 2019-06-11 16:35:25 +0100 | [diff] [blame] | 212 | Return<void> ArmnnDriverImpl<HalPolicy>::getSupportedOperations(const armnn::IRuntimePtr& runtime, |
| 213 | const DriverOptions& options, |
| 214 | const HalModel& model, |
| 215 | HalGetSupportedOperations_cb cb) |
| 216 | { |
Jim Flynn | 829ad30 | 2019-12-13 14:43:24 +0000 | [diff] [blame] | 217 | std::stringstream ss; |
| 218 | ss << "ArmnnDriverImpl::getSupportedOperations()"; |
| 219 | std::string fileName; |
| 220 | std::string timestamp; |
| 221 | if (!options.GetRequestInputsAndOutputsDumpDir().empty()) |
| 222 | { |
Colm Donelan | 08d9a1c | 2020-09-09 17:56:55 +0100 | [diff] [blame] | 223 | ss << " : " |
| 224 | << options.GetRequestInputsAndOutputsDumpDir() |
| 225 | << "/" |
| 226 | << GetFileTimestamp() |
| 227 | << "_getSupportedOperations.txt"; |
Jim Flynn | 829ad30 | 2019-12-13 14:43:24 +0000 | [diff] [blame] | 228 | } |
| 229 | ALOGV(ss.str().c_str()); |
| 230 | |
| 231 | if (!options.GetRequestInputsAndOutputsDumpDir().empty()) |
| 232 | { |
| 233 | //dump the marker file |
| 234 | std::ofstream fileStream; |
| 235 | fileStream.open(fileName, std::ofstream::out | std::ofstream::trunc); |
| 236 | if (fileStream.good()) |
| 237 | { |
| 238 | fileStream << timestamp << std::endl; |
| 239 | } |
| 240 | fileStream.close(); |
| 241 | } |
Mike Kelly | b5fdf38 | 2019-06-11 16:35:25 +0100 | [diff] [blame] | 242 | |
| 243 | vector<bool> result; |
| 244 | |
| 245 | if (!runtime) |
| 246 | { |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 247 | cb(HalErrorStatus::DEVICE_UNAVAILABLE, result); |
Mike Kelly | b5fdf38 | 2019-06-11 16:35:25 +0100 | [diff] [blame] | 248 | return Void(); |
| 249 | } |
| 250 | |
| 251 | // Run general model validation, if this doesn't pass we shouldn't analyse the model anyway. |
| 252 | if (!android::nn::validateModel(model)) |
| 253 | { |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 254 | cb(HalErrorStatus::INVALID_ARGUMENT, result); |
Mike Kelly | b5fdf38 | 2019-06-11 16:35:25 +0100 | [diff] [blame] | 255 | return Void(); |
| 256 | } |
| 257 | |
| 258 | // Attempt to convert the model to an ArmNN input network (INetwork). |
| 259 | ModelToINetworkConverter<HalPolicy> modelConverter(options.GetBackends(), |
| 260 | model, |
| 261 | options.GetForcedUnsupportedOperations()); |
| 262 | |
| 263 | if (modelConverter.GetConversionResult() != ConversionResult::Success |
| 264 | && modelConverter.GetConversionResult() != ConversionResult::UnsupportedFeature) |
| 265 | { |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 266 | cb(HalErrorStatus::GENERAL_FAILURE, result); |
Mike Kelly | b5fdf38 | 2019-06-11 16:35:25 +0100 | [diff] [blame] | 267 | return Void(); |
| 268 | } |
| 269 | |
| 270 | // Check each operation if it was converted successfully and copy the flags |
| 271 | // into the result (vector<bool>) that we need to return to Android. |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 272 | result.reserve(getMainModel(model).operations.size()); |
| 273 | for (uint32_t operationIdx = 0; |
| 274 | operationIdx < getMainModel(model).operations.size(); |
| 275 | ++operationIdx) |
Mike Kelly | b5fdf38 | 2019-06-11 16:35:25 +0100 | [diff] [blame] | 276 | { |
| 277 | bool operationSupported = modelConverter.IsOperationSupported(operationIdx); |
| 278 | result.push_back(operationSupported); |
| 279 | } |
| 280 | |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 281 | cb(HalErrorStatus::NONE, result); |
Mike Kelly | b5fdf38 | 2019-06-11 16:35:25 +0100 | [diff] [blame] | 282 | return Void(); |
| 283 | } |
| 284 | |
| 285 | template<typename HalPolicy> |
Kevin DuBois | 30c34ae | 2020-08-26 13:53:41 -0700 | [diff] [blame] | 286 | Return<V1_0::DeviceStatus> ArmnnDriverImpl<HalPolicy>::getStatus() |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 287 | { |
Matteo Martincigh | e48bdff | 2018-09-03 13:50:50 +0100 | [diff] [blame] | 288 | ALOGV("ArmnnDriver::getStatus()"); |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 289 | |
Kevin DuBois | 30c34ae | 2020-08-26 13:53:41 -0700 | [diff] [blame] | 290 | return V1_0::DeviceStatus::AVAILABLE; |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 291 | } |
| 292 | |
arovir01 | b0717b5 | 2018-09-05 17:03:25 +0100 | [diff] [blame] | 293 | /// |
| 294 | /// Class template specializations |
| 295 | /// |
Matteo Martincigh | e48bdff | 2018-09-03 13:50:50 +0100 | [diff] [blame] | 296 | |
arovir01 | b0717b5 | 2018-09-05 17:03:25 +0100 | [diff] [blame] | 297 | template class ArmnnDriverImpl<hal_1_0::HalPolicy>; |
| 298 | |
Matteo Martincigh | 8b287c2 | 2018-09-07 09:25:10 +0100 | [diff] [blame] | 299 | #ifdef ARMNN_ANDROID_NN_V1_1 |
arovir01 | b0717b5 | 2018-09-05 17:03:25 +0100 | [diff] [blame] | 300 | template class ArmnnDriverImpl<hal_1_1::HalPolicy>; |
Matteo Martincigh | e48bdff | 2018-09-03 13:50:50 +0100 | [diff] [blame] | 301 | #endif |
| 302 | |
Mike Kelly | b5fdf38 | 2019-06-11 16:35:25 +0100 | [diff] [blame] | 303 | #ifdef ARMNN_ANDROID_NN_V1_2 |
| 304 | template class ArmnnDriverImpl<hal_1_1::HalPolicy>; |
| 305 | template class ArmnnDriverImpl<hal_1_2::HalPolicy>; |
| 306 | #endif |
| 307 | |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 308 | #ifdef ARMNN_ANDROID_NN_V1_3 |
| 309 | template class ArmnnDriverImpl<hal_1_1::HalPolicy>; |
| 310 | template class ArmnnDriverImpl<hal_1_2::HalPolicy>; |
| 311 | template class ArmnnDriverImpl<hal_1_3::HalPolicy>; |
| 312 | #endif |
| 313 | |
Matteo Martincigh | 8d50f8f | 2018-10-25 15:39:33 +0100 | [diff] [blame] | 314 | } // namespace armnn_driver |