ArmNN
 23.02
DelegateOptions Class Reference

#include <DelegateOptions.hpp>

Public Member Functions

 DelegateOptions (armnn::Compute computeDevice, const std::vector< armnn::BackendOptions > &backendOptions={}, armnn::Optional< armnn::LogSeverity > logSeverityLevel=armnn::EmptyOptional())
 
 DelegateOptions (const std::vector< armnn::BackendId > &backends, const std::vector< armnn::BackendOptions > &backendOptions={}, armnn::Optional< armnn::LogSeverity > logSeverityLevel=armnn::EmptyOptional())
 
 DelegateOptions (armnn::Compute computeDevice, const armnn::OptimizerOptions &optimizerOptions, const armnn::Optional< armnn::LogSeverity > &logSeverityLevel=armnn::EmptyOptional(), const armnn::Optional< armnn::DebugCallbackFunction > &func=armnn::EmptyOptional())
 
 DelegateOptions (const std::vector< armnn::BackendId > &backends, const armnn::OptimizerOptions &optimizerOptions, const armnn::Optional< armnn::LogSeverity > &logSeverityLevel=armnn::EmptyOptional(), const armnn::Optional< armnn::DebugCallbackFunction > &func=armnn::EmptyOptional())
 
 DelegateOptions (char const *const *options_keys, char const *const *options_values, size_t num_options, void(*report_error)(const char *))
 This constructor processes delegate options in form of command line arguments. More...
 
const std::vector< armnn::BackendId > & GetBackends () const
 
void SetBackends (const std::vector< armnn::BackendId > &backends)
 
void SetDynamicBackendsPath (const std::string &dynamicBackendsPath)
 
const std::string & GetDynamicBackendsPath () const
 
void SetGpuProfilingState (bool gpuProfilingState)
 
bool GetGpuProfilingState ()
 
const std::vector< armnn::BackendOptions > & GetBackendOptions () const
 
void AddBackendOption (const armnn::BackendOptions &option)
 Appends a backend option to the list of backend options. More...
 
void SetLoggingSeverity (const armnn::LogSeverity &level)
 Sets the severity level for logging within ArmNN that will be used on creation of the delegate. More...
 
void SetLoggingSeverity (const std::string &level)
 
armnn::LogSeverity GetLoggingSeverity ()
 Returns the severity level for logging within ArmNN. More...
 
bool IsLoggingEnabled ()
 
const armnn::OptimizerOptionsGetOptimizerOptions () const
 
void SetOptimizerOptions (const armnn::OptimizerOptions &optimizerOptions)
 
const armnn::Optional< armnn::DebugCallbackFunction > & GetDebugCallbackFunction () const
 
void SetInternalProfilingParams (bool internalProfilingState, const armnn::ProfilingDetailsMethod &internalProfilingDetail)
 
bool GetInternalProfilingState () const
 
const armnn::ProfilingDetailsMethodGetInternalProfilingDetail () const
 
void SetExternalProfilingParams (const arm::pipe::ProfilingOptions &externalProfilingParams)
 
const arm::pipe::ProfilingOptions & GetExternalProfilingParams () const
 
void SetSerializeToDot (const std::string &serializeToDotFile)
 
const std::string & GetSerializeToDot () const
 
void SetRuntimeOptions (const armnn::IRuntime::CreationOptions &runtimeOptions)
 @Note: This might overwrite options that were set with other setter functions of DelegateOptions More...
 
const armnn::IRuntime::CreationOptionsGetRuntimeOptions ()
 
void DisableTfLiteRuntimeFallback (bool fallbackState)
 
bool TfLiteRuntimeFallbackDisabled ()
 

Detailed Description

Definition at line 21 of file DelegateOptions.hpp.

Constructor & Destructor Documentation

◆ DelegateOptions() [1/5]

DelegateOptions ( armnn::Compute  computeDevice,
const std::vector< armnn::BackendOptions > &  backendOptions = {},
armnn::Optional< armnn::LogSeverity logSeverityLevel = armnn::EmptyOptional() 
)

◆ DelegateOptions() [2/5]

DelegateOptions ( const std::vector< armnn::BackendId > &  backends,
const std::vector< armnn::BackendOptions > &  backendOptions = {},
armnn::Optional< armnn::LogSeverity logSeverityLevel = armnn::EmptyOptional() 
)

◆ DelegateOptions() [3/5]

DelegateOptions ( armnn::Compute  computeDevice,
const armnn::OptimizerOptions optimizerOptions,
const armnn::Optional< armnn::LogSeverity > &  logSeverityLevel = armnn::EmptyOptional(),
const armnn::Optional< armnn::DebugCallbackFunction > &  func = armnn::EmptyOptional() 
)

◆ DelegateOptions() [4/5]

DelegateOptions ( const std::vector< armnn::BackendId > &  backends,
const armnn::OptimizerOptions optimizerOptions,
const armnn::Optional< armnn::LogSeverity > &  logSeverityLevel = armnn::EmptyOptional(),
const armnn::Optional< armnn::DebugCallbackFunction > &  func = armnn::EmptyOptional() 
)

◆ DelegateOptions() [5/5]

DelegateOptions ( char const *const *  options_keys,
char const *const *  options_values,
size_t  num_options,
void(*)(const char *)  report_error 
)

This constructor processes delegate options in form of command line arguments.

It works in conjunction with the TfLite external delegate plugin.

Available options:

Option key: "backends"
Possible values: ["EthosNPU"/"GpuAcc"/"CpuAcc"/"CpuRef"]
Descriptions: A comma separated list without whitespaces of backends which should be used for execution. Falls back to next backend in list if previous doesn't provide support for operation. e.g. "GpuAcc,CpuAcc"

Option key: "dynamic-backends-path"
Possible values: [filenameString]
Descriptions: This is the directory that will be searched for any dynamic backends.

Option key: "logging-severity"
Possible values: ["trace"/"debug"/"info"/"warning"/"error"/"fatal"]
Description: Sets the logging severity level for ArmNN. Logging is turned off if this option is not provided.

Option key: "gpu-tuning-level"
Possible values: ["0"/"1"/"2"/"3"]
Description: 0=UseOnly(default), 1=RapidTuning, 2=NormalTuning, 3=ExhaustiveTuning. Requires option gpu-tuning-file. 1,2 and 3 will create a tuning-file, 0 will apply the tunings from an existing file

Option key: "gpu-mlgo-tuning-file"
Possible values: [filenameString]
Description: File name for the MLGO tuning file

Option key: "gpu-tuning-file"
Possible values: [filenameString]
Description: File name for the tuning file.

Option key: "gpu-enable-profiling"
Possible values: ["true"/"false"]
Description: Enables GPU profiling

Option key: "gpu-kernel-profiling-enabled"
Possible values: ["true"/"false"]
Description: Enables GPU kernel profiling

Option key: "save-cached-network"
Possible values: ["true"/"false"]
Description: Enables saving of the cached network to a file, specified with the cached-network-filepath option

Option key: "cached-network-filepath"
Possible values: [filenameString]
Description: If non-empty, the given file will be used to load/save the cached network. If save-cached-network is given then the cached network will be saved to the given file. To save the cached network a file must already exist. If save-cached-network is not given then the cached network will be loaded from the given file. This will remove initial compilation time of kernels and speed up the first execution.

Option key: "enable-fast-math"
Possible values: ["true"/"false"]
Description: Enables fast_math options in backends that support it

Option key: "number-of-threads"
Possible values: ["1"-"64"]
Description: Assign the number of threads used by the CpuAcc backend. Default is set to 0 (Backend will decide number of threads to use).

Option key: "reduce-fp32-to-fp16"
Possible values: ["true"/"false"]
Description: Reduce Fp32 data to Fp16 for faster processing

Option key: "reduce-fp32-to-bf16"
Possible values: ["true"/"false"]
Description: This option is currently ignored. Please enable Fast Math in the CpuAcc or GpuAcc backends.

Option key: "debug-data"
Possible values: ["true"/"false"]
Description: Add debug data for easier troubleshooting

Option key: "memory-import"
Possible values: ["true"/"false"]
Description: Enable memory import

Option key: "enable-internal-profiling"
Possible values: ["true"/"false"]
Description: Enable the internal profiling feature.

Option key: "internal-profiling-detail"
Possible values: [1/2]
Description: Set the detail on the internal profiling. 1 = DetailsWithEvents, 2 = DetailsOnly.

Option key: "enable-external-profiling"
Possible values: ["true"/"false"]
Description: Enable the external profiling feature.

Option key: "timeline-profiling"
Possible values: ["true"/"false"]
Description: Indicates whether external timeline profiling is enabled or not.

Option key: "outgoing-capture-file"
Possible values: [filenameString]
Description: Path to a file in which outgoing timeline profiling messages will be stored.

Option key: "incoming-capture-file"
Possible values: [filenameString]
Description: Path to a file in which incoming timeline profiling messages will be stored.

Option key: "file-only-external-profiling"
Possible values: ["true"/"false"]
Description: Enable profiling output to file only.

Option key: "counter-capture-period"
Possible values: Integer, Default is 10000u Description: Value in microseconds of the profiling capture period.
Option key: "profiling-file-format"
Possible values: String of ["binary"]
Description: The format of the file used for outputting profiling data. Currently on "binary" is supported.

Option key: "serialize-to-dot"
Possible values: [filenameString]
Description: Serialize the optimized network to the file specified in "dot" format.

Option key: "infer-output-shape"
Possible values: ["true"/"false"]
Description: Infers output tensor shape from input tensor shape and validate where applicable.

Option key: "allow-expanded-dims"
Possible values: ["true"/"false"]
Description: If true will disregard dimensions with a size of 1 when validating tensor shapes but tensor sizes must still match.
This is an Experimental parameter that is incompatible with "infer-output-shape".
This parameter may be removed in a later update.

Option key: "disable-tflite-runtime-fallback"
Possible values: ["true"/"false"]
Description: Disable TfLite Runtime fallback in the Arm NN TfLite delegate. An exception will be thrown if unsupported operators are encountered. This option is only for testing purposes.

Parameters
[in]option_keysDelegate option names
[in]options_valuesDelegate option values
[in]num_optionsNumber of delegate options
[in,out]report_errorError callback function

Member Function Documentation

◆ AddBackendOption()

void AddBackendOption ( const armnn::BackendOptions option)
inline

Appends a backend option to the list of backend options.

Definition at line 222 of file DelegateOptions.hpp.

223  {
224  m_RuntimeOptions.m_BackendOptions.push_back(option);
225  }

References IRuntime::CreationOptions::m_BackendOptions.

◆ DisableTfLiteRuntimeFallback()

void DisableTfLiteRuntimeFallback ( bool  fallbackState)
inline

Definition at line 271 of file DelegateOptions.hpp.

272  {
273  m_DisableTfLiteRuntimeFallback = fallbackState;
274  }

◆ GetBackendOptions()

const std::vector<armnn::BackendOptions>& GetBackendOptions ( ) const
inline

Definition at line 216 of file DelegateOptions.hpp.

217  {
218  return m_RuntimeOptions.m_BackendOptions;
219  }

References IRuntime::CreationOptions::m_BackendOptions.

◆ GetBackends()

const std::vector<armnn::BackendId>& GetBackends ( ) const
inline

Definition at line 194 of file DelegateOptions.hpp.

194 { return m_Backends; }

◆ GetDebugCallbackFunction()

const armnn::Optional<armnn::DebugCallbackFunction>& GetDebugCallbackFunction ( ) const
inline

Definition at line 240 of file DelegateOptions.hpp.

241  { return m_DebugCallbackFunc; }

◆ GetDynamicBackendsPath()

const std::string& GetDynamicBackendsPath ( ) const
inline

Definition at line 202 of file DelegateOptions.hpp.

203  {
204  return m_RuntimeOptions.m_DynamicBackendsPath;
205  }

References IRuntime::CreationOptions::m_DynamicBackendsPath.

◆ GetExternalProfilingParams()

const arm::pipe::ProfilingOptions& GetExternalProfilingParams ( ) const
inline

Definition at line 254 of file DelegateOptions.hpp.

255  { return m_ProfilingOptions; }

◆ GetGpuProfilingState()

bool GetGpuProfilingState ( )
inline

Definition at line 211 of file DelegateOptions.hpp.

212  {
213  return m_RuntimeOptions.m_EnableGpuProfiling;
214  }

References IRuntime::CreationOptions::m_EnableGpuProfiling.

◆ GetInternalProfilingDetail()

const armnn::ProfilingDetailsMethod& GetInternalProfilingDetail ( ) const
inline

Definition at line 248 of file DelegateOptions.hpp.

248 { return m_InternalProfilingDetail; }

◆ GetInternalProfilingState()

bool GetInternalProfilingState ( ) const
inline

Definition at line 247 of file DelegateOptions.hpp.

247 { return m_InternalProfilingEnabled; }

◆ GetLoggingSeverity()

armnn::LogSeverity GetLoggingSeverity ( )
inline

Returns the severity level for logging within ArmNN.

Definition at line 232 of file DelegateOptions.hpp.

232 { return m_LoggingSeverity.value(); }

References OptionalReferenceSwitch< IsReference, T >::value().

◆ GetOptimizerOptions()

const armnn::OptimizerOptions& GetOptimizerOptions ( ) const
inline

Definition at line 236 of file DelegateOptions.hpp.

236 { return m_OptimizerOptions; }

◆ GetRuntimeOptions()

const armnn::IRuntime::CreationOptions& GetRuntimeOptions ( )
inline

Definition at line 266 of file DelegateOptions.hpp.

267  {
268  return m_RuntimeOptions;
269  }

◆ GetSerializeToDot()

const std::string& GetSerializeToDot ( ) const
inline

Definition at line 258 of file DelegateOptions.hpp.

258 { return m_SerializeToDot; }

◆ IsLoggingEnabled()

bool IsLoggingEnabled ( )
inline

Definition at line 234 of file DelegateOptions.hpp.

234 { return m_LoggingSeverity.has_value(); }

References OptionalBase::has_value().

◆ SetBackends()

void SetBackends ( const std::vector< armnn::BackendId > &  backends)
inline

Definition at line 196 of file DelegateOptions.hpp.

196 { m_Backends = backends; }

◆ SetDynamicBackendsPath()

void SetDynamicBackendsPath ( const std::string &  dynamicBackendsPath)
inline

Definition at line 198 of file DelegateOptions.hpp.

199  {
200  m_RuntimeOptions.m_DynamicBackendsPath = dynamicBackendsPath;
201  }

References IRuntime::CreationOptions::m_DynamicBackendsPath.

◆ SetExternalProfilingParams()

void SetExternalProfilingParams ( const arm::pipe::ProfilingOptions &  externalProfilingParams)
inline

Definition at line 250 of file DelegateOptions.hpp.

252  { m_ProfilingOptions = externalProfilingParams; }

◆ SetGpuProfilingState()

void SetGpuProfilingState ( bool  gpuProfilingState)
inline

Definition at line 207 of file DelegateOptions.hpp.

208  {
209  m_RuntimeOptions.m_EnableGpuProfiling = gpuProfilingState;
210  }

References IRuntime::CreationOptions::m_EnableGpuProfiling.

◆ SetInternalProfilingParams()

void SetInternalProfilingParams ( bool  internalProfilingState,
const armnn::ProfilingDetailsMethod internalProfilingDetail 
)
inline

Definition at line 243 of file DelegateOptions.hpp.

245  { m_InternalProfilingEnabled = internalProfilingState; m_InternalProfilingDetail = internalProfilingDetail; }

◆ SetLoggingSeverity() [1/2]

void SetLoggingSeverity ( const armnn::LogSeverity level)
inline

Sets the severity level for logging within ArmNN that will be used on creation of the delegate.

Definition at line 228 of file DelegateOptions.hpp.

228 { m_LoggingSeverity = level; }

◆ SetLoggingSeverity() [2/2]

void SetLoggingSeverity ( const std::string &  level)
inline

Definition at line 229 of file DelegateOptions.hpp.

229 { m_LoggingSeverity = armnn::StringToLogLevel(level); }

References armnn::StringToLogLevel().

◆ SetOptimizerOptions()

void SetOptimizerOptions ( const armnn::OptimizerOptions optimizerOptions)
inline

Definition at line 238 of file DelegateOptions.hpp.

238 { m_OptimizerOptions = optimizerOptions; }

◆ SetRuntimeOptions()

void SetRuntimeOptions ( const armnn::IRuntime::CreationOptions runtimeOptions)
inline

@Note: This might overwrite options that were set with other setter functions of DelegateOptions

Definition at line 261 of file DelegateOptions.hpp.

262  {
263  m_RuntimeOptions = runtimeOptions;
264  }

◆ SetSerializeToDot()

void SetSerializeToDot ( const std::string &  serializeToDotFile)
inline

Definition at line 257 of file DelegateOptions.hpp.

257 { m_SerializeToDot = serializeToDotFile; }

◆ TfLiteRuntimeFallbackDisabled()

bool TfLiteRuntimeFallbackDisabled ( )
inline

Definition at line 275 of file DelegateOptions.hpp.

276  {
277  return m_DisableTfLiteRuntimeFallback;
278  }

The documentation for this class was generated from the following file:
armnn::StringToLogLevel
LogSeverity StringToLogLevel(std::string level)
Definition: Logging.hpp:43
armnn::IRuntime::CreationOptions::m_DynamicBackendsPath
std::string m_DynamicBackendsPath
Setting this value will override the paths set by the DYNAMIC_BACKEND_PATHS compiler directive Only a...
Definition: IRuntime.hpp:106
armnn::OptionalReferenceSwitch::value
const T & value() const
Definition: Optional.hpp:146
armnn::IRuntime::CreationOptions::m_EnableGpuProfiling
bool m_EnableGpuProfiling
Setting this flag will allow the user to obtain GPU profiling information from the runtime.
Definition: IRuntime.hpp:101
armnn::IRuntime::CreationOptions::m_BackendOptions
std::vector< BackendOptions > m_BackendOptions
Pass backend specific options.
Definition: IRuntime.hpp:197
armnn::OptionalBase::has_value
bool has_value() const noexcept
Definition: Optional.hpp:53