diff options
author | Finn Williams <Finn.Williams@arm.com> | 2021-02-11 16:16:42 +0000 |
---|---|---|
committer | KeithARM <keith.davis@arm.com> | 2021-02-15 15:04:31 +0000 |
commit | 406463269f55a5baefb941b51e10f423f6d3250a (patch) | |
tree | 2299b75c47cae44d9c8be4bf670f30c9d65a01a8 /src/backends/cl/ClBackendContext.cpp | |
parent | b55d366a93d8d3699ce5e906134c695c8040c27e (diff) | |
download | armnn-406463269f55a5baefb941b51e10f423f6d3250a.tar.gz |
IVGCVSW-5686 Add GpuAcc MLGO tuning file configuration argument
Signed-off-by: Finn Williams <Finn.Williams@arm.com>
Change-Id: I3f320499c379162f9d1b00cc8816bd144cd7eee4
Diffstat (limited to 'src/backends/cl/ClBackendContext.cpp')
-rw-r--r-- | src/backends/cl/ClBackendContext.cpp | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/backends/cl/ClBackendContext.cpp b/src/backends/cl/ClBackendContext.cpp index 125f01b627..9c5cca9d3a 100644 --- a/src/backends/cl/ClBackendContext.cpp +++ b/src/backends/cl/ClBackendContext.cpp @@ -21,8 +21,9 @@ namespace armnn struct ClBackendContext::ClContextControlWrapper { ClContextControlWrapper(arm_compute::CLTuner* tuner, + arm_compute::CLGEMMHeuristicsHandle* heuristicsHandle, bool profilingEnabled) - : m_ClContextControl(tuner, profilingEnabled) + : m_ClContextControl(tuner, heuristicsHandle, profilingEnabled) {} bool Sync() @@ -143,6 +144,7 @@ ClBackendContext::ClBackendContext(const IRuntime::CreationOptions& options) bool kernelProfiling = options.m_EnableGpuProfiling; arm_compute::CLTuner* tuner = nullptr; + arm_compute::CLGEMMHeuristicsHandle* mlgoTuner = nullptr; bool useLegacyTunerAPI = options.m_GpuAccTunedParameters.get() != nullptr; if (useLegacyTunerAPI) { @@ -197,6 +199,10 @@ ClBackendContext::ClBackendContext(const IRuntime::CreationOptions& options) { tuningLevel = ParseTuningLevel(value, defaultTuningLevel); } + else if (name == "MLGOTuningFilePath") + { + m_MLGOTuningFile = ParseFile(value, ""); + } }); // Create the tuner, in tuning mode initially. @@ -216,13 +222,31 @@ ClBackendContext::ClBackendContext(const IRuntime::CreationOptions& options) ARMNN_LOG(warning) << "Could not load GpuAcc tuner data file."; } } + + if (!m_MLGOTuningFile.empty()) + { + try + { + ARMNN_LOG(info) << "Loading Gpu MLGO tuning data from file: " << m_TuningFile; + if(m_MLGOTuner.reload_from_file(m_MLGOTuningFile.c_str())) + { + mlgoTuner = &m_MLGOTuner; + } + } + catch (const std::exception& e) + { + ARMNN_LOG(warning) << "Could not load GpuAcc MLGO tuner data file."; + } + } + tuner = m_Tuner.get(); } m_ClContextControlWrapper = std::make_unique<ClContextControlWrapper>( tuner, + mlgoTuner, kernelProfiling - ); + ); } bool ClBackendContext::BeforeLoadNetwork(NetworkId) |