blob: 3e0b0da2f8db45e46b066a528776e1d78c02f5db (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
//
// Copyright © 2017 Arm Ltd. All rights reserved.
// See LICENSE file in the project root for full license information.
//
#include "ArmnnDevice.hpp"
#include <OperationsUtils.h>
#include <log/log.h>
#include <memory>
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
|