aboutsummaryrefslogtreecommitdiff
path: root/include/armnn/IWorkingMemHandle.hpp
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 /include/armnn/IWorkingMemHandle.hpp
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 'include/armnn/IWorkingMemHandle.hpp')
-rw-r--r--include/armnn/IWorkingMemHandle.hpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/include/armnn/IWorkingMemHandle.hpp b/include/armnn/IWorkingMemHandle.hpp
new file mode 100644
index 0000000000..921b7e1f40
--- /dev/null
+++ b/include/armnn/IWorkingMemHandle.hpp
@@ -0,0 +1,46 @@
+//
+// Copyright © 2021 Arm Ltd and Contributors. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#pragma once
+
+#include <mutex>
+
+namespace armnn
+{
+
+namespace experimental
+{
+
+struct WorkingMemDescriptor;
+
+class IWorkingMemHandle
+{
+public:
+ virtual ~IWorkingMemHandle() {};
+
+ /// Allocate the backing memory required for execution. If this is not called, then allocation will be
+ /// deferred to execution time. The mutex must be locked.
+ virtual void Allocate() = 0;
+
+ /// Free the backing memory required for execution. The mutex must be locked.
+ virtual void Free() = 0;
+
+ /// IsAllocated returns true if the backing memory is currently allocated. The mutex must be locked.
+ virtual bool IsAllocated() = 0;
+
+ /// Get a mutex which can be used for synchronizing access to the WorkingMemHandle object.
+ virtual std::mutex& GetMutex() = 0;
+
+ /// Get the WorkingMemDescriptor for a Layer. The mutex must be locked.
+ virtual WorkingMemDescriptor& GetWorkingMemDescriptor(LayerGuid id) = 0;
+
+ /// Get the WorkingMemDescriptor at an index. The WorkingMemDescriptors are stored in the same order as
+ /// the Workloads in a topologically sorted graph. The mutex must be locked.
+ virtual WorkingMemDescriptor& GetWorkingMemDescriptorAt(unsigned int id) = 0;
+};
+
+} // end experimental namespace
+
+} // end armnn namespace