blob: 4680541ae54a8564a9761ac804db13943a64a349 (
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
|
//
// Copyright © 2023 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "ArmComputeTuningUtils.hpp"
namespace armnn
{
IGpuAccTunedParameters* IGpuAccTunedParameters::CreateRaw(IGpuAccTunedParameters::Mode mode,
IGpuAccTunedParameters::TuningLevel tuningLevel)
{
return new ClTunedParameters(mode, tuningLevel);
}
IGpuAccTunedParametersPtr IGpuAccTunedParameters::Create(IGpuAccTunedParameters::Mode mode,
IGpuAccTunedParameters::TuningLevel tuningLevel)
{
return IGpuAccTunedParametersPtr(CreateRaw(mode, tuningLevel), &IGpuAccTunedParameters::Destroy);
}
void IGpuAccTunedParameters::Destroy(IGpuAccTunedParameters* params)
{
delete params;
}
ClTunedParameters::ClTunedParameters(IGpuAccTunedParameters::Mode mode,
IGpuAccTunedParameters::TuningLevel tuningLevel)
: m_Mode(mode)
, m_TuningLevel(tuningLevel)
, m_Tuner(mode == ClTunedParameters::Mode::UpdateTunedParameters)
{
}
void ClTunedParameters::Load(const char* filename)
{
try
{
m_Tuner.load_from_file(filename);
}
catch (const std::exception& e)
{
throw Exception(std::string("Failed to load tuned parameters file '") + filename + "': " + e.what());
}
}
void ClTunedParameters::Save(const char* filename) const
{
try
{
m_Tuner.save_to_file(filename);
}
catch (const std::exception& e)
{
throw Exception(std::string("Failed to save tuned parameters file to '") + filename + "': " + e.what());
}
}
}
|