ArmNN
 21.05
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  /// Returns the InferenceId of the Inference that this IWorkingMemHandle works with.
30 
31  /// Allocate the backing memory required for execution. If this is not called, then allocation will be
32  /// deferred to execution time. The mutex must be locked.
33  virtual void Allocate() = 0;
34 
35  /// Free the backing memory required for execution. The mutex must be locked.
36  virtual void Free() = 0;
37 
38  /// IsAllocated returns true if the backing memory is currently allocated. The mutex must be locked.
39  virtual bool IsAllocated() = 0;
40 
41  /// Get a mutex which can be used for synchronizing access to the WorkingMemHandle object.
42  virtual std::mutex& GetMutex() = 0;
43 
44  /// Get the WorkingMemDescriptor for a Layer. The mutex must be locked.
46 
47  /// Get the WorkingMemDescriptor at an index. The WorkingMemDescriptors are stored in the same order as
48  /// the Workloads in a topologically sorted graph. The mutex must be locked.
49  virtual WorkingMemDescriptor& GetWorkingMemDescriptorAt(unsigned int id) = 0;
50 };
51 
52 } // end experimental namespace
53 
54 } // 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:22
virtual void Free()=0
Free the backing memory required for execution. The mutex must be locked.
virtual profiling::ProfilingGuid GetInferenceId()=0
Returns the InferenceId of the Inference that this IWorkingMemHandle works with.
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.