* A utility method that populates a DelegateOptions object from this ExecuteNetworkParams. * * @return a populated armnnDelegate::DelegateOptions object. */
| 116 | * @return a populated armnnDelegate::DelegateOptions object. |
| 117 | */ |
| 118 | armnnDelegate::DelegateOptions ExecuteNetworkParams::ToDelegateOptions() const |
| 119 | { |
| 120 | armnnDelegate::DelegateOptions delegateOptions(m_ComputeDevices); |
| 121 | delegateOptions.SetDynamicBackendsPath(m_DynamicBackendsPath); |
| 122 | delegateOptions.SetGpuProfilingState(m_EnableProfiling); |
| 123 | delegateOptions.SetInternalProfilingParams(m_EnableProfiling, armnn::ProfilingDetailsMethod::Undefined); |
| 124 | |
| 125 | if (m_OutputDetailsOnlyToStdOut) |
| 126 | { |
| 127 | delegateOptions.SetInternalProfilingParams(m_EnableProfiling, armnn::ProfilingDetailsMethod::DetailsOnly); |
| 128 | } |
| 129 | else if (m_OutputDetailsToStdOut) |
| 130 | { |
| 131 | delegateOptions.SetInternalProfilingParams(m_EnableProfiling, armnn::ProfilingDetailsMethod::DetailsWithEvents); |
| 132 | } |
| 133 | |
| 134 | // GPU Backend options first. |
| 135 | { |
| 136 | armnn::BackendOptions gpuOption("GpuAcc", {{"TuningLevel", m_TuningLevel}}); |
| 137 | delegateOptions.AddBackendOption(gpuOption); |
| 138 | } |
| 139 | { |
| 140 | armnn::BackendOptions gpuOption("GpuAcc", {{"TuningFile", m_TuningPath.c_str()}}); |
| 141 | delegateOptions.AddBackendOption(gpuOption); |
| 142 | } |
| 143 | { |
| 144 | armnn::BackendOptions gpuOption("GpuAcc", {{"KernelProfilingEnabled", m_EnableProfiling}}); |
| 145 | delegateOptions.AddBackendOption(gpuOption); |
| 146 | } |
| 147 | |
| 148 | // Optimizer options next. |
| 149 | armnn::OptimizerOptionsOpaque optimizerOptions; |
| 150 | optimizerOptions.SetReduceFp32ToFp16(m_EnableFp16TurboMode); |
| 151 | optimizerOptions.SetDebugEnabled(m_PrintIntermediate); |
| 152 | optimizerOptions.SetDebugToFileEnabled(m_PrintIntermediateOutputsToFile); |
| 153 | optimizerOptions.SetProfilingEnabled(m_EnableProfiling); |
| 154 | optimizerOptions.SetShapeInferenceMethod(armnn::ShapeInferenceMethod::ValidateOnly); |
| 155 | if (m_InferOutputShape) |
| 156 | { |
| 157 | optimizerOptions.SetShapeInferenceMethod(armnn::ShapeInferenceMethod::InferAndValidate); |
| 158 | armnn::BackendOptions networkOption("ShapeInferenceMethod", |
| 159 | { |
| 160 | {"InferAndValidate", true} |
| 161 | }); |
| 162 | optimizerOptions.AddModelOption(networkOption); |
| 163 | } |
| 164 | |
| 165 | if (m_EnableLayerDetails) |
| 166 | { |
| 167 | fs::path filename = m_ModelPath; |
| 168 | filename.replace_extension("dot"); |
| 169 | delegateOptions.SetSerializeToDot(filename); |
| 170 | } |
| 171 | |
| 172 | { |
| 173 | armnn::BackendOptions option("GpuAcc", {{"FastMathEnabled", m_EnableFastMath}}); |
| 174 | optimizerOptions.AddModelOption(option); |
| 175 | } |
no test coverage detected