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 20 class IWorkingMemHandle 21 { 22 public: ~IWorkingMemHandle()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 51