ArmNN
 24.08
IWorkingMemHandle.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2022 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #pragma once
7 
8 namespace armnn
9 {
10 
11 using NetworkId = int;
12 
13 namespace experimental
14 {
15 
16 struct ExecutionData;
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.
30  virtual void Allocate() = 0;
31 
32  /// Free the backing memory required for execution.
33  virtual void Free() = 0;
34 
35  /// IsAllocated returns true if the backing memory is currently allocated.
36  virtual bool IsAllocated() = 0;
37 
38  /// Get the WorkingMemDescriptor at an index. The WorkingMemDescriptors are stored in the same order as
39  /// the Workloads in a topologically sorted graph.
40  virtual WorkingMemDescriptor& GetWorkingMemDescriptorAt(unsigned int id) = 0;
41 
42  /// Get the ExecutionData at an index.
43  /// The ExecutionData is paired with a BackendId to be able to call backend specific functions upon it.
44  /// The ExecutionData are stored in the same order as the Workloads in a topologically sorted graph.
45  virtual std::pair<BackendId, ExecutionData>& GetExecutionDataAt(unsigned int id) = 0;
46 };
47 
48 } // end experimental namespace
49 
50 } // end armnn namespace
armnn::experimental::IWorkingMemHandle::Free
virtual void Free()=0
Free the backing memory required for execution.
armnn::experimental::IWorkingMemHandle::GetNetworkId
virtual NetworkId GetNetworkId()=0
Returns the NetworkId of the Network that this IWorkingMemHandle works with.
armnn::experimental::IWorkingMemHandle::~IWorkingMemHandle
virtual ~IWorkingMemHandle()
Definition: IWorkingMemHandle.hpp:23
armnn::experimental::IWorkingMemHandle
Definition: IWorkingMemHandle.hpp:20
armnn::experimental::IWorkingMemHandle::GetExecutionDataAt
virtual std::pair< BackendId, ExecutionData > & GetExecutionDataAt(unsigned int id)=0
Get the ExecutionData at an index.
armnn::NetworkId
int NetworkId
Definition: IRuntime.hpp:35
armnn::experimental::IWorkingMemHandle::Allocate
virtual void Allocate()=0
Allocate the backing memory required for execution.
armnn::experimental::IWorkingMemHandle::GetWorkingMemDescriptorAt
virtual WorkingMemDescriptor & GetWorkingMemDescriptorAt(unsigned int id)=0
Get the WorkingMemDescriptor at an index.
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::experimental::WorkingMemDescriptor
Definition: WorkingMemDescriptor.hpp:18
armnn::experimental::IWorkingMemHandle::IsAllocated
virtual bool IsAllocated()=0
IsAllocated returns true if the backing memory is currently allocated.