1/// Copyright (c) 2022 ARM Limited and Contributors. All rights reserved. 2/// 3/// SPDX-License-Identifier: MIT 4/// 5 6namespace armnn 7{ 8/** 9@page runtimeoptions Runtime options for Arm NN 10@tableofcontents 11 12Across all software interfaces to Arm NN there are a set of common 13configuration parameters. These parameters control how a model is loaded or 14how the inference is executed. The widest set of options are available at 15the lowest, Arm NN C++ interface. They reduce as you move outward to the 16TfLite delegate and NNAPI Support Library. The tables below describe the 17arguments and in which interface they are available. 18 19@subsection deviceselection Compute device selection 20 21The compute device selected is required to be specified across all 22interfaces. The device selection will dictate the availability of some 23parameters and whether some sub graphs are supported. 24 25Interface | Device selection 26:-------- | :---------- 27Arm NN | The parameter "const std::vector<BackendId>& backendPreferences" to armnn::Optimize provides a vector of backendId's. If multiple devices are specifed the order of the vector dictates the order in which execution will be attempted. If all or part of the model is not supported by a backend, the next in order will be tried. 28TfLite delegate | armnnDelegate::DelegateOptions Compute device or backend ids: This tells Arm NN which devices will be used to process the inference. A single device can be specified using the armnn::Compute enum. Multiple devices can be specified using a vector of armnn::BackendId. If multiple devices are specifed the order of the vector dictates the order in which execution will be attempted. If all or part of the model is not supported by a backend the next in order will be tried. Valid backend ids are: [EthosNAcc/GpuAcc/CpuAcc/CpuRef] 29Support Library | armnn_driver::DriverOptions Compute device or backend ids: This tells Arm NN which devices will be used to process the inference. A single device can be specified using the armnn::Compute enum. Multiple devices can be specified using a vector of armnn::BackendId. If multiple devices are specifed the order of the vector dictates the order in which execution will be attempted. If all or part of the model is not supported by a backend the next in order will be tried. Valid backend ids are: [EthosNAcc/GpuAcc/CpuAcc/CpuRef] 30 31@subsection runtimeoptions Runtime options 32 33There a several levels at which Arm NN accepts runtime parameters. Some of 34these are specific to an Arm NN instance, some to a loaded network and some 35to the backend on which a network inference is to execute. Each of the 36external interfaces handles these options in different ways. 37 38@subsection instanceoptions Arm NN Instance level options 39 40In the Arm NN C++ interface these options are set by passing an armnn::CreationOptions struct to IRuntime. 41Not all available options are described here. 42 43Arm NN Parameter | Delegate | Support library | Values | Description 44:--------------- | :-------- | :-------------- | :----- | :---------- 45m_DynamicBackendsPath | dynamic-backends-path | (Not Available) | String file path | A path in which Arm NN will search for dynamic backends to load. 46m_ProtectedMode | (Not Available) | (Not Available) | ["true"/"false"] | Setting this flag will allow the user to create the Runtime in protected mode. It will run all the inferences on protected memory and will make sure that INetworkProperties::m_ImportEnabled set to true with MemorySource::DmaBufProtected option. This requires that the backend supports Protected Memory and has an allocator capable of allocating Protected Memory associated with it. 47m_CustomAllocatorMap | (Not Available) | (Not Available) | std::map<BackendId, std::shared_ptr<ICustomAllocator>> | A map of Custom Allocator used for allocation of working memory in the backends. Required for Protected Mode in order to correctly allocate Protected Memory 48m_MemoryOptimizerStrategyMap | (Not Available) | (Not Available) | std::map<BackendId, std::shared_ptr<IMemoryOptimizerStrategy>> | A map to define a custom memory optimizer strategy for specific backend Ids. 49m_GpuAccTunedParameters | gpu-tuning-level | cl-tuning-level | ["0"/"1"/"2"/"3"] | 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 50(Not Available) | disable-tflite-runtime-fallback | (Not Available) | ["true"/"false"] | 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. 51armnn::ConfigureLogging | logging-severity | verbose-logging | [Trace/Debug/Info/Warning/Error/Fatal | Set the level of logging information output by Arm NN. 52armnn::IOptimizedNetworkPtr->SerializeToDot | serialize-to-dot | (Not Available) | String file path | Serialize the optimized network to the file specified in "dot" format. 53 54A specific sub-struct of parameters exists to configure external profiling. This is held as a member, m_ProfilingOptions, of CreationOptions 55 56Arm NN Parameter | Delegate | Support library | Values | Description 57:--------------- | :-------- | :-------------- | :----- | :---------- 58m_ProfilingOptions.m_EnableProfiling | enable-external-profiling | (Not Available) | ["true"/"false"] | Enable external profiling. 59m_ProfilingOptions.m_TimelineEnabled | timeline-profiling | (Not Available) | ["true"/"false"] | Enable Arm Development studio Timeline events. 60m_ProfilingOptions.m_OutgoingCaptureFile | outgoing-capture-file | (Not Available) | String file path | Path to a file in which outgoing timeline profiling messages will be stored. 61m_ProfilingOptions.m_IncomingCaptureFile | incoming-capture-file | (Not Available) | String file path | Path to a file in which incoming timeline profiling messages will be stored. 62m_ProfilingOptions.m_FileOnly | file-only-external-profiling | (Not Available) | ["true"/"false"] | Enable profiling output to file only. 63m_ProfilingOptions.m_CapturePeriod | counter-capture-period | (Not Available) | Integer (default : 10000) | Value in microseconds of the profiling capture period. 64m_ProfilingOptions.m_FileFormat | profiling-file-format | (Not Available) | String of ["binary"] | The format of the file used for outputting profiling data. Currently on "binary" is supported. 65 66@subsection networkoptions NetworkOptions 67 68During Network creation you can specify several optional parameters via armnn::NetworkOptions. 69 70Arm NN Parameter | Delegate | Support library | Values | Description 71:--------------- | :-------- | :-------------- | :----- | :---------- 72ShapeInferenceMethod | infer-output-shape | (Not Available) | ["true"/"false"] | Infers output tensor shape from input tensor shape and validate where applicable. 73AllowExpandedDims | allow-expanded-dims | (Not Available) | ["true"/"false"] | If true will disregard dimensions with a size of 1 when validating tensor shapes. Tensor sizes must still match. This is an Experimental parameter that is incompatible with infer-output-shape. 74profilingEnabled | enable-internal-profiling | enable-internal-profiling | ["true"/"false"] | Enable json profiling in CpuAcc and GpuAcc backends. 75detailsMethod | internal-profiling-detail | (Not Available) | ProfilingDetailsMethod | Set the detail of internale porfiling. Options are DetailsWithEvents and DetailsOnly. 76 77@subsection optimizeroptions OptimizerOptions 78 79OptimizerOptions are a set of parameters specifically targeting the Arm NN optimizer. This executes when a model is being loaded and these parameters are used to tune its operation. 80 81Arm NN Parameter | Delegate | Support library | Values | Description 82:--------------- | :-------- | :-------------- | :----- | :---------- 83reduceFp32ToFp16 | reduce-fp32-to-fp16 | (Not available) | ["true"/"false"] | Note This feature works best if all operators of the model are in Fp32. ArmNN will add conversion layers between layers that weren't in Fp32 in the first place or if the operator is not supported in Fp16. The overhead of these conversions can lead to a slower overall performance if too many conversions are required. 84reduceFp32ToBf16 | reduce-fp32-to-bf16 | (Not available) | ["true"/"false"] | This feature has been replaced by enabling Fast Math in compute library backend options. This is currently a placeholder option 85debug | debug-data | (Not available) | ["true"/"false"] | If the debug flag is set a DebugLayer is inserted after each layer. The action of each debug layer is backend specific. 86importEnabled | memory-import | (Not available) | ["true"/"false"] | Instructs the optimizer that this model will be importing it's input tensors. This value must match the MemorySource set for input in INetworkProperties. 87exportEnabled | (Not available) | (Not available) | ["true"/"false"] | Instructs the optimizer that this model will be exporting it's output tensors. This value must match the MemorySource set for output in INetworkProperties. 88 89@subsection modeloptions OptimizerOptions::ModelOptions 90 91Model options is a vector of name value pairs contained inside OptimizerOptions. The options specifically target backends. 92 93@subsection gpuaccmodeloptions GpuAcc backend model options 94 95Arm NN Parameter | Delegate | Support library | Values | Description 96:--------------- | :-------- | :-------------- | :----- | :---------- 97FastMathEnabled | enable-fast-math | enable-fast-math | ["true"/"false"] | Enables fast_math options in backends that support it. 98SaveCachedNetwork| save-cached-network |save-cached-network | ["true"/"false"] | Enables saving the cached network to the file given with cached-network-file option. 99CachedNetworkFilePath| cached-network-filepath |cached-network-file | String file path | If non-empty, the given file will be used to load/save cached network. If save-cached-network option is given will save the cached network to given file. If save-cached-network option is not given will load the cached network from given file. 100MLGOTuningFilePath |gpu-mlgo-tuning-file | mlgo-cl-tuned-parameters-file | String file path | If non-empty, the given file will be used to load/save MLGO CL tuned parameters. 101KernelProfilingEnabled | gpu-kernel-profiling-enabled | (Not available) | ["true"/"false"] | Enables GPU kernel profiling 102 103@subsection cpuaccmodeloptions CpuAcc backend model options 104 105Arm NN Parameter | Delegate | Support library | Values | Description 106:--------------- | :-------- | :-------------- | :--- | :---------- 107FastMathEnabled | enable-fast-math | enable-fast-math | ["true"/"false"] | Enables fast_math options in backends that support it. 108NumberOfThreads | number-of-threads | number-of-threads | Integer [1-64] | Assign the number of threads used by the CpuAcc backend. Input value must be between 1 and 64. Default is set to 0 (Backend will decide number of threads to use). 109 110@subsection ethosnmodeloptions EthosNAcc backend model options 111 112Arm NN Parameter | Delegate | Support library | Values | Description 113:--------------- | :-------- | :-------------- | :--- | :---------- 114DisableWinograd | (Not available) | (Not available) | ["true"/"false"] | Disables Winograd fast convolution. 115StrictPrecision | (Not available) | (Not available) | ["true"/"false"] | When enabled the network is more precise as the Re-quantize operations aren't fused, but it is slower to compile as there will be additional operations. This is currently only supported for the Concat operation. 116SaveCachedNetwork| save-cached-network |save-cached-network | ["true"/"false"] | Enables saving the cached network to the file given with cached-network-file option. 117CachedNetworkFilePath| cached-network-filepath |cached-network-file | String file path | If non-empty, the given file will be used to load/save cached network. If save-cached-network option is given will save the cached network to given file. If save-cached-network option is not given will load the cached network from given file. 118 119**/ 120}