Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2020 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "ArmnnDriverImpl.hpp" |
| 7 | #include "../ArmnnPreparedModel_1_3.hpp" |
| 8 | #include "../ModelToINetworkConverter.hpp" |
| 9 | #include "../SystemPropertiesUtils.hpp" |
| 10 | |
| 11 | #include <log/log.h> |
| 12 | |
| 13 | namespace |
| 14 | { |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 15 | const char *g_RelaxedFloat32toFloat16PerformanceExecTime = "ArmNN.relaxedFloat32toFloat16Performance.execTime"; |
| 16 | const char *g_RelaxedFloat32toFloat16PerformancePowerUsage = "ArmNN.relaxedFloat32toFloat16Performance.powerUsage"; |
| 17 | |
Kevin May | 2eaa119 | 2020-04-15 16:50:57 +0100 | [diff] [blame] | 18 | const char *g_ifPerformanceExecTime = "ArmNN.ifPerformance.execTime"; |
| 19 | const char *g_ifPerformancePowerUsage = "ArmNN.ifPerformance.powerUsage"; |
| 20 | |
| 21 | const char *g_whilePerformanceExecTime = "ArmNN.whilePerformance.execTime"; |
| 22 | const char *g_whilePerformancePowerUsage = "ArmNN.whilePerformance.powerUsage"; |
| 23 | |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 24 | const char *g_OperandTypeTensorFloat32PerformanceExecTime = "Armnn.operandTypeTensorFloat32Performance.execTime"; |
| 25 | const char *g_OperandTypeTensorFloat32PerformancePowerUsage = "Armnn.operandTypeTensorFloat32Performance.powerUsage"; |
| 26 | |
| 27 | const char *g_OperandTypeFloat32PerformanceExecTime = "Armnn.operandTypeFloat32Performance.execTime"; |
| 28 | const char *g_OperandTypeFloat32PerformancePowerUsage = "Armnn.operandTypeFloat32Performance.powerUsage"; |
| 29 | |
| 30 | const char *g_OperandTypeTensorFloat16PerformanceExecTime = "Armnn.operandTypeTensorFloat16Performance.execTime"; |
| 31 | const char *g_OperandTypeTensorFloat16PerformancePowerUsage = "Armnn.operandTypeTensorFloat16Performance.powerUsage"; |
| 32 | |
| 33 | const char *g_OperandTypeFloat16PerformanceExecTime = "Armnn.operandTypeFloat16Performance.execTime"; |
| 34 | const char *g_OperandTypeFloat16PerformancePowerUsage = "Armnn.operandTypeFloat16Performance.powerUsage"; |
| 35 | |
| 36 | const char *g_OperandTypeTensorQuant8AsymmPerformanceExecTime = |
| 37 | "Armnn.operandTypeTensorQuant8AsymmPerformance.execTime"; |
| 38 | const char *g_OperandTypeTensorQuant8AsymmPerformancePowerUsage = |
| 39 | "Armnn.operandTypeTensorQuant8AsymmPerformance.powerUsage"; |
| 40 | |
| 41 | const char *g_OperandTypeTensorQuant8AsymmSignedPerformanceExecTime = |
| 42 | "Armnn.operandTypeTensorQuant8AsymmSignedPerformance.execTime"; |
| 43 | const char *g_OperandTypeTensorQuant8AsymmSignedPerformancePowerUsage = |
| 44 | "Armnn.operandTypeTensorQuant8AsymmSignedPerformance.powerUsage"; |
| 45 | |
| 46 | const char *g_OperandTypeTensorQuant16SymmPerformanceExecTime = |
| 47 | "Armnn.operandTypeTensorQuant16SymmPerformance.execTime"; |
| 48 | const char *g_OperandTypeTensorQuant16SymmPerformancePowerUsage = |
| 49 | "Armnn.operandTypeTensorQuant16SymmPerformance.powerUsage"; |
| 50 | |
| 51 | const char *g_OperandTypeTensorQuant8SymmPerformanceExecTime = |
| 52 | "Armnn.operandTypeTensorQuant8SymmPerformance.execTime"; |
| 53 | const char *g_OperandTypeTensorQuant8SymmPerformancePowerUsage = |
| 54 | "Armnn.operandTypeTensorQuant8SymmPerformance.powerUsage"; |
| 55 | |
| 56 | const char *g_OperandTypeTensorQuant8SymmPerChannelPerformanceExecTime = |
| 57 | "Armnn.operandTypeTensorQuant8SymmPerChannelPerformance.execTime"; |
| 58 | const char *g_OperandTypeTensorQuant8SymmPerChannelPerformancePowerUsage = |
| 59 | "Armnn.operandTypeTensorQuant8SymmPerChannelPerformance.powerUsage"; |
| 60 | |
| 61 | |
| 62 | const char *g_OperandTypeTensorInt32PerformanceExecTime = "Armnn.operandTypeTensorInt32Performance.execTime"; |
| 63 | const char *g_OperandTypeTensorInt32PerformancePowerUsage = "Armnn.operandTypeTensorInt32Performance.powerUsage"; |
| 64 | |
| 65 | const char *g_OperandTypeInt32PerformanceExecTime = "Armnn.operandTypeInt32Performance.execTime"; |
| 66 | const char *g_OperandTypeInt32PerformancePowerUsage = "Armnn.operandTypeInt32Performance.powerUsage"; |
| 67 | |
| 68 | |
Sadik Armagan | 188675f | 2021-02-12 17:16:42 +0000 | [diff] [blame] | 69 | void NotifyCallbackAndCheck(const android::sp<V1_3::IPreparedModelCallback>& callback, |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 70 | V1_3::ErrorStatus errorStatus, |
Sadik Armagan | 188675f | 2021-02-12 17:16:42 +0000 | [diff] [blame] | 71 | const android::sp<V1_3::IPreparedModel>& preparedModelPtr) |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 72 | { |
| 73 | Return<void> returned = callback->notify_1_3(errorStatus, preparedModelPtr); |
| 74 | // This check is required, if the callback fails and it isn't checked it will bring down the service |
| 75 | if (!returned.isOk()) |
| 76 | { |
| 77 | ALOGE("ArmnnDriverImpl::prepareModel: hidl callback failed to return properly: %s ", |
| 78 | returned.description().c_str()); |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | Return<V1_3::ErrorStatus> FailPrepareModel(V1_3::ErrorStatus error, |
| 83 | const std::string& message, |
Sadik Armagan | 188675f | 2021-02-12 17:16:42 +0000 | [diff] [blame] | 84 | const android::sp<V1_3::IPreparedModelCallback>& callback) |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 85 | { |
| 86 | ALOGW("ArmnnDriverImpl::prepareModel: %s", message.c_str()); |
| 87 | NotifyCallbackAndCheck(callback, error, nullptr); |
| 88 | return error; |
| 89 | } |
| 90 | |
| 91 | } // anonymous namespace |
| 92 | |
| 93 | namespace armnn_driver |
| 94 | { |
| 95 | namespace hal_1_3 |
| 96 | { |
| 97 | |
| 98 | Return<V1_3::ErrorStatus> ArmnnDriverImpl::prepareArmnnModel_1_3( |
| 99 | const armnn::IRuntimePtr& runtime, |
| 100 | const armnn::IGpuAccTunedParametersPtr& clTunedParameters, |
| 101 | const DriverOptions& options, |
| 102 | const V1_3::Model& model, |
Sadik Armagan | 188675f | 2021-02-12 17:16:42 +0000 | [diff] [blame] | 103 | const android::sp<V1_3::IPreparedModelCallback>& cb, |
Narumol Prangnawarat | cad4e91 | 2020-06-02 12:07:43 +0100 | [diff] [blame] | 104 | bool float32ToFloat16, |
| 105 | V1_3::Priority priority) |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 106 | { |
| 107 | ALOGV("ArmnnDriverImpl::prepareArmnnModel_1_3()"); |
| 108 | |
| 109 | if (cb.get() == nullptr) |
| 110 | { |
| 111 | ALOGW("ArmnnDriverImpl::prepareModel: Invalid callback passed to prepareModel"); |
| 112 | return V1_3::ErrorStatus::INVALID_ARGUMENT; |
| 113 | } |
| 114 | |
| 115 | if (!runtime) |
| 116 | { |
| 117 | return FailPrepareModel(V1_3::ErrorStatus::DEVICE_UNAVAILABLE, "Device unavailable", cb); |
| 118 | } |
| 119 | |
| 120 | if (!android::nn::validateModel(model)) |
| 121 | { |
| 122 | return FailPrepareModel(V1_3::ErrorStatus::INVALID_ARGUMENT, "Invalid model passed as input", cb); |
| 123 | } |
| 124 | |
| 125 | // Deliberately ignore any unsupported operations requested by the options - |
| 126 | // at this point we're being asked to prepare a model that we've already declared support for |
| 127 | // and the operation indices may be different to those in getSupportedOperations anyway. |
| 128 | std::set<unsigned int> unsupportedOperations; |
| 129 | ModelToINetworkConverter<HalPolicy> modelConverter(options.GetBackends(), |
| 130 | model, |
| 131 | unsupportedOperations); |
| 132 | |
| 133 | if (modelConverter.GetConversionResult() != ConversionResult::Success) |
| 134 | { |
| 135 | FailPrepareModel(V1_3::ErrorStatus::GENERAL_FAILURE, "ModelToINetworkConverter failed", cb); |
| 136 | return V1_3::ErrorStatus::NONE; |
| 137 | } |
| 138 | |
Sadik Armagan | b302143 | 2021-01-13 15:56:51 +0000 | [diff] [blame] | 139 | // Serialize the network graph to a .armnn file if an output directory |
| 140 | // has been specified in the drivers' arguments. |
| 141 | auto serializedNetworkFileName = |
| 142 | SerializeNetwork(*modelConverter.GetINetwork(), options.GetRequestInputsAndOutputsDumpDir()); |
| 143 | |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 144 | // Optimize the network |
| 145 | armnn::IOptimizedNetworkPtr optNet(nullptr, nullptr); |
| 146 | armnn::OptimizerOptions OptOptions; |
| 147 | OptOptions.m_ReduceFp32ToFp16 = float32ToFloat16; |
| 148 | |
Mike Kelly | 7ed56dd | 2020-09-30 20:22:56 +0100 | [diff] [blame] | 149 | armnn::BackendOptions gpuAcc("GpuAcc", |
| 150 | { |
Sadik Armagan | f36e10b | 2021-01-11 16:34:01 +0000 | [diff] [blame] | 151 | { "FastMathEnabled", options.IsFastMathEnabled() }, |
| 152 | { "SaveCachedNetwork", options.SaveCachedNetwork() }, |
Finn Williams | f5ca16c | 2021-02-12 14:26:23 +0000 | [diff] [blame^] | 153 | { "CachedNetworkFilePath", options.GetCachedNetworkFilePath() }, |
| 154 | { "MLGOTuningFilePath", options.GetClMLGOTunedParametersFile() } |
Mike Kelly | 7ed56dd | 2020-09-30 20:22:56 +0100 | [diff] [blame] | 155 | }); |
Finn Williams | f5ca16c | 2021-02-12 14:26:23 +0000 | [diff] [blame^] | 156 | |
Mike Kelly | 7ed56dd | 2020-09-30 20:22:56 +0100 | [diff] [blame] | 157 | armnn::BackendOptions cpuAcc("CpuAcc", |
| 158 | { |
Matthew Sloyan | cd639c9 | 2021-02-11 16:57:38 +0000 | [diff] [blame] | 159 | { "FastMathEnabled", options.IsFastMathEnabled() }, |
| 160 | { "NumberOfThreads", options.GetNumberOfThreads() } |
Mike Kelly | 7ed56dd | 2020-09-30 20:22:56 +0100 | [diff] [blame] | 161 | }); |
| 162 | OptOptions.m_ModelOptions.push_back(gpuAcc); |
| 163 | OptOptions.m_ModelOptions.push_back(cpuAcc); |
| 164 | |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 165 | std::vector<std::string> errMessages; |
| 166 | try |
| 167 | { |
| 168 | optNet = armnn::Optimize(*modelConverter.GetINetwork(), |
| 169 | options.GetBackends(), |
| 170 | runtime->GetDeviceSpec(), |
| 171 | OptOptions, |
| 172 | errMessages); |
| 173 | } |
| 174 | catch (std::exception& e) |
| 175 | { |
| 176 | std::stringstream message; |
| 177 | message << "Exception (" << e.what() << ") caught from optimize."; |
| 178 | FailPrepareModel(V1_3::ErrorStatus::GENERAL_FAILURE, message.str(), cb); |
| 179 | return V1_3::ErrorStatus::NONE; |
| 180 | } |
| 181 | |
| 182 | // Check that the optimized network is valid. |
| 183 | if (!optNet) |
| 184 | { |
| 185 | std::stringstream message; |
| 186 | message << "Invalid optimized network"; |
| 187 | for (const std::string& msg : errMessages) |
| 188 | { |
| 189 | message << "\n" << msg; |
| 190 | } |
| 191 | FailPrepareModel(V1_3::ErrorStatus::GENERAL_FAILURE, message.str(), cb); |
| 192 | return V1_3::ErrorStatus::NONE; |
| 193 | } |
| 194 | |
| 195 | // Export the optimized network graph to a dot file if an output dump directory |
| 196 | // has been specified in the drivers' arguments. |
| 197 | std::string dotGraphFileName = ExportNetworkGraphToDotFile(*optNet, |
| 198 | options.GetRequestInputsAndOutputsDumpDir()); |
| 199 | |
| 200 | // Load it into the runtime. |
| 201 | armnn::NetworkId netId = 0; |
| 202 | try |
| 203 | { |
| 204 | if (runtime->LoadNetwork(netId, move(optNet)) != armnn::Status::Success) |
| 205 | { |
| 206 | return FailPrepareModel(V1_3::ErrorStatus::GENERAL_FAILURE, "Network could not be loaded", cb); |
| 207 | } |
| 208 | } |
| 209 | catch (std::exception& e) |
| 210 | { |
| 211 | std::stringstream message; |
| 212 | message << "Exception (" << e.what()<< ") caught from LoadNetwork."; |
| 213 | FailPrepareModel(V1_3::ErrorStatus::GENERAL_FAILURE, message.str(), cb); |
| 214 | return V1_3::ErrorStatus::NONE; |
| 215 | } |
| 216 | |
Sadik Armagan | b302143 | 2021-01-13 15:56:51 +0000 | [diff] [blame] | 217 | // Now that we have a networkId for the graph rename the exported files to use it |
| 218 | // so that we can associate the graph file and the input/output tensor exported files |
| 219 | RenameExportedFiles(serializedNetworkFileName, |
| 220 | dotGraphFileName, |
| 221 | options.GetRequestInputsAndOutputsDumpDir(), |
| 222 | netId); |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 223 | |
| 224 | std::unique_ptr<ArmnnPreparedModel_1_3<hal_1_3::HalPolicy>> preparedModel( |
| 225 | new ArmnnPreparedModel_1_3<hal_1_3::HalPolicy>( |
| 226 | netId, |
| 227 | runtime.get(), |
| 228 | model, |
| 229 | options.GetRequestInputsAndOutputsDumpDir(), |
Narumol Prangnawarat | cad4e91 | 2020-06-02 12:07:43 +0100 | [diff] [blame] | 230 | options.IsGpuProfilingEnabled(), |
| 231 | priority)); |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 232 | |
| 233 | // Run a single 'dummy' inference of the model. This means that CL kernels will get compiled (and tuned if |
| 234 | // this is enabled) before the first 'real' inference which removes the overhead of the first inference. |
| 235 | if (!preparedModel->ExecuteWithDummyInputs()) |
| 236 | { |
| 237 | return FailPrepareModel(V1_3::ErrorStatus::GENERAL_FAILURE, "Network could not be executed", cb); |
| 238 | } |
| 239 | |
| 240 | if (clTunedParameters && |
| 241 | options.GetClTunedParametersMode() == armnn::IGpuAccTunedParameters::Mode::UpdateTunedParameters) |
| 242 | { |
| 243 | // Now that we've done one inference the CL kernel parameters will have been tuned, so save the updated file. |
| 244 | try |
| 245 | { |
| 246 | clTunedParameters->Save(options.GetClTunedParametersFile().c_str()); |
| 247 | } |
| 248 | catch (std::exception& error) |
| 249 | { |
| 250 | ALOGE("ArmnnDriverImpl::prepareModel: Failed to save CL tuned parameters file '%s': %s", |
| 251 | options.GetClTunedParametersFile().c_str(), error.what()); |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | NotifyCallbackAndCheck(cb, V1_3::ErrorStatus::NONE, preparedModel.release()); |
| 256 | |
| 257 | return V1_3::ErrorStatus::NONE; |
| 258 | } |
| 259 | |
| 260 | Return<void> ArmnnDriverImpl::getCapabilities_1_3(const armnn::IRuntimePtr& runtime, |
| 261 | V1_3::IDevice::getCapabilities_1_3_cb cb) |
| 262 | { |
| 263 | ALOGV("hal_1_3::ArmnnDriverImpl::getCapabilities()"); |
| 264 | |
| 265 | V1_3::Capabilities capabilities; |
| 266 | |
| 267 | float defaultValue = .1f; |
| 268 | |
| 269 | if (runtime) |
| 270 | { |
| 271 | capabilities.relaxedFloat32toFloat16PerformanceScalar.execTime = |
| 272 | ParseSystemProperty(g_RelaxedFloat32toFloat16PerformanceExecTime, defaultValue); |
| 273 | |
Kevin May | 2eaa119 | 2020-04-15 16:50:57 +0100 | [diff] [blame] | 274 | capabilities.relaxedFloat32toFloat16PerformanceScalar.powerUsage = |
| 275 | ParseSystemProperty(g_RelaxedFloat32toFloat16PerformancePowerUsage, defaultValue); |
| 276 | |
| 277 | capabilities.relaxedFloat32toFloat16PerformanceTensor.execTime = |
| 278 | ParseSystemProperty(g_RelaxedFloat32toFloat16PerformanceExecTime, defaultValue); |
| 279 | |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 280 | capabilities.relaxedFloat32toFloat16PerformanceTensor.powerUsage = |
| 281 | ParseSystemProperty(g_RelaxedFloat32toFloat16PerformancePowerUsage, defaultValue); |
| 282 | |
Kevin May | 2eaa119 | 2020-04-15 16:50:57 +0100 | [diff] [blame] | 283 | capabilities.ifPerformance.execTime = |
| 284 | ParseSystemProperty(g_ifPerformanceExecTime, defaultValue); |
| 285 | |
| 286 | capabilities.ifPerformance.powerUsage = |
| 287 | ParseSystemProperty(g_ifPerformancePowerUsage, defaultValue); |
| 288 | |
| 289 | capabilities.whilePerformance.execTime = |
| 290 | ParseSystemProperty(g_whilePerformanceExecTime, defaultValue); |
| 291 | |
| 292 | capabilities.whilePerformance.powerUsage = |
| 293 | ParseSystemProperty(g_whilePerformancePowerUsage, defaultValue); |
| 294 | |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 295 | // Set the base value for all operand types |
| 296 | capabilities.operandPerformance = nonExtensionOperandPerformance<HalVersion::V1_3>({FLT_MAX, FLT_MAX}); |
| 297 | |
| 298 | // Load supported operand types |
| 299 | update(&capabilities.operandPerformance, V1_3::OperandType::TENSOR_FLOAT32, |
| 300 | { |
| 301 | .execTime = ParseSystemProperty(g_OperandTypeTensorFloat32PerformanceExecTime, defaultValue), |
| 302 | .powerUsage = ParseSystemProperty(g_OperandTypeTensorFloat32PerformancePowerUsage, defaultValue) |
| 303 | }); |
| 304 | |
| 305 | update(&capabilities.operandPerformance, V1_3::OperandType::FLOAT32, |
| 306 | { |
| 307 | .execTime = ParseSystemProperty(g_OperandTypeFloat32PerformanceExecTime, defaultValue), |
| 308 | .powerUsage = ParseSystemProperty(g_OperandTypeFloat32PerformancePowerUsage, defaultValue) |
| 309 | }); |
| 310 | |
| 311 | update(&capabilities.operandPerformance, V1_3::OperandType::TENSOR_FLOAT16, |
| 312 | { |
| 313 | .execTime = ParseSystemProperty(g_OperandTypeTensorFloat16PerformanceExecTime, defaultValue), |
| 314 | .powerUsage = ParseSystemProperty(g_OperandTypeTensorFloat16PerformancePowerUsage, defaultValue) |
| 315 | }); |
| 316 | |
| 317 | update(&capabilities.operandPerformance, V1_3::OperandType::FLOAT16, |
| 318 | { |
| 319 | .execTime = ParseSystemProperty(g_OperandTypeFloat16PerformanceExecTime, defaultValue), |
| 320 | .powerUsage = ParseSystemProperty(g_OperandTypeFloat16PerformancePowerUsage, defaultValue) |
| 321 | }); |
| 322 | |
| 323 | update(&capabilities.operandPerformance, V1_3::OperandType::TENSOR_QUANT8_ASYMM, |
| 324 | { |
| 325 | .execTime = ParseSystemProperty(g_OperandTypeTensorQuant8AsymmPerformanceExecTime, defaultValue), |
| 326 | .powerUsage = ParseSystemProperty(g_OperandTypeTensorQuant8AsymmPerformancePowerUsage, defaultValue) |
| 327 | }); |
| 328 | |
| 329 | update(&capabilities.operandPerformance, V1_3::OperandType::TENSOR_QUANT8_SYMM, |
| 330 | { |
| 331 | .execTime = ParseSystemProperty(g_OperandTypeTensorQuant8SymmPerformanceExecTime, defaultValue), |
| 332 | .powerUsage = ParseSystemProperty(g_OperandTypeTensorQuant8SymmPerformancePowerUsage, defaultValue) |
| 333 | }); |
| 334 | update(&capabilities.operandPerformance, V1_3::OperandType::TENSOR_QUANT8_ASYMM_SIGNED, |
| 335 | { |
| 336 | .execTime = ParseSystemProperty(g_OperandTypeTensorQuant8AsymmSignedPerformanceExecTime, |
| 337 | defaultValue), |
| 338 | .powerUsage = ParseSystemProperty(g_OperandTypeTensorQuant8AsymmSignedPerformancePowerUsage, |
| 339 | defaultValue) |
| 340 | }); |
| 341 | |
| 342 | update(&capabilities.operandPerformance, V1_3::OperandType::TENSOR_QUANT16_SYMM, |
| 343 | { |
| 344 | .execTime = ParseSystemProperty(g_OperandTypeTensorQuant16SymmPerformanceExecTime, defaultValue), |
| 345 | .powerUsage = ParseSystemProperty(g_OperandTypeTensorQuant16SymmPerformancePowerUsage, defaultValue) |
| 346 | }); |
| 347 | |
| 348 | update(&capabilities.operandPerformance, V1_3::OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL, |
| 349 | { |
| 350 | .execTime = |
| 351 | ParseSystemProperty(g_OperandTypeTensorQuant8SymmPerChannelPerformanceExecTime, defaultValue), |
| 352 | .powerUsage = |
| 353 | ParseSystemProperty(g_OperandTypeTensorQuant8SymmPerChannelPerformancePowerUsage, defaultValue) |
| 354 | }); |
| 355 | |
| 356 | update(&capabilities.operandPerformance, V1_3::OperandType::TENSOR_INT32, |
| 357 | { |
| 358 | .execTime = ParseSystemProperty(g_OperandTypeTensorInt32PerformanceExecTime, defaultValue), |
| 359 | .powerUsage = ParseSystemProperty(g_OperandTypeTensorInt32PerformancePowerUsage, defaultValue) |
| 360 | }); |
| 361 | |
| 362 | update(&capabilities.operandPerformance, V1_3::OperandType::INT32, |
| 363 | { |
| 364 | .execTime = ParseSystemProperty(g_OperandTypeInt32PerformanceExecTime, defaultValue), |
| 365 | .powerUsage = ParseSystemProperty(g_OperandTypeInt32PerformancePowerUsage, defaultValue) |
| 366 | }); |
| 367 | |
| 368 | cb(V1_3::ErrorStatus::NONE, capabilities); |
| 369 | } |
| 370 | else |
| 371 | { |
Kevin May | 2eaa119 | 2020-04-15 16:50:57 +0100 | [diff] [blame] | 372 | capabilities.relaxedFloat32toFloat16PerformanceScalar.execTime = 0; |
| 373 | capabilities.relaxedFloat32toFloat16PerformanceScalar.powerUsage = 0; |
| 374 | capabilities.relaxedFloat32toFloat16PerformanceTensor.execTime = 0; |
| 375 | capabilities.relaxedFloat32toFloat16PerformanceTensor.powerUsage = 0; |
| 376 | capabilities.ifPerformance.execTime = 0; |
| 377 | capabilities.ifPerformance.powerUsage = 0; |
| 378 | capabilities.whilePerformance.execTime = 0; |
| 379 | capabilities.whilePerformance.powerUsage = 0; |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 380 | |
| 381 | // Set the base value for all operand types |
| 382 | capabilities.operandPerformance = nonExtensionOperandPerformance<HalVersion::V1_3>({0.f, 0.0f}); |
| 383 | |
| 384 | cb(V1_3::ErrorStatus::DEVICE_UNAVAILABLE, capabilities); |
| 385 | } |
| 386 | |
| 387 | return Void(); |
| 388 | } |
| 389 | |
| 390 | } // namespace hal_1_3 |
| 391 | } // namespace armnn_driver |