xref: /aosp_15_r20/external/armnn/docs/05_05_runtimeoptions.dox (revision 89c4ff92f2867872bb9e2354d150bf0c8c502810)
1*89c4ff92SAndroid Build Coastguard Worker/// Copyright (c) 2022 ARM Limited and Contributors. All rights reserved.
2*89c4ff92SAndroid Build Coastguard Worker///
3*89c4ff92SAndroid Build Coastguard Worker/// SPDX-License-Identifier: MIT
4*89c4ff92SAndroid Build Coastguard Worker///
5*89c4ff92SAndroid Build Coastguard Worker
6*89c4ff92SAndroid Build Coastguard Workernamespace armnn
7*89c4ff92SAndroid Build Coastguard Worker{
8*89c4ff92SAndroid Build Coastguard Worker/**
9*89c4ff92SAndroid Build Coastguard Worker@page runtimeoptions Runtime options for Arm NN
10*89c4ff92SAndroid Build Coastguard Worker@tableofcontents
11*89c4ff92SAndroid Build Coastguard Worker
12*89c4ff92SAndroid Build Coastguard WorkerAcross all software interfaces to Arm NN there are a set of common
13*89c4ff92SAndroid Build Coastguard Workerconfiguration parameters. These parameters control how a model is loaded or
14*89c4ff92SAndroid Build Coastguard Workerhow the inference is executed. The widest set of options are available at
15*89c4ff92SAndroid Build Coastguard Workerthe lowest, Arm NN C++ interface. They reduce as you move outward to the
16*89c4ff92SAndroid Build Coastguard WorkerTfLite delegate and NNAPI Support Library. The tables below describe the
17*89c4ff92SAndroid Build Coastguard Workerarguments and in which interface they are available.
18*89c4ff92SAndroid Build Coastguard Worker
19*89c4ff92SAndroid Build Coastguard Worker@subsection deviceselection Compute device selection
20*89c4ff92SAndroid Build Coastguard Worker
21*89c4ff92SAndroid Build Coastguard WorkerThe compute device selected is required to be specified across all
22*89c4ff92SAndroid Build Coastguard Workerinterfaces. The device selection will dictate the availability of some
23*89c4ff92SAndroid Build Coastguard Workerparameters and whether some sub graphs are supported.
24*89c4ff92SAndroid Build Coastguard Worker
25*89c4ff92SAndroid Build Coastguard WorkerInterface | Device selection
26*89c4ff92SAndroid Build Coastguard Worker:-------- | :----------
27*89c4ff92SAndroid Build Coastguard WorkerArm 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.
28*89c4ff92SAndroid Build Coastguard WorkerTfLite 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]
29*89c4ff92SAndroid Build Coastguard WorkerSupport 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*89c4ff92SAndroid Build Coastguard Worker
31*89c4ff92SAndroid Build Coastguard Worker@subsection runtimeoptions Runtime options
32*89c4ff92SAndroid Build Coastguard Worker
33*89c4ff92SAndroid Build Coastguard WorkerThere a several levels at which Arm NN accepts runtime parameters. Some of
34*89c4ff92SAndroid Build Coastguard Workerthese are specific to an Arm NN instance, some to a loaded network and some
35*89c4ff92SAndroid Build Coastguard Workerto the backend on which a network inference is to execute. Each of the
36*89c4ff92SAndroid Build Coastguard Workerexternal interfaces handles these options in different ways.
37*89c4ff92SAndroid Build Coastguard Worker
38*89c4ff92SAndroid Build Coastguard Worker@subsection instanceoptions Arm NN Instance level options
39*89c4ff92SAndroid Build Coastguard Worker
40*89c4ff92SAndroid Build Coastguard WorkerIn the Arm NN C++ interface these options are set by passing an armnn::CreationOptions struct to IRuntime.
41*89c4ff92SAndroid Build Coastguard WorkerNot all available options are described here.
42*89c4ff92SAndroid Build Coastguard Worker
43*89c4ff92SAndroid Build Coastguard WorkerArm NN Parameter | Delegate  | Support library | Values | Description
44*89c4ff92SAndroid Build Coastguard Worker:--------------- | :-------- | :-------------- | :----- | :----------
45*89c4ff92SAndroid Build Coastguard Workerm_DynamicBackendsPath | dynamic-backends-path | (Not Available) | String file path | A path in which Arm NN will search for dynamic backends to load.
46*89c4ff92SAndroid Build Coastguard Workerm_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.
47*89c4ff92SAndroid Build Coastguard Workerm_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
48*89c4ff92SAndroid Build Coastguard Workerm_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.
49*89c4ff92SAndroid Build Coastguard Workerm_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*89c4ff92SAndroid Build Coastguard Worker(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.
51*89c4ff92SAndroid Build Coastguard Workerarmnn::ConfigureLogging | logging-severity | verbose-logging | [Trace/Debug/Info/Warning/Error/Fatal | Set the level of logging information output by Arm NN.
52*89c4ff92SAndroid Build Coastguard Workerarmnn::IOptimizedNetworkPtr->SerializeToDot | serialize-to-dot | (Not Available) | String file path | Serialize the optimized network to the file specified in "dot" format.
53*89c4ff92SAndroid Build Coastguard Worker
54*89c4ff92SAndroid Build Coastguard WorkerA specific sub-struct of parameters exists to configure external profiling. This is held as a member, m_ProfilingOptions, of CreationOptions
55*89c4ff92SAndroid Build Coastguard Worker
56*89c4ff92SAndroid Build Coastguard WorkerArm NN Parameter | Delegate  | Support library | Values | Description
57*89c4ff92SAndroid Build Coastguard Worker:--------------- | :-------- | :-------------- | :----- | :----------
58*89c4ff92SAndroid Build Coastguard Workerm_ProfilingOptions.m_EnableProfiling | enable-external-profiling | (Not Available) | ["true"/"false"] | Enable external profiling.
59*89c4ff92SAndroid Build Coastguard Workerm_ProfilingOptions.m_TimelineEnabled | timeline-profiling | (Not Available) | ["true"/"false"] | Enable Arm Development studio Timeline events.
60*89c4ff92SAndroid Build Coastguard Workerm_ProfilingOptions.m_OutgoingCaptureFile | outgoing-capture-file | (Not Available) | String file path | Path to a file in which outgoing timeline profiling messages will be stored.
61*89c4ff92SAndroid Build Coastguard Workerm_ProfilingOptions.m_IncomingCaptureFile | incoming-capture-file | (Not Available) | String file path | Path to a file in which incoming timeline profiling messages will be stored.
62*89c4ff92SAndroid Build Coastguard Workerm_ProfilingOptions.m_FileOnly | file-only-external-profiling | (Not Available) | ["true"/"false"] | Enable profiling output to file only.
63*89c4ff92SAndroid Build Coastguard Workerm_ProfilingOptions.m_CapturePeriod | counter-capture-period | (Not Available) | Integer (default : 10000) | Value in microseconds of the profiling capture period.
64*89c4ff92SAndroid Build Coastguard Workerm_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*89c4ff92SAndroid Build Coastguard Worker
66*89c4ff92SAndroid Build Coastguard Worker@subsection networkoptions NetworkOptions
67*89c4ff92SAndroid Build Coastguard Worker
68*89c4ff92SAndroid Build Coastguard WorkerDuring Network creation you can specify several optional parameters via armnn::NetworkOptions.
69*89c4ff92SAndroid Build Coastguard Worker
70*89c4ff92SAndroid Build Coastguard WorkerArm NN Parameter | Delegate  | Support library | Values | Description
71*89c4ff92SAndroid Build Coastguard Worker:--------------- | :-------- | :-------------- | :----- | :----------
72*89c4ff92SAndroid Build Coastguard WorkerShapeInferenceMethod | infer-output-shape | (Not Available) | ["true"/"false"] | Infers output tensor shape from input tensor shape and validate where applicable.
73*89c4ff92SAndroid Build Coastguard WorkerAllowExpandedDims | 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.
74*89c4ff92SAndroid Build Coastguard WorkerprofilingEnabled | enable-internal-profiling | enable-internal-profiling | ["true"/"false"] | Enable json profiling in CpuAcc and GpuAcc backends.
75*89c4ff92SAndroid Build Coastguard WorkerdetailsMethod | internal-profiling-detail | (Not Available) | ProfilingDetailsMethod | Set the detail of internale porfiling. Options are DetailsWithEvents and DetailsOnly.
76*89c4ff92SAndroid Build Coastguard Worker
77*89c4ff92SAndroid Build Coastguard Worker@subsection optimizeroptions OptimizerOptions
78*89c4ff92SAndroid Build Coastguard Worker
79*89c4ff92SAndroid Build Coastguard WorkerOptimizerOptions 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*89c4ff92SAndroid Build Coastguard Worker
81*89c4ff92SAndroid Build Coastguard WorkerArm NN Parameter | Delegate  | Support library | Values | Description
82*89c4ff92SAndroid Build Coastguard Worker:--------------- | :-------- | :-------------- | :----- | :----------
83*89c4ff92SAndroid Build Coastguard WorkerreduceFp32ToFp16 | 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.
84*89c4ff92SAndroid Build Coastguard WorkerreduceFp32ToBf16 | 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
85*89c4ff92SAndroid Build Coastguard Workerdebug            | 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.
86*89c4ff92SAndroid Build Coastguard WorkerimportEnabled | 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.
87*89c4ff92SAndroid Build Coastguard WorkerexportEnabled | (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*89c4ff92SAndroid Build Coastguard Worker
89*89c4ff92SAndroid Build Coastguard Worker@subsection modeloptions OptimizerOptions::ModelOptions
90*89c4ff92SAndroid Build Coastguard Worker
91*89c4ff92SAndroid Build Coastguard WorkerModel options is a vector of name value pairs contained inside OptimizerOptions. The options specifically target backends.
92*89c4ff92SAndroid Build Coastguard Worker
93*89c4ff92SAndroid Build Coastguard Worker@subsection gpuaccmodeloptions GpuAcc backend model options
94*89c4ff92SAndroid Build Coastguard Worker
95*89c4ff92SAndroid Build Coastguard WorkerArm NN Parameter | Delegate  | Support library | Values | Description
96*89c4ff92SAndroid Build Coastguard Worker:--------------- | :-------- | :-------------- | :----- | :----------
97*89c4ff92SAndroid Build Coastguard WorkerFastMathEnabled  | enable-fast-math | enable-fast-math | ["true"/"false"] | Enables fast_math options in backends that support it.
98*89c4ff92SAndroid Build Coastguard WorkerSaveCachedNetwork| save-cached-network |save-cached-network | ["true"/"false"] | Enables saving the cached network to the file given with cached-network-file option.
99*89c4ff92SAndroid Build Coastguard WorkerCachedNetworkFilePath| 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.
100*89c4ff92SAndroid Build Coastguard WorkerMLGOTuningFilePath |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.
101*89c4ff92SAndroid Build Coastguard WorkerKernelProfilingEnabled | gpu-kernel-profiling-enabled | (Not available) | ["true"/"false"] | Enables GPU kernel profiling
102*89c4ff92SAndroid Build Coastguard Worker
103*89c4ff92SAndroid Build Coastguard Worker@subsection cpuaccmodeloptions CpuAcc backend model options
104*89c4ff92SAndroid Build Coastguard Worker
105*89c4ff92SAndroid Build Coastguard WorkerArm NN Parameter | Delegate  | Support library | Values | Description
106*89c4ff92SAndroid Build Coastguard Worker:--------------- | :-------- | :-------------- | :---   | :----------
107*89c4ff92SAndroid Build Coastguard WorkerFastMathEnabled  | enable-fast-math | enable-fast-math | ["true"/"false"] | Enables fast_math options in backends that support it.
108*89c4ff92SAndroid Build Coastguard WorkerNumberOfThreads  | 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*89c4ff92SAndroid Build Coastguard Worker
110*89c4ff92SAndroid Build Coastguard Worker@subsection ethosnmodeloptions EthosNAcc backend model options
111*89c4ff92SAndroid Build Coastguard Worker
112*89c4ff92SAndroid Build Coastguard WorkerArm NN Parameter | Delegate  | Support library | Values | Description
113*89c4ff92SAndroid Build Coastguard Worker:--------------- | :-------- | :-------------- | :---   | :----------
114*89c4ff92SAndroid Build Coastguard WorkerDisableWinograd  | (Not available) | (Not available) | ["true"/"false"] | Disables Winograd fast convolution.
115*89c4ff92SAndroid Build Coastguard WorkerStrictPrecision  | (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.
116*89c4ff92SAndroid Build Coastguard WorkerSaveCachedNetwork| save-cached-network |save-cached-network | ["true"/"false"] | Enables saving the cached network to the file given with cached-network-file option.
117*89c4ff92SAndroid Build Coastguard WorkerCachedNetworkFilePath| 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*89c4ff92SAndroid Build Coastguard Worker
119*89c4ff92SAndroid Build Coastguard Worker**/
120*89c4ff92SAndroid Build Coastguard Worker}