ArmNN
 24.08
ArmComputeTuningUtils.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2023 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
7 
8 namespace armnn
9 {
10 
13 {
14  return new ClTunedParameters(mode, tuningLevel);
15 }
16 
19 {
21 }
22 
24 {
25  delete params;
26 }
27 
30  : m_Mode(mode)
31  , m_TuningLevel(tuningLevel)
32  , m_Tuner(mode == ClTunedParameters::Mode::UpdateTunedParameters)
33 {
34 }
35 
36 void ClTunedParameters::Load(const char* filename)
37 {
38  try
39  {
40  m_Tuner.load_from_file(filename);
41  }
42  catch (const std::exception& e)
43  {
44  throw Exception(std::string("Failed to load tuned parameters file '") + filename + "': " + e.what());
45  }
46 }
47 
48 void ClTunedParameters::Save(const char* filename) const
49 {
50  try
51  {
52  m_Tuner.save_to_file(filename);
53  }
54  catch (const std::exception& e)
55  {
56  throw Exception(std::string("Failed to save tuned parameters file to '") + filename + "': " + e.what());
57  }
58 }
59 
60 }
armnn::IGpuAccTunedParameters::Mode
Mode
Definition: IRuntime.hpp:317
armnn::ClTunedParameters::ClTunedParameters
ClTunedParameters(IGpuAccTunedParameters::Mode mode, IGpuAccTunedParameters::TuningLevel tuningLevel)
Definition: ArmComputeTuningUtils.cpp:28
armnn::IGpuAccTunedParameters::Create
static IGpuAccTunedParametersPtr Create(Mode mode, TuningLevel tunerMode)
Definition: ArmComputeTuningUtils.cpp:17
armnn::IGpuAccTunedParameters::TuningLevel
TuningLevel
Definition: IRuntime.hpp:323
armnn::ClTunedParameters::m_Tuner
arm_compute::CLTuner m_Tuner
Definition: ArmComputeTuningUtils.hpp:80
armnn::ClTunedParameters
Definition: ArmComputeTuningUtils.hpp:69
armnn::IGpuAccTunedParameters::Destroy
static void Destroy(IGpuAccTunedParameters *params)
Definition: ArmComputeTuningUtils.cpp:23
armnn::ClTunedParameters::Load
virtual void Load(const char *filename)
Loads an existing set of tuned parameters from the given file.
Definition: ArmComputeTuningUtils.cpp:36
armnn::Exception
Base class for all ArmNN exceptions so that users can filter to just those.
Definition: Exceptions.hpp:46
armnn::ClTunedParameters::Save
virtual void Save(const char *filename) const
Saves the current set of tuned parameters to the given file.
Definition: ArmComputeTuningUtils.cpp:48
armnn::IGpuAccTunedParameters::CreateRaw
static IGpuAccTunedParameters * CreateRaw(Mode mode, TuningLevel tunerMode)
Creates an IClTunedParameters with the given mode.
Definition: ArmComputeTuningUtils.cpp:11
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::IGpuAccTunedParametersPtr
std::shared_ptr< IGpuAccTunedParameters > IGpuAccTunedParametersPtr
The following API is replaced by the backend options API.
Definition: IRuntime.hpp:301
ArmComputeTuningUtils.hpp
armnn::IGpuAccTunedParameters
Manages a set of GpuAcc parameters which have been tuned for maximum performance.
Definition: IRuntime.hpp:314