From ce3e84a8d449cbf31cee57e30f0eef6a96c0ce94 Mon Sep 17 00:00:00 2001 From: telsoa01 Date: Fri, 31 Aug 2018 09:31:35 +0100 Subject: Release 18.08 --- ArmnnDevice.cpp | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 ArmnnDevice.cpp (limited to 'ArmnnDevice.cpp') diff --git a/ArmnnDevice.cpp b/ArmnnDevice.cpp new file mode 100644 index 00000000..3e0b0da2 --- /dev/null +++ b/ArmnnDevice.cpp @@ -0,0 +1,65 @@ +// +// Copyright © 2017 Arm Ltd. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +#include "ArmnnDevice.hpp" + +#include + +#include + +#include + +using namespace android; + +namespace armnn_driver +{ + +ArmnnDevice::ArmnnDevice(DriverOptions options) + : m_Runtime(nullptr, nullptr) + , m_ClTunedParameters(nullptr) + , m_Options(std::move(options)) +{ + ALOGV("ArmnnDevice::ArmnnDevice()"); + + armnn::ConfigureLogging(false, m_Options.IsVerboseLoggingEnabled(), armnn::LogSeverity::Trace); + if (m_Options.IsVerboseLoggingEnabled()) + { + SetMinimumLogSeverity(base::VERBOSE); + } + else + { + SetMinimumLogSeverity(base::INFO); + } + + try + { + armnn::IRuntime::CreationOptions options; + if (!m_Options.GetClTunedParametersFile().empty()) + { + m_ClTunedParameters = armnn::IGpuAccTunedParameters::Create(m_Options.GetClTunedParametersMode()); + try + { + m_ClTunedParameters->Load(m_Options.GetClTunedParametersFile().c_str()); + } + catch (const armnn::Exception& error) + { + // This is only a warning because the file won't exist the first time you are generating it. + ALOGW("ArmnnDevice: Failed to load CL tuned parameters file '%s': %s", + m_Options.GetClTunedParametersFile().c_str(), error.what()); + } + options.m_GpuAccTunedParameters = m_ClTunedParameters; + } + + options.m_EnableGpuProfiling = m_Options.IsGpuProfilingEnabled(); + + m_Runtime = armnn::IRuntime::Create(options); + } + catch (const armnn::ClRuntimeUnavailableException& error) + { + ALOGE("ArmnnDevice: Failed to setup CL runtime: %s. Device will be unavailable.", error.what()); + } +} + +} // namespace armnn_driver -- cgit v1.2.1