21.11
|
#include <LoadedNetwork.hpp>
Public Types | |
using | WorkloadQueue = std::vector< std::unique_ptr< IWorkload > > |
Public Member Functions | |
~LoadedNetwork () | |
std::unique_ptr< IWorkingMemHandle > | CreateWorkingMemHandle (NetworkId networkId) |
Create a new unique WorkingMemHandle object. More... | |
TensorInfo | GetInputTensorInfo (LayerBindingId layerId) const |
TensorInfo | GetOutputTensorInfo (LayerBindingId layerId) const |
std::vector< ImportedInputId > | ImportInputs (const InputTensors &inputTensors) |
std::vector< ImportedOutputId > | ImportOutputs (const OutputTensors &outputTensors) |
void | ClearImportedInputs (const std::vector< ImportedInputId > inputIds) |
void | ClearImportedOutputs (const std::vector< ImportedOutputId > outputIds) |
Status | EnqueueWorkload (const InputTensors &inputTensors, const OutputTensors &outputTensors) |
Single thread execution of the loaded network. More... | |
Status | Execute (const InputTensors &inputTensors, const OutputTensors &outputTensors, IWorkingMemHandle &workingMemHandle, std::vector< ImportedInputId > preImportedInputs={}, std::vector< ImportedOutputId > preImportedOutputs={}) |
Thread safe execution of the loaded network. More... | |
const std::shared_ptr< IProfiler > & | GetProfiler () const |
void | FreeWorkingMemory () |
void | RegisterDebugCallback (const DebugCallbackFunction &func) |
void | SendNetworkStructure () |
bool | IsAsyncEnabled () |
profiling::ProfilingGuid | GetNetworkGuid () |
Static Public Member Functions | |
static std::unique_ptr< LoadedNetwork > | MakeLoadedNetwork (std::unique_ptr< IOptimizedNetwork > net, std::string &errorMessage, const INetworkProperties &networkProperties, profiling::ProfilingService &profilingService) |
Definition at line 41 of file LoadedNetwork.hpp.
using WorkloadQueue = std::vector<std::unique_ptr<IWorkload> > |
Definition at line 44 of file LoadedNetwork.hpp.
|
inline |
Definition at line 46 of file LoadedNetwork.hpp.
void ClearImportedInputs | ( | const std::vector< ImportedInputId > | inputIds | ) |
Definition at line 1241 of file LoadedNetwork.cpp.
Referenced by RuntimeImpl::ClearImportedInputs().
void ClearImportedOutputs | ( | const std::vector< ImportedOutputId > | outputIds | ) |
Definition at line 1262 of file LoadedNetwork.cpp.
Referenced by RuntimeImpl::ClearImportedOutputs().
std::unique_ptr< IWorkingMemHandle > CreateWorkingMemHandle | ( | NetworkId | networkId | ) |
Create a new unique WorkingMemHandle object.
Create multiple handles if you wish to have overlapped Execution by calling this function from different threads.
Definition at line 1505 of file LoadedNetwork.cpp.
References ARMNN_ASSERT, ARMNN_NO_DEPRECATE_WARN_BEGIN, ARMNN_NO_DEPRECATE_WARN_END, ITensorHandleFactory::CreateTensorHandle(), Layer::GetBackendId(), and ITensorHandleFactory::LegacyFactoryId.
Referenced by RuntimeImpl::CreateWorkingMemHandle().
Status EnqueueWorkload | ( | const InputTensors & | inputTensors, |
const OutputTensors & | outputTensors | ||
) |
Single thread execution of the loaded network.
Definition at line 636 of file LoadedNetwork.cpp.
References ARMNN_ASSERT_MSG, ARMNN_LOG, ARMNN_SCOPED_HEAP_PROFILING, ARMNN_SCOPED_PROFILING_EVENT, armnn::CheckFlag(), armnn::Failure, ITensorHandle::GetImportFlags(), Graph::GetInputLayers(), Layer::GetInputSlots(), Graph::GetNumInputs(), Layer::GetNumInputSlots(), Graph::GetNumLayers(), Graph::GetNumOutputs(), Layer::GetNumOutputSlots(), Layer::GetOutputHandler(), Graph::GetOutputLayers(), TimelineUtilityMethods::GetTimelineUtils(), Layer::GetType(), armnn::IgnoreUnused(), ITensorHandle::Import(), armnn::info, armnn::Input, QueueDescriptor::m_Inputs, WorkloadInfo::m_InputTensorInfos, QueueDescriptor::m_Outputs, WorkloadInfo::m_OutputTensorInfos, ITensorHandle::Map(), armnn::Output, armnn::Success, armnn::Undefined, ITensorHandle::Unmap(), and armnn::warning.
Referenced by RuntimeImpl::EnqueueWorkload().
Status Execute | ( | const InputTensors & | inputTensors, |
const OutputTensors & | outputTensors, | ||
IWorkingMemHandle & | workingMemHandle, | ||
std::vector< ImportedInputId > | preImportedInputs = {} , |
||
std::vector< ImportedOutputId > | preImportedOutputs = {} |
||
) |
Thread safe execution of the loaded network.
Definition at line 1283 of file LoadedNetwork.cpp.
References WorkingMemHandle::Allocate(), ARMNN_LOG, ARMNN_SCOPED_PROFILING_EVENT, armnn::CopyToOutputTensor(), armnn::error, armnn::Failure, WorkingMemHandle::GetBindingIdVector(), WorkingMemHandle::GetInputConnections(), WorkingMemHandle::GetInputHandle(), Graph::GetNumInputs(), Graph::GetNumOutputs(), WorkingMemHandle::GetOutputConnection(), WorkingMemHandle::GetOutputHandle(), TimelineUtilityMethods::GetTimelineUtils(), WorkingMemHandle::GetWorkingMemDescriptorAt(), WorkingMemHandle::IsAllocated(), WorkingMemHandle::MemSyncOutputs(), armnn::profiling::RetentionLink, armnn::Success, armnn::Undefined, and WorkingMemHandle::ValidateBindingIds().
Referenced by RuntimeImpl::Execute(), and LoadedNetwork::FreeWorkingMemory().
void FreeWorkingMemory | ( | ) |
Definition at line 902 of file LoadedNetwork.cpp.
References ARMNN_ASSERT_MSG, ARMNN_LOG, armnn::CheckFlag(), armnn::CopyTensorContentsGeneric(), armnn::error, LoadedNetwork::Execute(), ITensorHandle::GetImportFlags(), BaseTensor< MemoryType >::GetInfo(), BaseTensor< MemoryType >::GetMemoryArea(), ITensorHandle::Import(), and ITensorHandle::Map().
Referenced by RuntimeImpl::CreateWorkingMemHandle(), and RuntimeImpl::EnqueueWorkload().
TensorInfo GetInputTensorInfo | ( | LayerBindingId | layerId | ) | const |
Definition at line 487 of file LoadedNetwork.cpp.
References ARMNN_ASSERT_MSG.
Referenced by RuntimeImpl::GetInputTensorInfo().
profiling::ProfilingGuid GetNetworkGuid | ( | ) |
Definition at line 482 of file LoadedNetwork.cpp.
TensorInfo GetOutputTensorInfo | ( | LayerBindingId | layerId | ) | const |
Definition at line 501 of file LoadedNetwork.cpp.
References ARMNN_ASSERT_MSG, CHECK_LOCATION, BackendId::Get(), Layer::GetBackendId(), Layer::GetNameStr(), armnn::IgnoreUnused(), armnn::info, and IWorkloadFactory::IsLayerSupported().
Referenced by RuntimeImpl::GetOutputTensorInfo().
|
inline |
Definition at line 82 of file LoadedNetwork.hpp.
Referenced by RuntimeImpl::CreateWorkingMemHandle(), RuntimeImpl::EnqueueWorkload(), and RuntimeImpl::Execute().
std::vector< ImportedInputId > ImportInputs | ( | const InputTensors & | inputTensors | ) |
Definition at line 1090 of file LoadedNetwork.cpp.
References ARMNN_ASSERT, Graph::InputLayersAccessor::begin(), armnn::CheckFlag(), ITensorHandleFactory::CreateTensorHandle(), Graph::InputLayersAccessor::end(), Layer::GetBackendId(), BindableLayer::GetBindingId(), ITensorHandle::GetImportFlags(), BaseTensor< MemoryType >::GetInfo(), Graph::GetInputLayers(), BaseTensor< MemoryType >::GetMemoryArea(), Layer::GetOutputSlots(), OutputSlot::GetTensorHandleFactoryId(), OutputSlot::GetTensorInfo(), Layer::GetType(), armnn::HasCapability(), ITensorHandle::Import(), armnn::Input, and Graph::TopologicalSort().
Referenced by RuntimeImpl::ImportInputs().
std::vector< ImportedOutputId > ImportOutputs | ( | const OutputTensors & | outputTensors | ) |
Definition at line 1169 of file LoadedNetwork.cpp.
References ARMNN_ASSERT, Graph::OutputLayersAccessor::begin(), armnn::CheckFlag(), ITensorHandleFactory::CreateTensorHandle(), Graph::OutputLayersAccessor::end(), Layer::GetBackendId(), BindableLayer::GetBindingId(), InputSlot::GetConnectedOutputSlot(), ITensorHandle::GetImportFlags(), Layer::GetInputSlots(), BaseTensor< MemoryType >::GetMemoryArea(), Graph::GetOutputLayers(), OutputSlot::GetTensorHandleFactoryId(), OutputSlot::GetTensorInfo(), Layer::GetType(), armnn::HasCapability(), ITensorHandle::Import(), armnn::Output, and Graph::TopologicalSort().
Referenced by RuntimeImpl::ImportOutputs().
|
inline |
Definition at line 90 of file LoadedNetwork.hpp.
Referenced by RuntimeImpl::CreateWorkingMemHandle(), RuntimeImpl::EnqueueWorkload(), and RuntimeImpl::Execute().
|
static |
Definition at line 82 of file LoadedNetwork.cpp.
References ITensorHandle::Allocate(), ARMNN_ASSERT, ARMNN_LOG, ARMNN_SCOPED_PROFILING_EVENT, armnn::BackendRegistryInstance(), armnn::Constant, IBackendInternal::CreateMemoryManager(), IBackendInternal::CreateWorkloadFactory(), armnn::error, IBackendInternal::GetCapabilities(), armnnUtils::Processes::GetCurrentId(), BackendRegistry::GetFactory(), IBackend::GetId(), ProfilerManager::GetInstance(), BackendRegistry::GetMemoryOptimizerStrategies(), TimelineUtilityMethods::GetTimelineUtils(), armnn::HasCapability(), armnn::Input, ITensorHandleFactory::LegacyFactoryId, INetworkProperties::m_AsyncEnabled, INetworkProperties::m_OutputNetworkDetailsMethod, WorkingMemDescriptor::m_Outputs, INetworkProperties::m_ProfilingEnabled, armnn::MemImport, armnn::Output, ProfilerManager::RegisterProfiler(), IBackendInternal::SupportsTensorAllocatorAPI(), Graph::TopologicalSort(), and armnn::Undefined.
Referenced by RuntimeImpl::LoadNetwork().
void RegisterDebugCallback | ( | const DebugCallbackFunction & | func | ) |
Definition at line 1746 of file LoadedNetwork.cpp.
References armnn::BackendRegistryInstance(), armnn::Constant, BackendRegistry::GetAllocators(), Layer::GetBackendId(), InputSlot::GetConnectedOutputSlot(), Layer::GetInputSlot(), Layer::GetInputSlots(), OutputSlot::GetNumConnections(), Layer::GetOutputSlots(), ITensorHandle::GetParent(), Layer::GetType(), armnn::Input, BufferStorage::m_BufferSize, TensorMemory::m_Offset, BufferStorage::m_TensorMemoryVector, armnn::Output, Graph::TopologicalSort(), and armnn::Undefined.
Referenced by RuntimeImpl::RegisterDebugCallback().
void SendNetworkStructure | ( | ) |
Definition at line 444 of file LoadedNetwork.cpp.
References ARMNN_SCOPED_PROFILING_EVENT, TimelineUtilityMethods::GetTimelineUtils(), armnn::Input, armnn::Output, Graph::TopologicalSort(), and armnn::Undefined.