diff options
author | Sadik Armagan <sadik.armagan@arm.com> | 2022-08-04 15:56:05 +0100 |
---|---|---|
committer | Nikhil Raj <nikhil.raj@arm.com> | 2022-08-05 15:54:14 +0100 |
commit | a5c8fd60194dd6cf19d469bc7654da0886fd8f99 (patch) | |
tree | aafe3b1a3bc4765fa51b3f0a8dcf379f95b164d7 /shim | |
parent | bdf0ebeebfb93445b788ce25026cf34259da1349 (diff) | |
download | armnn-a5c8fd60194dd6cf19d469bc7654da0886fd8f99.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
Diffstat (limited to 'shim')
-rw-r--r-- | shim/sl/canonical/ArmnnDevice.cpp | 50 |
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); |