blob: c4f0ad71bc3c5f509c77dcb22db9a75608736b9f [file] [log] [blame]
Sadik Armagan3c24f432020-10-19 17:35:30 +01001//
Colm Donelan35a06892023-02-06 15:01:57 +00002// Copyright © 2020-2023 Arm Ltd and Contributors. All rights reserved.
Sadik Armagan3c24f432020-10-19 17:35:30 +01003// SPDX-License-Identifier: MIT
4//
5
6#include <DelegateOptions.hpp>
Jan Eilersf39f8d82021-10-26 16:57:34 +01007#include <armnn/utility/NumericCast.hpp>
8#include <armnn/utility/StringUtils.hpp>
Sadik Armagan3c24f432020-10-19 17:35:30 +01009
10namespace armnnDelegate
11{
12
John McLoughlin1bae8652023-03-14 11:47:15 +000013struct DelegateOptionsImpl
14{
15 ~DelegateOptionsImpl() = default;
16 DelegateOptionsImpl() = default;
17
18 explicit DelegateOptionsImpl(armnn::Compute computeDevice,
19 const std::vector<armnn::BackendOptions>& backendOptions,
20 const armnn::Optional<armnn::LogSeverity> logSeverityLevel)
21 : p_Backends({computeDevice}), p_RuntimeOptions(), m_LoggingSeverity(logSeverityLevel)
22 {
23 p_RuntimeOptions.m_BackendOptions = backendOptions;
24 }
25
26 explicit DelegateOptionsImpl(const std::vector<armnn::BackendId>& backends,
27 const std::vector<armnn::BackendOptions>& backendOptions,
28 const armnn::Optional<armnn::LogSeverity> logSeverityLevel)
29 : p_Backends(backends), p_RuntimeOptions(), m_LoggingSeverity(logSeverityLevel)
30 {
31 p_RuntimeOptions.m_BackendOptions = backendOptions;
32 }
33
34 explicit DelegateOptionsImpl(armnn::Compute computeDevice,
35 const armnn::OptimizerOptions& optimizerOptions,
36 const armnn::Optional<armnn::LogSeverity>& logSeverityLevel,
37 const armnn::Optional<armnn::DebugCallbackFunction>& func)
38 : p_Backends({computeDevice}),
39 p_RuntimeOptions(),
40 p_OptimizerOptions(optimizerOptions),
41 m_LoggingSeverity(logSeverityLevel),
42 p_DebugCallbackFunc(func)
43 {
44 }
45
46 explicit DelegateOptionsImpl(const std::vector<armnn::BackendId>& backends,
47 const armnn::OptimizerOptions& optimizerOptions,
48 const armnn::Optional<armnn::LogSeverity>& logSeverityLevel,
49 const armnn::Optional<armnn::DebugCallbackFunction>& func)
50 : p_Backends(backends),
51 p_RuntimeOptions(),
52 p_OptimizerOptions(optimizerOptions),
53 m_LoggingSeverity(logSeverityLevel),
54 p_DebugCallbackFunc(func)
55 {
56 }
57
58 /// Which backend to run Delegate on.
59 /// Examples of possible values are: CpuRef, CpuAcc, GpuAcc.
60 /// CpuRef as default.
61 std::vector<armnn::BackendId> p_Backends = {armnn::Compute::CpuRef };
62
63 /// Creation options for the ArmNN runtime
64 /// Contains options for global settings that are valid for the whole lifetime of ArmNN
65 /// i.e. BackendOptions, DynamicBackendPath, ExternalProfilingOptions and more
66 armnn::IRuntime::CreationOptions p_RuntimeOptions;
67
68 /// Options for the optimization step for the network
69 armnn::OptimizerOptions p_OptimizerOptions;
70
71 /// Internal profiling options. Written to INetworkProperties during model load.
72 /// Indicates whether internal profiling is enabled or not.
73 bool m_InternalProfilingEnabled = false;
74
75 /// Sets the level of detail output by the profiling. Options are DetailsWithEvents = 1 and DetailsOnly = 2
76 armnn::ProfilingDetailsMethod p_InternalProfilingDetail = armnn::ProfilingDetailsMethod::DetailsWithEvents;
77
78 /// Severity level for logging within ArmNN that will be used on creation of the delegate
79 armnn::Optional<armnn::LogSeverity> m_LoggingSeverity;
80
81 /// A callback function to debug layers performing custom computations on intermediate tensors.
82 /// If a function is not registered, and debug is enabled in OptimizerOptions,
83 /// debug will print information of the intermediate tensors.
84 armnn::Optional<armnn::DebugCallbackFunction> p_DebugCallbackFunc;
85
86 /// If not empty then the optimized model will be serialized to a file with this file name in "dot" format.
87 std::string m_SerializeToDot = "";
88
89 /// Option to disable TfLite Runtime fallback for unsupported operators.
90 bool m_DisableTfLiteRuntimeFallback = false;
91
92};
93
94DelegateOptions::~DelegateOptions() = default;
95
96DelegateOptions::DelegateOptions()
97 : p_DelegateOptionsImpl(std::make_unique<DelegateOptionsImpl>())
98{
99}
100
101DelegateOptions::DelegateOptions(DelegateOptions const &other)
102 : p_DelegateOptionsImpl(std::make_unique<DelegateOptionsImpl>(*other.p_DelegateOptionsImpl))
103{
104}
105
Sadik Armagan4189cc52020-11-11 18:01:48 +0000106DelegateOptions::DelegateOptions(armnn::Compute computeDevice,
Jan Eilers2cd18472020-12-15 10:42:38 +0000107 const std::vector<armnn::BackendOptions>& backendOptions,
108 const armnn::Optional<armnn::LogSeverity> logSeverityLevel)
John McLoughlin1bae8652023-03-14 11:47:15 +0000109 : p_DelegateOptionsImpl(std::make_unique<DelegateOptionsImpl>(computeDevice, backendOptions, logSeverityLevel))
Sadik Armagan3c24f432020-10-19 17:35:30 +0100110{
111}
112
Sadik Armagan4189cc52020-11-11 18:01:48 +0000113DelegateOptions::DelegateOptions(const std::vector<armnn::BackendId>& backends,
Jan Eilers2cd18472020-12-15 10:42:38 +0000114 const std::vector<armnn::BackendOptions>& backendOptions,
115 const armnn::Optional<armnn::LogSeverity> logSeverityLevel)
John McLoughlin1bae8652023-03-14 11:47:15 +0000116 : p_DelegateOptionsImpl(std::make_unique<DelegateOptionsImpl>(backends, backendOptions, logSeverityLevel))
Sadik Armagan3c24f432020-10-19 17:35:30 +0100117{
118}
119
Narumol Prangnawarat0b51d5a2021-01-20 15:58:29 +0000120DelegateOptions::DelegateOptions(armnn::Compute computeDevice,
121 const armnn::OptimizerOptions& optimizerOptions,
Narumol Prangnawarat0b51d5a2021-01-20 15:58:29 +0000122 const armnn::Optional<armnn::LogSeverity>& logSeverityLevel,
123 const armnn::Optional<armnn::DebugCallbackFunction>& func)
John McLoughlin1bae8652023-03-14 11:47:15 +0000124 : p_DelegateOptionsImpl(std::make_unique<DelegateOptionsImpl>(computeDevice, optimizerOptions,
125 logSeverityLevel, func))
Narumol Prangnawarat0b51d5a2021-01-20 15:58:29 +0000126{
127}
128
129DelegateOptions::DelegateOptions(const std::vector<armnn::BackendId>& backends,
130 const armnn::OptimizerOptions& optimizerOptions,
Narumol Prangnawarat0b51d5a2021-01-20 15:58:29 +0000131 const armnn::Optional<armnn::LogSeverity>& logSeverityLevel,
132 const armnn::Optional<armnn::DebugCallbackFunction>& func)
John McLoughlin1bae8652023-03-14 11:47:15 +0000133 : p_DelegateOptionsImpl(std::make_unique<DelegateOptionsImpl>(backends, optimizerOptions,
134 logSeverityLevel, func))
Narumol Prangnawarat0b51d5a2021-01-20 15:58:29 +0000135{
136}
137
Jan Eilersf39f8d82021-10-26 16:57:34 +0100138DelegateOptions::DelegateOptions(char const* const* options_keys,
139 char const* const* options_values,
140 size_t num_options,
141 void (*report_error)(const char*))
John McLoughlin1bae8652023-03-14 11:47:15 +0000142 : p_DelegateOptionsImpl(std::make_unique<DelegateOptionsImpl>())
Jan Eilersf39f8d82021-10-26 16:57:34 +0100143{
144 armnn::IRuntime::CreationOptions runtimeOptions;
145 armnn::OptimizerOptions optimizerOptions;
146 bool internalProfilingState = false;
147 armnn::ProfilingDetailsMethod internalProfilingDetail = armnn::ProfilingDetailsMethod::DetailsWithEvents;
Jan Eilersf39f8d82021-10-26 16:57:34 +0100148 for (size_t i = 0; i < num_options; ++i)
149 {
150 // Process backends
151 if (std::string(options_keys[i]) == std::string("backends"))
152 {
153 // The backend option is a comma separated string of backendIDs that needs to be split
154 std::vector<armnn::BackendId> backends;
155 char* dup = strdup(options_values[i]);
156 char* pch = std::strtok(dup, ",");
157 while (pch != NULL)
158 {
159 backends.push_back(pch);
160 pch = strtok (NULL, ",");
161 }
John McLoughlin1bae8652023-03-14 11:47:15 +0000162 SetBackends(backends);
Jan Eilersf39f8d82021-10-26 16:57:34 +0100163 }
164 // Process dynamic-backends-path
165 else if (std::string(options_keys[i]) == std::string("dynamic-backends-path"))
166 {
167 runtimeOptions.m_DynamicBackendsPath = std::string(options_values[i]);
168 }
169 // Process logging level
170 else if (std::string(options_keys[i]) == std::string("logging-severity"))
171 {
John McLoughlin1bae8652023-03-14 11:47:15 +0000172 SetLoggingSeverity(options_values[i]);
Jan Eilersf39f8d82021-10-26 16:57:34 +0100173 }
174 // Process GPU backend options
175 else if (std::string(options_keys[i]) == std::string("gpu-tuning-level"))
176 {
John McLoughlin1bae8652023-03-14 11:47:15 +0000177 armnn::BackendOptions option("GpuAcc", {{"TuningLevel",
178 atoi(options_values[i])}});
Jan Eilersf39f8d82021-10-26 16:57:34 +0100179 runtimeOptions.m_BackendOptions.push_back(option);
180 }
181 else if (std::string(options_keys[i]) == std::string("gpu-mlgo-tuning-file"))
182 {
John McLoughlin1bae8652023-03-14 11:47:15 +0000183 armnn::BackendOptions option("GpuAcc", {{"MLGOTuningFilePath",
184 std::string(options_values[i])}});
Jan Eilersf39f8d82021-10-26 16:57:34 +0100185 optimizerOptions.m_ModelOptions.push_back(option);
186 }
187 else if (std::string(options_keys[i]) == std::string("gpu-tuning-file"))
188 {
John McLoughlin1bae8652023-03-14 11:47:15 +0000189 armnn::BackendOptions option("GpuAcc", {{"TuningFile",
190 std::string(options_values[i])}});
Jan Eilersf39f8d82021-10-26 16:57:34 +0100191 runtimeOptions.m_BackendOptions.push_back(option);
192 }
193 else if (std::string(options_keys[i]) == std::string("gpu-enable-profiling"))
194 {
195 runtimeOptions.m_EnableGpuProfiling = (*options_values[i] != '0');
196 }
197 else if (std::string(options_keys[i]) == std::string("gpu-kernel-profiling-enabled"))
198 {
199 armnn::BackendOptions option("GpuAcc", {{"KernelProfilingEnabled",
200 armnn::stringUtils::StringToBool(options_values[i])}});
201 runtimeOptions.m_BackendOptions.push_back(option);
202 }
203 else if (std::string(options_keys[i]) == std::string("save-cached-network"))
204 {
205 armnn::BackendOptions option("GpuAcc", {{"SaveCachedNetwork",
206 armnn::stringUtils::StringToBool(options_values[i])}});
207 optimizerOptions.m_ModelOptions.push_back(option);
208 }
209 else if (std::string(options_keys[i]) == std::string("cached-network-filepath"))
210 {
John McLoughlin1bae8652023-03-14 11:47:15 +0000211 armnn::BackendOptions option("GpuAcc", {{"CachedNetworkFilePath",
212 std::string(options_values[i])}});
Jan Eilersf39f8d82021-10-26 16:57:34 +0100213 optimizerOptions.m_ModelOptions.push_back(option);
214 }
215 // Process GPU & CPU backend options
216 else if (std::string(options_keys[i]) == std::string("enable-fast-math"))
217 {
218 armnn::BackendOptions modelOptionGpu("GpuAcc", {{"FastMathEnabled",
John McLoughlin1bae8652023-03-14 11:47:15 +0000219 armnn::stringUtils::StringToBool(options_values[i])}});
Jan Eilersf39f8d82021-10-26 16:57:34 +0100220 optimizerOptions.m_ModelOptions.push_back(modelOptionGpu);
221
222 armnn::BackendOptions modelOptionCpu("CpuAcc", {{"FastMathEnabled",
John McLoughlin1bae8652023-03-14 11:47:15 +0000223 armnn::stringUtils::StringToBool(options_values[i])}});
Jan Eilersf39f8d82021-10-26 16:57:34 +0100224 optimizerOptions.m_ModelOptions.push_back(modelOptionCpu);
225 }
226 // Process CPU backend options
227 else if (std::string(options_keys[i]) == std::string("number-of-threads"))
228 {
229 unsigned int numberOfThreads = armnn::numeric_cast<unsigned int>(atoi(options_values[i]));
John McLoughlin1bae8652023-03-14 11:47:15 +0000230 armnn::BackendOptions modelOption("CpuAcc",
231 {{"NumberOfThreads", numberOfThreads}});
Jan Eilersf39f8d82021-10-26 16:57:34 +0100232 optimizerOptions.m_ModelOptions.push_back(modelOption);
233 }
234 // Process reduce-fp32-to-fp16 option
235 else if (std::string(options_keys[i]) == std::string("reduce-fp32-to-fp16"))
236 {
237 optimizerOptions.m_ReduceFp32ToFp16 = armnn::stringUtils::StringToBool(options_values[i]);
238 }
Jan Eilersf39f8d82021-10-26 16:57:34 +0100239 // Process debug-data
240 else if (std::string(options_keys[i]) == std::string("debug-data"))
241 {
242 optimizerOptions.m_Debug = armnn::stringUtils::StringToBool(options_values[i]);
243 }
Mike Kelly80512b02022-05-16 23:10:42 +0100244 // Infer output-shape
245 else if (std::string(options_keys[i]) == std::string("infer-output-shape"))
246 {
247 armnn::BackendOptions backendOption("ShapeInferenceMethod",
248 {
249 { "InferAndValidate", armnn::stringUtils::StringToBool(options_values[i]) }
250 });
251 optimizerOptions.m_ModelOptions.push_back(backendOption);
252 }
253 // Allow expanded dims
254 else if (std::string(options_keys[i]) == std::string("allow-expanded-dims"))
255 {
256 armnn::BackendOptions backendOption("AllowExpandedDims",
257 {
258 { "AllowExpandedDims", armnn::stringUtils::StringToBool(options_values[i]) }
259 });
260 optimizerOptions.m_ModelOptions.push_back(backendOption);
261 }
Jan Eilersf39f8d82021-10-26 16:57:34 +0100262 // Process memory-import
263 else if (std::string(options_keys[i]) == std::string("memory-import"))
264 {
265 optimizerOptions.m_ImportEnabled = armnn::stringUtils::StringToBool(options_values[i]);
266 }
267 // Process enable-internal-profiling
268 else if (std::string(options_keys[i]) == std::string("enable-internal-profiling"))
269 {
270 internalProfilingState = *options_values[i] != '0';
271 optimizerOptions.m_ProfilingEnabled = internalProfilingState;
272 }
273 // Process internal-profiling-detail
274 else if (std::string(options_keys[i]) == std::string("internal-profiling-detail"))
275 {
276 uint32_t detailLevel = static_cast<uint32_t>(std::stoul(options_values[i]));
277 switch (detailLevel)
278 {
279 case 1:
280 internalProfilingDetail = armnn::ProfilingDetailsMethod::DetailsWithEvents;
281 break;
282 case 2:
283 internalProfilingDetail = armnn::ProfilingDetailsMethod::DetailsOnly;
284 break;
285 default:
286 internalProfilingDetail = armnn::ProfilingDetailsMethod::Undefined;
287 break;
288 }
289 }
290 // Process enable-external-profiling
291 else if (std::string(options_keys[i]) == std::string("enable-external-profiling"))
292 {
Colm Donelan35a06892023-02-06 15:01:57 +0000293 runtimeOptions.m_ProfilingOptions.m_EnableProfiling =
294 armnn::stringUtils::StringToBool(options_values[i]);
Jan Eilersf39f8d82021-10-26 16:57:34 +0100295 }
Colm Donelan35a06892023-02-06 15:01:57 +0000296 // Process timeline-profiling
Jan Eilersf39f8d82021-10-26 16:57:34 +0100297 else if (std::string(options_keys[i]) == std::string("timeline-profiling"))
298 {
John McLoughlin1bae8652023-03-14 11:47:15 +0000299 runtimeOptions.m_ProfilingOptions.m_TimelineEnabled =
300 armnn::stringUtils::StringToBool(options_values[i]);
Jan Eilersf39f8d82021-10-26 16:57:34 +0100301 }
Colm Donelan35a06892023-02-06 15:01:57 +0000302 // Process outgoing-capture-file
Jan Eilersf39f8d82021-10-26 16:57:34 +0100303 else if (std::string(options_keys[i]) == std::string("outgoing-capture-file"))
304 {
Colm Donelan35a06892023-02-06 15:01:57 +0000305 runtimeOptions.m_ProfilingOptions.m_OutgoingCaptureFile = options_values[i];
Jan Eilersf39f8d82021-10-26 16:57:34 +0100306 }
Colm Donelan35a06892023-02-06 15:01:57 +0000307 // Process incoming-capture-file
Jan Eilersf39f8d82021-10-26 16:57:34 +0100308 else if (std::string(options_keys[i]) == std::string("incoming-capture-file"))
309 {
Colm Donelan35a06892023-02-06 15:01:57 +0000310 runtimeOptions.m_ProfilingOptions.m_IncomingCaptureFile = options_values[i];
Jan Eilersf39f8d82021-10-26 16:57:34 +0100311 }
Colm Donelan35a06892023-02-06 15:01:57 +0000312 // Process file-only-external-profiling
Jan Eilersf39f8d82021-10-26 16:57:34 +0100313 else if (std::string(options_keys[i]) == std::string("file-only-external-profiling"))
314 {
Colm Donelan35a06892023-02-06 15:01:57 +0000315 runtimeOptions.m_ProfilingOptions.m_FileOnly = armnn::stringUtils::StringToBool(options_values[i]);
Jan Eilersf39f8d82021-10-26 16:57:34 +0100316 }
Colm Donelan35a06892023-02-06 15:01:57 +0000317 // Process counter-capture-period
Jan Eilersf39f8d82021-10-26 16:57:34 +0100318 else if (std::string(options_keys[i]) == std::string("counter-capture-period"))
319 {
John McLoughlin1bae8652023-03-14 11:47:15 +0000320 runtimeOptions.m_ProfilingOptions.m_CapturePeriod =
321 static_cast<uint32_t>(std::stoul(options_values[i]));
Jan Eilersf39f8d82021-10-26 16:57:34 +0100322 }
Colm Donelan35a06892023-02-06 15:01:57 +0000323 // Process profiling-file-format
Jan Eilersf39f8d82021-10-26 16:57:34 +0100324 else if (std::string(options_keys[i]) == std::string("profiling-file-format"))
325 {
Colm Donelan35a06892023-02-06 15:01:57 +0000326 runtimeOptions.m_ProfilingOptions.m_FileFormat = options_values[i];
Jan Eilersf39f8d82021-10-26 16:57:34 +0100327 }
Colm Donelan35a06892023-02-06 15:01:57 +0000328 // Process serialize-to-dot
Jan Eilersf39f8d82021-10-26 16:57:34 +0100329 else if (std::string(options_keys[i]) == std::string("serialize-to-dot"))
330 {
John McLoughlin1bae8652023-03-14 11:47:15 +0000331 SetSerializeToDot(options_values[i]);
Jan Eilersf39f8d82021-10-26 16:57:34 +0100332 }
Sadik Armaganca565c12022-08-16 12:17:24 +0100333
John McLoughlin1bae8652023-03-14 11:47:15 +0000334 // Process disable-tflite-runtime-fallback
Sadik Armaganca565c12022-08-16 12:17:24 +0100335 else if (std::string(options_keys[i]) == std::string("disable-tflite-runtime-fallback"))
336 {
337 this->DisableTfLiteRuntimeFallback(armnn::stringUtils::StringToBool(options_values[i]));
338 }
Jan Eilersf39f8d82021-10-26 16:57:34 +0100339 else
340 {
John McLoughlin1bae8652023-03-14 11:47:15 +0000341 throw armnn::Exception("Unknown option for the ArmNN Delegate given: " +
342 std::string(options_keys[i]));
Jan Eilersf39f8d82021-10-26 16:57:34 +0100343 }
344 }
345
John McLoughlin1bae8652023-03-14 11:47:15 +0000346 SetRuntimeOptions(runtimeOptions);
347 SetOptimizerOptions(optimizerOptions);
348 SetInternalProfilingParams(internalProfilingState, internalProfilingDetail);
Jan Eilersf39f8d82021-10-26 16:57:34 +0100349}
John McLoughlin1bae8652023-03-14 11:47:15 +0000350
351const std::vector<armnn::BackendId>& DelegateOptions::GetBackends() const
352{
353 return p_DelegateOptionsImpl->p_Backends;
354}
355
356void DelegateOptions::SetBackends(const std::vector<armnn::BackendId>& backends)
357{
358 p_DelegateOptionsImpl->p_Backends = backends;
359}
360
361void DelegateOptions::SetDynamicBackendsPath(const std::string& dynamicBackendsPath)
362{
363 p_DelegateOptionsImpl->p_RuntimeOptions.m_DynamicBackendsPath = dynamicBackendsPath;
364}
365
366const std::string& DelegateOptions::GetDynamicBackendsPath() const
367{
368 return p_DelegateOptionsImpl->p_RuntimeOptions.m_DynamicBackendsPath;
369}
370
371void DelegateOptions::SetGpuProfilingState(bool gpuProfilingState)
372{
373 p_DelegateOptionsImpl->p_RuntimeOptions.m_EnableGpuProfiling = gpuProfilingState;
374}
375
376bool DelegateOptions::GetGpuProfilingState()
377{
378 return p_DelegateOptionsImpl->p_RuntimeOptions.m_EnableGpuProfiling;
379}
380
381const std::vector<armnn::BackendOptions>& DelegateOptions::GetBackendOptions() const
382{
383 return p_DelegateOptionsImpl->p_RuntimeOptions.m_BackendOptions;
384}
385
386void DelegateOptions::AddBackendOption(const armnn::BackendOptions& option)
387{
388 p_DelegateOptionsImpl->p_RuntimeOptions.m_BackendOptions.push_back(option);
389}
390
391void DelegateOptions::SetLoggingSeverity(const armnn::LogSeverity& level)
392{
393 p_DelegateOptionsImpl->m_LoggingSeverity = level;
394}
395
396void DelegateOptions::SetLoggingSeverity(const std::string& level)
397{
398 p_DelegateOptionsImpl->m_LoggingSeverity = armnn::StringToLogLevel(level);
399}
400
401armnn::LogSeverity DelegateOptions::GetLoggingSeverity()
402{
403 return p_DelegateOptionsImpl->m_LoggingSeverity.value();
404}
405
406bool DelegateOptions::IsLoggingEnabled()
407{
408 return p_DelegateOptionsImpl->m_LoggingSeverity.has_value();
409}
410
411const armnn::OptimizerOptions& DelegateOptions::GetOptimizerOptions() const
412{
413 return p_DelegateOptionsImpl->p_OptimizerOptions;
414}
415
416void DelegateOptions::SetOptimizerOptions(const armnn::OptimizerOptions& optimizerOptions)
417{
418 p_DelegateOptionsImpl->p_OptimizerOptions = optimizerOptions;
419}
420
421const armnn::Optional<armnn::DebugCallbackFunction>& DelegateOptions::GetDebugCallbackFunction() const
422{
423 return p_DelegateOptionsImpl->p_DebugCallbackFunc;
424}
425
426void DelegateOptions::SetInternalProfilingParams(bool internalProfilingState,
427 const armnn::ProfilingDetailsMethod& internalProfilingDetail)
428{
429 p_DelegateOptionsImpl->m_InternalProfilingEnabled = internalProfilingState;
430 p_DelegateOptionsImpl->p_InternalProfilingDetail = internalProfilingDetail;
431}
432
433bool DelegateOptions::GetInternalProfilingState() const
434{
435 return p_DelegateOptionsImpl->m_InternalProfilingEnabled;
436}
437
438const armnn::ProfilingDetailsMethod& DelegateOptions::GetInternalProfilingDetail() const
439{
440 return p_DelegateOptionsImpl->p_InternalProfilingDetail;
441}
442
443void DelegateOptions::SetSerializeToDot(const std::string& serializeToDotFile)
444{
445 p_DelegateOptionsImpl->m_SerializeToDot = serializeToDotFile;
446}
447
448const std::string& DelegateOptions::GetSerializeToDot() const
449{
450 return p_DelegateOptionsImpl->m_SerializeToDot;
451}
452
453void DelegateOptions::SetRuntimeOptions(const armnn::IRuntime::CreationOptions& runtimeOptions)
454{
455 p_DelegateOptionsImpl->p_RuntimeOptions = runtimeOptions;
456}
457
458const armnn::IRuntime::CreationOptions& DelegateOptions::GetRuntimeOptions()
459{
460 return p_DelegateOptionsImpl->p_RuntimeOptions;
461}
462
463void DelegateOptions::DisableTfLiteRuntimeFallback(bool fallbackState)
464{
465 p_DelegateOptionsImpl->m_DisableTfLiteRuntimeFallback = fallbackState;
466}
467
468bool DelegateOptions::TfLiteRuntimeFallbackDisabled()
469{
470 return p_DelegateOptionsImpl->m_DisableTfLiteRuntimeFallback;
471}
472
Sadik Armagan3c24f432020-10-19 17:35:30 +0100473} // namespace armnnDelegate