aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/WorkingMemHandle.cpp
diff options
context:
space:
mode:
authorMike Kelly <mike.kelly@arm.com>2021-03-29 15:04:50 +0100
committermike.kelly <mike.kelly@arm.com>2021-03-29 14:03:30 +0000
commit386ff1a721cdca3689b009ba31f2d3ac8bea2fae (patch)
treee2f5c26ab2601fd0be8c1223111f55cf1ff94e6e /src/armnn/WorkingMemHandle.cpp
parent23dbe3d3ff51c2b297ce5bf6360da6552f1c3bf5 (diff)
downloadarmnn-386ff1a721cdca3689b009ba31f2d3ac8bea2fae.tar.gz
IVGCVSW-5790 Merge async prototype
* Added thread safe execution mechanism for armnn * Removed duplicate function bool Compare(T a, T b, float tolerance) * Added StridedSliceAsyncEndToEndTest * Fixed memory leak Signed-off-by: Mike Kelly <mike.kelly@arm.com> Change-Id: I2d367fc77ee7c01b8953138543e76af5e691211f
Diffstat (limited to 'src/armnn/WorkingMemHandle.cpp')
-rw-r--r--src/armnn/WorkingMemHandle.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/armnn/WorkingMemHandle.cpp b/src/armnn/WorkingMemHandle.cpp
new file mode 100644
index 0000000000..7a901b296b
--- /dev/null
+++ b/src/armnn/WorkingMemHandle.cpp
@@ -0,0 +1,49 @@
+//
+// Copyright © 2021 Arm Ltd and Contributors. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#include "backendsCommon/CpuTensorHandle.hpp"
+#include "WorkingMemHandle.hpp"
+#include "Network.hpp"
+
+namespace armnn
+{
+
+namespace experimental
+{
+
+WorkingMemHandle::WorkingMemHandle(std::vector<WorkingMemDescriptor> workingMemDescriptors,
+ std::unordered_map<LayerGuid, WorkingMemDescriptor> workingMemDescriptorMap) :
+ m_WorkingMemDescriptors(workingMemDescriptors),
+ m_WorkingMemDescriptorMap(workingMemDescriptorMap),
+ m_IsAllocated(false),
+ m_Mutex()
+{}
+
+void WorkingMemHandle::FreeWorkingMemory()
+{
+ for (auto workingMemDescriptor : m_WorkingMemDescriptors)
+ {
+ for (auto input : workingMemDescriptor.m_Inputs)
+ {
+ if (input)
+ {
+ delete input;
+ input = nullptr;
+ }
+ }
+ for (auto output : workingMemDescriptor.m_Outputs)
+ {
+ if (output)
+ {
+ delete output;
+ output = nullptr;
+ }
+ }
+ }
+}
+
+} // end experimental namespace
+
+} // end armnn namespace