ArmNN
 21.08
IWorkingMemHandle.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2021 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #pragma once
7 
8 #include <mutex>
9 
10 namespace armnn
11 {
12 
13 using NetworkId = int;
14 
15 namespace experimental
16 {
17 
18 struct WorkingMemDescriptor;
19 
21 {
22 public:
23  virtual ~IWorkingMemHandle() {};
24 
25  /// Returns the NetworkId of the Network that this IWorkingMemHandle works with.
26  virtual NetworkId GetNetworkId() = 0;
27 
28  /// Allocate the backing memory required for execution. If this is not called, then allocation will be
29  /// deferred to execution time. The mutex must be locked.
30  virtual void Allocate() = 0;
31 
32  /// Free the backing memory required for execution. The mutex must be locked.
33  virtual void Free() = 0;
34 
35  /// IsAllocated returns true if the backing memory is currently allocated. The mutex must be locked.
36  virtual bool IsAllocated() = 0;
37 
38  /// Get a mutex which can be used for synchronizing access to the WorkingMemHandle object.
39  virtual std::mutex& GetMutex() = 0;
40 
41  /// Get the WorkingMemDescriptor for a Layer. The mutex must be locked.
43 
44  /// Get the WorkingMemDescriptor at an index. The WorkingMemDescriptors are stored in the same order as
45  /// the Workloads in a topologically sorted graph. The mutex must be locked.
46  virtual WorkingMemDescriptor& GetWorkingMemDescriptorAt(unsigned int id) = 0;
47 };
48 
49 } // end experimental namespace
50 
51 } // end armnn namespace
virtual NetworkId GetNetworkId()=0
Returns the NetworkId of the Network that this IWorkingMemHandle works with.
Copyright (c) 2021 ARM Limited and Contributors.
virtual bool IsAllocated()=0
IsAllocated returns true if the backing memory is currently allocated. The mutex must be locked...
virtual void Allocate()=0
Allocate the backing memory required for execution.
virtual std::mutex & GetMutex()=0
Get a mutex which can be used for synchronizing access to the WorkingMemHandle object.
int NetworkId
Definition: IRuntime.hpp:24
virtual void Free()=0
Free the backing memory required for execution. The mutex must be locked.
profiling::ProfilingGuid LayerGuid
Define LayerGuid type.
Definition: Types.hpp:313
virtual WorkingMemDescriptor & GetWorkingMemDescriptorAt(unsigned int id)=0
Get the WorkingMemDescriptor at an index.
virtual WorkingMemDescriptor & GetWorkingMemDescriptor(LayerGuid id)=0
Get the WorkingMemDescriptor for a Layer. The mutex must be locked.