aboutsummaryrefslogtreecommitdiff
path: root/src/backends/aclCommon/ArmComputeTuningUtils.cpp
diff options
context:
space:
mode:
authorCathal Corbett <cathal.corbett@arm.com>2023-01-11 13:03:21 +0000
committerCathal Corbett <cathal.corbett@arm.com>2023-01-11 16:39:24 +0000
commitd9e55f05847792edbbf6a8c2c4d3901d37f63d1f (patch)
treedc090a997991ef97dfc976eea24cfba1f732ea68 /src/backends/aclCommon/ArmComputeTuningUtils.cpp
parent9c843c3e99a8cb1951399171ceddb01c43924fa2 (diff)
downloadarmnn-d9e55f05847792edbbf6a8c2c4d3901d37f63d1f.tar.gz
Move tuning and IClTensorHandle code from cl to aclCommon backend.
* Required to enable easier future merging and rebase into experimental/GpuFsa as part of IVGCVSW-7380. Signed-off-by: Cathal Corbett <cathal.corbett@arm.com> Change-Id: I066dcf00523ff430a0908666e452548ab848bd86
Diffstat (limited to 'src/backends/aclCommon/ArmComputeTuningUtils.cpp')
-rw-r--r--src/backends/aclCommon/ArmComputeTuningUtils.cpp60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/backends/aclCommon/ArmComputeTuningUtils.cpp b/src/backends/aclCommon/ArmComputeTuningUtils.cpp
new file mode 100644
index 0000000000..4680541ae5
--- /dev/null
+++ b/src/backends/aclCommon/ArmComputeTuningUtils.cpp
@@ -0,0 +1,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());
+ }
+}
+
+} \ No newline at end of file