aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadik Armagan <sadik.armagan@arm.com>2022-08-04 15:56:05 +0100
committerSadik Armagan <sadik.armagan@arm.com>2022-08-04 15:04:10 +0000
commit9bb7ebe53a9ed152b857c7295d80bf824112765c (patch)
treeaafe3b1a3bc4765fa51b3f0a8dcf379f95b164d7
parent27f0aa8fa12a734f53b5e5c6eaf774b330e3c1f7 (diff)
downloadarmnn-9bb7ebe53a9ed152b857c7295d80bf824112765c.tar.gz
IVGCVSW-7062 'Gpu Tuning does not work with TfLite Benchmark tool'
* Load the tuning file when GpuAcc is selected as a backend. Signed-off-by: Sadik Armagan <sadik.armagan@arm.com> Change-Id: I1d6b0237a87301f07681293a2c6dbc37e352dd28
-rw-r--r--shim/sl/canonical/ArmnnDevice.cpp50
1 files changed, 26 insertions, 24 deletions
diff --git a/shim/sl/canonical/ArmnnDevice.cpp b/shim/sl/canonical/ArmnnDevice.cpp
index c40482246b..0017973b50 100644
--- a/shim/sl/canonical/ArmnnDevice.cpp
+++ b/shim/sl/canonical/ArmnnDevice.cpp
@@ -74,38 +74,40 @@ ArmnnDevice::ArmnnDevice(DriverOptions options)
{
SetMinimumLogSeverity(android::base::INFO);
}
-
armnn::IRuntime::CreationOptions runtimeOptions;
-#if defined(ARMCOMPUTECL_ENABLED)
- try
+ if (std::find(m_Options.GetBackends().begin(),
+ m_Options.GetBackends().end(),
+ armnn::Compute::GpuAcc) != m_Options.GetBackends().end())
{
- if (!m_Options.GetClTunedParametersFile().empty())
+ try
{
- m_ClTunedParameters = armnn::IGpuAccTunedParameters::Create(m_Options.GetClTunedParametersMode(),
- m_Options.GetClTuningLevel());
- try
- {
- m_ClTunedParameters->Load(m_Options.GetClTunedParametersFile().c_str());
- }
- catch (std::exception& error)
+ if (!m_Options.GetClTunedParametersFile().empty())
{
- // This is only a warning because the file won't exist the first time you are generating it.
- VLOG(DRIVER) << "ArmnnDevice: Failed to load CL tuned parameters file "
- << m_Options.GetClTunedParametersFile().c_str() << " : " << error.what());
+ m_ClTunedParameters = armnn::IGpuAccTunedParameters::Create(m_Options.GetClTunedParametersMode(),
+ m_Options.GetClTuningLevel());
+ try
+ {
+ m_ClTunedParameters->Load(m_Options.GetClTunedParametersFile().c_str());
+ }
+ catch (std::exception& error)
+ {
+ // This is only a warning because the file won't exist the first time you are generating it.
+ VLOG(DRIVER) << "ArmnnDevice: Failed to load CL tuned parameters file "
+ << m_Options.GetClTunedParametersFile().c_str() << " : " << error.what();
+ }
+ runtimeOptions.m_GpuAccTunedParameters = m_ClTunedParameters;
}
- runtimeOptions.m_GpuAccTunedParameters = m_ClTunedParameters;
+ }
+ catch (const armnn::ClRuntimeUnavailableException& error)
+ {
+ VLOG(DRIVER) << "ArmnnDevice: Failed to setup CL runtime: %s. Device will be unavailable." << error.what();
+ }
+ catch (std::exception& error)
+ {
+ VLOG(DRIVER) << "ArmnnDevice: Unknown exception: %s. Device will be unavailable." << error.what();
}
}
- catch (const armnn::ClRuntimeUnavailableException& error)
- {
- VLOG(DRIVER) << "ArmnnDevice: Failed to setup CL runtime: %s. Device will be unavailable." << error.what();
- }
- catch (std::exception& error)
- {
- VLOG(DRIVER) << "ArmnnDevice: Unknown exception: %s. Device will be unavailable." << error.what();
- }
-#endif
runtimeOptions.m_EnableGpuProfiling = m_Options.IsGpuProfilingEnabled();
m_Runtime = armnn::IRuntime::Create(runtimeOptions);