blob: 01b3ab51f5cddd8498c07a17e0f02cf142d63852 [file] [log] [blame]
Mike Kellyb5fdf382019-06-11 16:35:25 +01001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
6#include "ArmnnDriverImpl.hpp"
7#include "../ArmnnPreparedModel_1_2.hpp"
8#include "../ModelToINetworkConverter.hpp"
9#include "../SystemPropertiesUtils.hpp"
10
11#include <log/log.h>
12
13namespace
14{
15
Ferran Balaguerd7c8eb92019-07-01 13:37:44 +010016const char *g_RelaxedFloat32toFloat16PerformanceExecTime = "ArmNN.relaxedFloat32toFloat16Performance.execTime";
FinnWilliamsArmdf655ee2019-07-24 16:04:18 +010017const char *g_RelaxedFloat32toFloat16PerformancePowerUsage = "ArmNN.relaxedFloat32toFloat16Performance.powerUsage";
Ferran Balaguerd7c8eb92019-07-01 13:37:44 +010018
19const char *g_OperandTypeTensorFloat32PerformanceExecTime = "Armnn.operandTypeTensorFloat32Performance.execTime";
20const char *g_OperandTypeTensorFloat32PerformancePowerUsage = "Armnn.operandTypeTensorFloat32Performance.powerUsage";
21
22const char *g_OperandTypeFloat32PerformanceExecTime = "Armnn.operandTypeFloat32Performance.execTime";
23const char *g_OperandTypeFloat32PerformancePowerUsage = "Armnn.operandTypeFloat32Performance.powerUsage";
24
25const char *g_OperandTypeTensorFloat16PerformanceExecTime = "Armnn.operandTypeTensorFloat16Performance.execTime";
26const char *g_OperandTypeTensorFloat16PerformancePowerUsage = "Armnn.operandTypeTensorFloat16Performance.powerUsage";
27
28const char *g_OperandTypeFloat16PerformanceExecTime = "Armnn.operandTypeFloat16Performance.execTime";
29const char *g_OperandTypeFloat16PerformancePowerUsage = "Armnn.operandTypeFloat16Performance.powerUsage";
30
31const char *g_OperandTypeTensorQuant8AsymmPerformanceExecTime =
32 "Armnn.operandTypeTensorQuant8AsymmPerformance.execTime";
33const char *g_OperandTypeTensorQuant8AsymmPerformancePowerUsage =
34 "Armnn.operandTypeTensorQuant8AsymmPerformance.powerUsage";
35
36const char *g_OperandTypeTensorQuant16SymmPerformanceExecTime =
37 "Armnn.operandTypeTensorQuant16SymmPerformance.execTime";
38const char *g_OperandTypeTensorQuant16SymmPerformancePowerUsage =
39 "Armnn.operandTypeTensorQuant16SymmPerformance.powerUsage";
40
Pablo Tellofb45e2f2019-10-18 16:51:57 +010041const char *g_OperandTypeTensorQuant8SymmPerformanceExecTime =
42 "Armnn.operandTypeTensorQuant8SymmPerformance.execTime";
43const char *g_OperandTypeTensorQuant8SymmPerformancePowerUsage =
44 "Armnn.operandTypeTensorQuant8SymmPerformance.powerUsage";
45
Kevin May87cb7612019-11-11 17:30:35 +000046const char *g_OperandTypeTensorQuant8SymmPerChannelPerformanceExecTime =
47 "Armnn.operandTypeTensorQuant8SymmPerChannelPerformance.execTime";
48const char *g_OperandTypeTensorQuant8SymmPerChannelPerformancePowerUsage =
49 "Armnn.operandTypeTensorQuant8SymmPerChannelPerformance.powerUsage";
50
Pablo Tellofb45e2f2019-10-18 16:51:57 +010051
Ferran Balaguerd7c8eb92019-07-01 13:37:44 +010052const char *g_OperandTypeTensorInt32PerformanceExecTime = "Armnn.operandTypeTensorInt32Performance.execTime";
53const char *g_OperandTypeTensorInt32PerformancePowerUsage = "Armnn.operandTypeTensorInt32Performance.powerUsage";
54
55const char *g_OperandTypeInt32PerformanceExecTime = "Armnn.operandTypeInt32Performance.execTime";
56const char *g_OperandTypeInt32PerformancePowerUsage = "Armnn.operandTypeInt32Performance.powerUsage";
57
58
Sadik Armagan188675f2021-02-12 17:16:42 +000059void NotifyCallbackAndCheck(const android::sp<V1_2::IPreparedModelCallback>& callback,
Kevin Mayec1e5b82020-02-26 17:00:39 +000060 V1_0::ErrorStatus errorStatus,
Sadik Armagan188675f2021-02-12 17:16:42 +000061 const android::sp<V1_2::IPreparedModel>& preparedModelPtr)
Mike Kellyb5fdf382019-06-11 16:35:25 +010062{
Ferran Balaguerb2397fd2019-07-25 12:12:39 +010063 Return<void> returned = callback->notify_1_2(errorStatus, preparedModelPtr);
Mike Kellyb5fdf382019-06-11 16:35:25 +010064 // This check is required, if the callback fails and it isn't checked it will bring down the service
65 if (!returned.isOk())
66 {
67 ALOGE("ArmnnDriverImpl::prepareModel: hidl callback failed to return properly: %s ",
68 returned.description().c_str());
69 }
70}
71
Kevin Mayec1e5b82020-02-26 17:00:39 +000072Return<V1_0::ErrorStatus> FailPrepareModel(V1_0::ErrorStatus error,
73 const std::string& message,
Sadik Armagan188675f2021-02-12 17:16:42 +000074 const android::sp<V1_2::IPreparedModelCallback>& callback)
Mike Kellyb5fdf382019-06-11 16:35:25 +010075{
76 ALOGW("ArmnnDriverImpl::prepareModel: %s", message.c_str());
77 NotifyCallbackAndCheck(callback, error, nullptr);
78 return error;
79}
80
81} // anonymous namespace
82
83namespace armnn_driver
84{
85namespace hal_1_2
86{
87
Kevin Mayec1e5b82020-02-26 17:00:39 +000088Return<V1_0::ErrorStatus> ArmnnDriverImpl::prepareArmnnModel_1_2(
89 const armnn::IRuntimePtr& runtime,
90 const armnn::IGpuAccTunedParametersPtr& clTunedParameters,
91 const DriverOptions& options,
92 const V1_2::Model& model,
Sadik Armagan188675f2021-02-12 17:16:42 +000093 const android::sp<V1_2::IPreparedModelCallback>& cb,
Kevin Mayec1e5b82020-02-26 17:00:39 +000094 bool float32ToFloat16)
Mike Kellyb5fdf382019-06-11 16:35:25 +010095{
Matteo Martincigh0bd89a82019-07-02 16:53:10 +010096 ALOGV("ArmnnDriverImpl::prepareArmnnModel_1_2()");
Mike Kellyb5fdf382019-06-11 16:35:25 +010097
98 if (cb.get() == nullptr)
99 {
100 ALOGW("ArmnnDriverImpl::prepareModel: Invalid callback passed to prepareModel");
Kevin Mayec1e5b82020-02-26 17:00:39 +0000101 return V1_0::ErrorStatus::INVALID_ARGUMENT;
Mike Kellyb5fdf382019-06-11 16:35:25 +0100102 }
103
104 if (!runtime)
105 {
Kevin Mayec1e5b82020-02-26 17:00:39 +0000106 return FailPrepareModel(V1_0::ErrorStatus::DEVICE_UNAVAILABLE, "Device unavailable", cb);
Mike Kellyb5fdf382019-06-11 16:35:25 +0100107 }
108
109 if (!android::nn::validateModel(model))
110 {
Kevin Mayec1e5b82020-02-26 17:00:39 +0000111 return FailPrepareModel(V1_0::ErrorStatus::INVALID_ARGUMENT, "Invalid model passed as input", cb);
Mike Kellyb5fdf382019-06-11 16:35:25 +0100112 }
113
114 // Deliberately ignore any unsupported operations requested by the options -
115 // at this point we're being asked to prepare a model that we've already declared support for
116 // and the operation indices may be different to those in getSupportedOperations anyway.
117 std::set<unsigned int> unsupportedOperations;
118 ModelToINetworkConverter<HalPolicy> modelConverter(options.GetBackends(),
119 model,
120 unsupportedOperations);
121
122 if (modelConverter.GetConversionResult() != ConversionResult::Success)
123 {
Kevin Mayec1e5b82020-02-26 17:00:39 +0000124 FailPrepareModel(V1_0::ErrorStatus::GENERAL_FAILURE, "ModelToINetworkConverter failed", cb);
125 return V1_0::ErrorStatus::NONE;
Mike Kellyb5fdf382019-06-11 16:35:25 +0100126 }
127
Sadik Armaganb3021432021-01-13 15:56:51 +0000128 // Serialize the network graph to a .armnn file if an output directory
129 // has been specified in the drivers' arguments.
130 auto serializedNetworkFileName =
131 SerializeNetwork(*modelConverter.GetINetwork(), options.GetRequestInputsAndOutputsDumpDir());
132
Mike Kellyb5fdf382019-06-11 16:35:25 +0100133 // Optimize the network
134 armnn::IOptimizedNetworkPtr optNet(nullptr, nullptr);
135 armnn::OptimizerOptions OptOptions;
136 OptOptions.m_ReduceFp32ToFp16 = float32ToFloat16;
Kevin Maydaf7dd02021-10-22 11:57:30 +0100137 OptOptions.m_ProfilingEnabled = options.IsGpuProfilingEnabled();
Mike Kellyb5fdf382019-06-11 16:35:25 +0100138
Mike Kelly7ed56dd2020-09-30 20:22:56 +0100139 armnn::BackendOptions gpuAcc("GpuAcc",
140 {
Sadik Armaganf36e10b2021-01-11 16:34:01 +0000141 { "FastMathEnabled", options.IsFastMathEnabled() },
142 { "SaveCachedNetwork", options.SaveCachedNetwork() },
Finn Williamsf5ca16c2021-02-12 14:26:23 +0000143 { "CachedNetworkFilePath", options.GetCachedNetworkFilePath() },
144 { "MLGOTuningFilePath", options.GetClMLGOTunedParametersFile() }
Mike Kelly7ed56dd2020-09-30 20:22:56 +0100145 });
Finn Williamsf5ca16c2021-02-12 14:26:23 +0000146
Mike Kelly7ed56dd2020-09-30 20:22:56 +0100147 armnn::BackendOptions cpuAcc("CpuAcc",
148 {
Matthew Sloyancd639c92021-02-11 16:57:38 +0000149 { "FastMathEnabled", options.IsFastMathEnabled() },
150 { "NumberOfThreads", options.GetNumberOfThreads() }
Mike Kelly7ed56dd2020-09-30 20:22:56 +0100151 });
152 OptOptions.m_ModelOptions.push_back(gpuAcc);
153 OptOptions.m_ModelOptions.push_back(cpuAcc);
154
Mike Kellyb5fdf382019-06-11 16:35:25 +0100155 std::vector<std::string> errMessages;
156 try
157 {
158 optNet = armnn::Optimize(*modelConverter.GetINetwork(),
159 options.GetBackends(),
160 runtime->GetDeviceSpec(),
161 OptOptions,
162 errMessages);
163 }
Derek Lambertib9cb8442019-11-28 13:34:48 +0000164 catch (std::exception &e)
Mike Kellyb5fdf382019-06-11 16:35:25 +0100165 {
166 std::stringstream message;
Derek Lambertib9cb8442019-11-28 13:34:48 +0000167 message << "Exception (" << e.what() << ") caught from optimize.";
Kevin Mayec1e5b82020-02-26 17:00:39 +0000168 FailPrepareModel(V1_0::ErrorStatus::GENERAL_FAILURE, message.str(), cb);
169 return V1_0::ErrorStatus::NONE;
Mike Kellyb5fdf382019-06-11 16:35:25 +0100170 }
171
172 // Check that the optimized network is valid.
173 if (!optNet)
174 {
175 std::stringstream message;
176 message << "Invalid optimized network";
177 for (const std::string& msg : errMessages)
178 {
179 message << "\n" << msg;
180 }
Kevin Mayec1e5b82020-02-26 17:00:39 +0000181 FailPrepareModel(V1_0::ErrorStatus::GENERAL_FAILURE, message.str(), cb);
182 return V1_0::ErrorStatus::NONE;
Mike Kellyb5fdf382019-06-11 16:35:25 +0100183 }
184
185 // Export the optimized network graph to a dot file if an output dump directory
186 // has been specified in the drivers' arguments.
Jim Flynn829ad302019-12-13 14:43:24 +0000187 std::string dotGraphFileName = ExportNetworkGraphToDotFile(*optNet,
188 options.GetRequestInputsAndOutputsDumpDir());
Mike Kellyb5fdf382019-06-11 16:35:25 +0100189
190 // Load it into the runtime.
191 armnn::NetworkId netId = 0;
Finn Williamsd8fb5402021-05-19 20:52:00 +0100192 std::string msg;
193 armnn::INetworkProperties networkProperties(options.isAsyncModelExecutionEnabled(),
194 MemorySource::Undefined,
Finn Williamsca3a3e02021-06-11 15:04:02 +0100195 MemorySource::Undefined);
Mike Kellyb5fdf382019-06-11 16:35:25 +0100196 try
197 {
Finn Williamsd8fb5402021-05-19 20:52:00 +0100198 if (runtime->LoadNetwork(netId, move(optNet), msg, networkProperties) != armnn::Status::Success)
Mike Kellyb5fdf382019-06-11 16:35:25 +0100199 {
Kevin Mayec1e5b82020-02-26 17:00:39 +0000200 return FailPrepareModel(V1_0::ErrorStatus::GENERAL_FAILURE, "Network could not be loaded", cb);
Mike Kellyb5fdf382019-06-11 16:35:25 +0100201 }
202 }
Derek Lambertib9cb8442019-11-28 13:34:48 +0000203 catch (std::exception& e)
Mike Kellyb5fdf382019-06-11 16:35:25 +0100204 {
205 std::stringstream message;
Derek Lambertib9cb8442019-11-28 13:34:48 +0000206 message << "Exception (" << e.what()<< ") caught from LoadNetwork.";
Kevin Mayec1e5b82020-02-26 17:00:39 +0000207 FailPrepareModel(V1_0::ErrorStatus::GENERAL_FAILURE, message.str(), cb);
208 return V1_0::ErrorStatus::NONE;
Mike Kellyb5fdf382019-06-11 16:35:25 +0100209 }
210
Sadik Armaganb3021432021-01-13 15:56:51 +0000211 // Now that we have a networkId for the graph rename the exported files to use it
212 // so that we can associate the graph file and the input/output tensor exported files
213 RenameExportedFiles(serializedNetworkFileName,
214 dotGraphFileName,
215 options.GetRequestInputsAndOutputsDumpDir(),
216 netId);
Jim Flynn829ad302019-12-13 14:43:24 +0000217
Mike Kellyb5fdf382019-06-11 16:35:25 +0100218 std::unique_ptr<ArmnnPreparedModel_1_2<hal_1_2::HalPolicy>> preparedModel(
219 new ArmnnPreparedModel_1_2<hal_1_2::HalPolicy>(
220 netId,
221 runtime.get(),
222 model,
223 options.GetRequestInputsAndOutputsDumpDir(),
Finn Williamsd8fb5402021-05-19 20:52:00 +0100224 options.IsGpuProfilingEnabled(),
Finn Williamsca3a3e02021-06-11 15:04:02 +0100225 options.isAsyncModelExecutionEnabled(),
226 options.getNoOfArmnnThreads()));
Mike Kellyb5fdf382019-06-11 16:35:25 +0100227
228 // Run a single 'dummy' inference of the model. This means that CL kernels will get compiled (and tuned if
229 // this is enabled) before the first 'real' inference which removes the overhead of the first inference.
230 if (!preparedModel->ExecuteWithDummyInputs())
231 {
Kevin Mayec1e5b82020-02-26 17:00:39 +0000232 return FailPrepareModel(V1_0::ErrorStatus::GENERAL_FAILURE, "Network could not be executed", cb);
Mike Kellyb5fdf382019-06-11 16:35:25 +0100233 }
234
235 if (clTunedParameters &&
236 options.GetClTunedParametersMode() == armnn::IGpuAccTunedParameters::Mode::UpdateTunedParameters)
237 {
238 // Now that we've done one inference the CL kernel parameters will have been tuned, so save the updated file.
239 try
240 {
241 clTunedParameters->Save(options.GetClTunedParametersFile().c_str());
242 }
Derek Lambertib9cb8442019-11-28 13:34:48 +0000243 catch (std::exception& error)
Mike Kellyb5fdf382019-06-11 16:35:25 +0100244 {
245 ALOGE("ArmnnDriverImpl::prepareModel: Failed to save CL tuned parameters file '%s': %s",
246 options.GetClTunedParametersFile().c_str(), error.what());
247 }
248 }
249
Kevin Mayec1e5b82020-02-26 17:00:39 +0000250 NotifyCallbackAndCheck(cb, V1_0::ErrorStatus::NONE, preparedModel.release());
Mike Kellyb5fdf382019-06-11 16:35:25 +0100251
Kevin Mayec1e5b82020-02-26 17:00:39 +0000252 return V1_0::ErrorStatus::NONE;
Mike Kellyb5fdf382019-06-11 16:35:25 +0100253}
254
255Return<void> ArmnnDriverImpl::getCapabilities_1_2(const armnn::IRuntimePtr& runtime,
256 V1_2::IDevice::getCapabilities_1_2_cb cb)
257{
258 ALOGV("hal_1_2::ArmnnDriverImpl::getCapabilities()");
259
260 V1_2::Capabilities capabilities;
261
Ferran Balaguerd7c8eb92019-07-01 13:37:44 +0100262 float defaultValue = .1f;
263
Mike Kellyb5fdf382019-06-11 16:35:25 +0100264 if (runtime)
265 {
266 capabilities.relaxedFloat32toFloat16PerformanceScalar.execTime =
Ferran Balaguerd7c8eb92019-07-01 13:37:44 +0100267 ParseSystemProperty(g_RelaxedFloat32toFloat16PerformanceExecTime, defaultValue);
Mike Kellyb5fdf382019-06-11 16:35:25 +0100268
Kevin May2eaa1192020-04-15 16:50:57 +0100269 capabilities.relaxedFloat32toFloat16PerformanceScalar.powerUsage =
270 ParseSystemProperty(g_RelaxedFloat32toFloat16PerformancePowerUsage, defaultValue);
271
272 capabilities.relaxedFloat32toFloat16PerformanceTensor.execTime =
273 ParseSystemProperty(g_RelaxedFloat32toFloat16PerformanceExecTime, defaultValue);
274
FinnWilliamsArmdf655ee2019-07-24 16:04:18 +0100275 capabilities.relaxedFloat32toFloat16PerformanceTensor.powerUsage =
276 ParseSystemProperty(g_RelaxedFloat32toFloat16PerformancePowerUsage, defaultValue);
Ferran Balaguerd7c8eb92019-07-01 13:37:44 +0100277
278 // Set the base value for all operand types
Sadik Armagan188675f2021-02-12 17:16:42 +0000279 #if defined(ARMNN_ANDROID_R) || defined(ARMNN_ANDROID_S)
Kevin Mayec1e5b82020-02-26 17:00:39 +0000280 capabilities.operandPerformance = nonExtensionOperandPerformance<HalVersion::V1_2>({FLT_MAX, FLT_MAX});
281 #else
Ferran Balaguerd7c8eb92019-07-01 13:37:44 +0100282 capabilities.operandPerformance = nonExtensionOperandPerformance({FLT_MAX, FLT_MAX});
Kevin Mayec1e5b82020-02-26 17:00:39 +0000283 #endif
Ferran Balaguerd7c8eb92019-07-01 13:37:44 +0100284
285 // Load supported operand types
Kevin Mayec1e5b82020-02-26 17:00:39 +0000286 update(&capabilities.operandPerformance, V1_2::OperandType::TENSOR_FLOAT32,
Ferran Balaguerd7c8eb92019-07-01 13:37:44 +0100287 {
288 .execTime = ParseSystemProperty(g_OperandTypeTensorFloat32PerformanceExecTime, defaultValue),
289 .powerUsage = ParseSystemProperty(g_OperandTypeTensorFloat32PerformancePowerUsage, defaultValue)
290 });
291
Kevin Mayec1e5b82020-02-26 17:00:39 +0000292 update(&capabilities.operandPerformance, V1_2::OperandType::FLOAT32,
Ferran Balaguerd7c8eb92019-07-01 13:37:44 +0100293 {
294 .execTime = ParseSystemProperty(g_OperandTypeFloat32PerformanceExecTime, defaultValue),
295 .powerUsage = ParseSystemProperty(g_OperandTypeFloat32PerformancePowerUsage, defaultValue)
296 });
297
Kevin Mayec1e5b82020-02-26 17:00:39 +0000298 update(&capabilities.operandPerformance, V1_2::OperandType::TENSOR_FLOAT16,
Ferran Balaguerd7c8eb92019-07-01 13:37:44 +0100299 {
300 .execTime = ParseSystemProperty(g_OperandTypeTensorFloat16PerformanceExecTime, defaultValue),
301 .powerUsage = ParseSystemProperty(g_OperandTypeTensorFloat16PerformancePowerUsage, defaultValue)
302 });
303
Kevin Mayec1e5b82020-02-26 17:00:39 +0000304 update(&capabilities.operandPerformance, V1_2::OperandType::FLOAT16,
Ferran Balaguerd7c8eb92019-07-01 13:37:44 +0100305 {
306 .execTime = ParseSystemProperty(g_OperandTypeFloat16PerformanceExecTime, defaultValue),
307 .powerUsage = ParseSystemProperty(g_OperandTypeFloat16PerformancePowerUsage, defaultValue)
308 });
309
Kevin Mayec1e5b82020-02-26 17:00:39 +0000310 update(&capabilities.operandPerformance, V1_2::OperandType::TENSOR_QUANT8_ASYMM,
Ferran Balaguerd7c8eb92019-07-01 13:37:44 +0100311 {
312 .execTime = ParseSystemProperty(g_OperandTypeTensorQuant8AsymmPerformanceExecTime, defaultValue),
313 .powerUsage = ParseSystemProperty(g_OperandTypeTensorQuant8AsymmPerformancePowerUsage, defaultValue)
314 });
315
Kevin Mayec1e5b82020-02-26 17:00:39 +0000316 update(&capabilities.operandPerformance, V1_2::OperandType::TENSOR_QUANT8_SYMM,
Pablo Tellofb45e2f2019-10-18 16:51:57 +0100317 {
318 .execTime = ParseSystemProperty(g_OperandTypeTensorQuant8SymmPerformanceExecTime, defaultValue),
319 .powerUsage = ParseSystemProperty(g_OperandTypeTensorQuant8SymmPerformancePowerUsage, defaultValue)
320 });
321
Kevin Mayec1e5b82020-02-26 17:00:39 +0000322 update(&capabilities.operandPerformance, V1_2::OperandType::TENSOR_QUANT16_SYMM,
Ferran Balaguerd7c8eb92019-07-01 13:37:44 +0100323 {
324 .execTime = ParseSystemProperty(g_OperandTypeTensorQuant16SymmPerformanceExecTime, defaultValue),
325 .powerUsage = ParseSystemProperty(g_OperandTypeTensorQuant16SymmPerformancePowerUsage, defaultValue)
326 });
327
Kevin Mayec1e5b82020-02-26 17:00:39 +0000328 update(&capabilities.operandPerformance, V1_2::OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL,
Kevin May87cb7612019-11-11 17:30:35 +0000329 {
330 .execTime =
331 ParseSystemProperty(g_OperandTypeTensorQuant8SymmPerChannelPerformanceExecTime, defaultValue),
332 .powerUsage =
333 ParseSystemProperty(g_OperandTypeTensorQuant8SymmPerChannelPerformancePowerUsage, defaultValue)
334 });
335
Kevin Mayec1e5b82020-02-26 17:00:39 +0000336 update(&capabilities.operandPerformance, V1_2::OperandType::TENSOR_INT32,
Ferran Balaguerd7c8eb92019-07-01 13:37:44 +0100337 {
338 .execTime = ParseSystemProperty(g_OperandTypeTensorInt32PerformanceExecTime, defaultValue),
339 .powerUsage = ParseSystemProperty(g_OperandTypeTensorInt32PerformancePowerUsage, defaultValue)
340 });
341
Kevin Mayec1e5b82020-02-26 17:00:39 +0000342 update(&capabilities.operandPerformance, V1_2::OperandType::INT32,
Ferran Balaguerd7c8eb92019-07-01 13:37:44 +0100343 {
344 .execTime = ParseSystemProperty(g_OperandTypeInt32PerformanceExecTime, defaultValue),
345 .powerUsage = ParseSystemProperty(g_OperandTypeInt32PerformancePowerUsage, defaultValue)
346 });
Mike Kellyb5fdf382019-06-11 16:35:25 +0100347
Kevin Mayec1e5b82020-02-26 17:00:39 +0000348 cb(V1_0::ErrorStatus::NONE, capabilities);
Mike Kellyb5fdf382019-06-11 16:35:25 +0100349 }
350 else
351 {
Kevin May2eaa1192020-04-15 16:50:57 +0100352 capabilities.relaxedFloat32toFloat16PerformanceScalar.execTime = 0;
353 capabilities.relaxedFloat32toFloat16PerformanceScalar.powerUsage = 0;
354 capabilities.relaxedFloat32toFloat16PerformanceTensor.execTime = 0;
355 capabilities.relaxedFloat32toFloat16PerformanceTensor.powerUsage = 0;
Mike Kellyb5fdf382019-06-11 16:35:25 +0100356
Ferran Balaguerd7c8eb92019-07-01 13:37:44 +0100357 // Set the base value for all operand types
Sadik Armagan188675f2021-02-12 17:16:42 +0000358 #if defined(ARMNN_ANDROID_R) || defined(ARMNN_ANDROID_S)
Kevin Mayec1e5b82020-02-26 17:00:39 +0000359 capabilities.operandPerformance = nonExtensionOperandPerformance<HalVersion::V1_2>({0.f, 0.0f});
360 #else
Ferran Balaguerd7c8eb92019-07-01 13:37:44 +0100361 capabilities.operandPerformance = nonExtensionOperandPerformance({0.f, 0.0f});
Kevin Mayec1e5b82020-02-26 17:00:39 +0000362 #endif
Ferran Balaguerd7c8eb92019-07-01 13:37:44 +0100363
Kevin Mayec1e5b82020-02-26 17:00:39 +0000364 cb(V1_0::ErrorStatus::DEVICE_UNAVAILABLE, capabilities);
Mike Kellyb5fdf382019-06-11 16:35:25 +0100365 }
366
367 return Void();
368}
369
370} // namespace hal_1_2
Kevin Mayec1e5b82020-02-26 17:00:39 +0000371} // namespace armnn_driver