21.05
|
#include <LoadedNetwork.hpp>
Public Types | |
using | WorkloadQueue = std::vector< std::unique_ptr< IWorkload > > |
using | ExecutionTuple = std::tuple< InputTensors, OutputTensors, std::shared_ptr< IAsyncExecutionCallback > > |
using | ExecutionQueue = std::queue< std::shared_ptr< ExecutionTuple > > |
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 |
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) |
Thread safe execution of the loaded network. More... | |
void | Schedule (const InputTensors &inputTensors, const OutputTensors &outputTensors, const QosExecPriority priority, std::shared_ptr< IAsyncExecutionCallback > cb) |
Schedule an asynchronous execution on 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, const NetworkId networkIdOut) |
Definition at line 35 of file LoadedNetwork.hpp.
using ExecutionQueue = std::queue<std::shared_ptr<ExecutionTuple> > |
Definition at line 44 of file LoadedNetwork.hpp.
using ExecutionTuple = std::tuple<InputTensors, OutputTensors, std::shared_ptr<IAsyncExecutionCallback> > |
Definition at line 42 of file LoadedNetwork.hpp.
using WorkloadQueue = std::vector<std::unique_ptr<IWorkload> > |
Definition at line 38 of file LoadedNetwork.hpp.
|
inline |
Definition at line 46 of file LoadedNetwork.hpp.
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 1258 of file LoadedNetwork.cpp.
References ITensorHandle::Allocate(), ARMNN_ASSERT, ARMNN_NO_DEPRECATE_WARN_BEGIN, ARMNN_NO_DEPRECATE_WARN_END, armnn::Constant, ITensorHandleFactory::CreateTensorHandle(), Layer::GetBackendId(), TensorHandleFactoryRegistry::GetFactory(), Layer::GetGuid(), Layer::GetInputSlots(), TensorHandleFactoryRegistry::GetMemoryManagers(), Layer::GetNumOutputSlots(), Layer::GetOutputSlots(), Layer::GetType(), armnn::Input, ITensorHandleFactory::LegacyFactoryId, WorkingMemDescriptor::m_Inputs, WorkingMemDescriptor::m_Outputs, ITensorHandle::Manage(), armnn::MemImport, and armnn::Output.
Referenced by RuntimeImpl::CreateWorkingMemHandle().
Status EnqueueWorkload | ( | const InputTensors & | inputTensors, |
const OutputTensors & | outputTensors | ||
) |
Single thread execution of the loaded network.
Definition at line 535 of file LoadedNetwork.cpp.
References ARMNN_ASSERT_MSG, ARMNN_LOG, LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS, LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS, ARMNN_SCOPED_HEAP_PROFILING, ARMNN_SCOPED_PROFILING_EVENT, armnn::CheckFlag(), LabelsAndEventClasses::EXECUTION_OF_GUID, 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(), LabelsAndEventClasses::INFERENCE_GUID, 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 | ||
) |
Thread safe execution of the loaded network.
Definition at line 1154 of file LoadedNetwork.cpp.
References WorkingMemHandle::Allocate(), ARMNN_LOG, LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS, LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS, ARMNN_SCOPED_PROFILING_EVENT, armnn::error, LabelsAndEventClasses::EXECUTION_OF_GUID, armnn::Failure, Graph::GetInputLayers(), armnn::GetInputTensor(), WorkingMemHandle::GetMutex(), Graph::GetNumInputs(), Graph::GetNumLayers(), Graph::GetOutputLayers(), armnn::GetOutputTensor(), TimelineUtilityMethods::GetTimelineUtils(), WorkingMemHandle::GetWorkingMemDescriptorAt(), LabelsAndEventClasses::INFERENCE_GUID, WorkingMemHandle::IsAllocated(), armnn::profiling::RetentionLink, armnn::Success, armnn::Undefined, and armnn::warning.
Referenced by RuntimeImpl::Execute(), and LoadedNetwork::FreeWorkingMemory().
void FreeWorkingMemory | ( | ) |
Definition at line 791 of file LoadedNetwork.cpp.
References ARMNN_LOG, armnn::error, and LoadedNetwork::Execute().
Referenced by RuntimeImpl::CreateWorkingMemHandle(), and RuntimeImpl::EnqueueWorkload().
TensorInfo GetInputTensorInfo | ( | LayerBindingId | layerId | ) | const |
Definition at line 386 of file LoadedNetwork.cpp.
References ARMNN_ASSERT_MSG.
Referenced by RuntimeImpl::GetInputTensorInfo().
profiling::ProfilingGuid GetNetworkGuid | ( | ) |
Definition at line 381 of file LoadedNetwork.cpp.
TensorInfo GetOutputTensorInfo | ( | LayerBindingId | layerId | ) | const |
Definition at line 400 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(), RuntimeImpl::Execute(), and RuntimeImpl::Schedule().
|
inline |
Definition at line 90 of file LoadedNetwork.hpp.
Referenced by RuntimeImpl::CreateWorkingMemHandle(), RuntimeImpl::EnqueueWorkload(), RuntimeImpl::Execute(), and RuntimeImpl::Schedule().
|
static |
Definition at line 85 of file LoadedNetwork.cpp.
References ITensorHandle::Allocate(), ARMNN_ASSERT, ARMNN_LOG, LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS, armnn::BackendRegistryInstance(), armnn::Constant, IBackendInternal::CreateMemoryManager(), IBackendInternal::CreateWorkloadFactory(), armnn::error, armnnUtils::Processes::GetCurrentId(), BackendRegistry::GetFactory(), ProfilerManager::GetInstance(), TimelineUtilityMethods::GetTimelineUtils(), armnn::Input, ITensorHandleFactory::LegacyFactoryId, INetworkProperties::m_AsyncEnabled, WorkingMemDescriptor::m_Outputs, armnn::MemImport, LabelsAndEventClasses::NETWORK_GUID, armnn::Output, LabelsAndEventClasses::PROCESS_ID_GUID, ProfilerManager::RegisterProfiler(), IBackendInternal::SupportsTensorAllocatorAPI(), and Graph::TopologicalSort().
Referenced by RuntimeImpl::LoadNetwork().
void RegisterDebugCallback | ( | const DebugCallbackFunction & | func | ) |
Definition at line 1400 of file LoadedNetwork.cpp.
Referenced by RuntimeImpl::RegisterDebugCallback().
void Schedule | ( | const InputTensors & | inputTensors, |
const OutputTensors & | outputTensors, | ||
const QosExecPriority | priority, | ||
std::shared_ptr< IAsyncExecutionCallback > | cb | ||
) |
Schedule an asynchronous execution on the loaded network.
Definition at line 892 of file LoadedNetwork.cpp.
References ARMNN_ASSERT_MSG, ARMNN_SCOPED_PROFILING_EVENT, armnn::CheckFlag(), armnn::CopyTensorContentsGeneric(), armnn::EXPIRE_RATE, armnn::Failure, Layer::GetGuid(), ITensorHandle::GetImportFlags(), BaseTensor< MemoryType >::GetInfo(), Layer::GetInputSlots(), BaseTensor< MemoryType >::GetMemoryArea(), Layer::GetNumInputSlots(), armnn::GetTimeNow(), Layer::GetType(), WorkingMemHandle::GetWorkingMemDescriptor(), armnn::High, ITensorHandle::Import(), armnn::Input, armnn::Low, WorkingMemDescriptor::m_Inputs, WorkingMemDescriptor::m_Outputs, ITensorHandle::Map(), armnn::Medium, armnn::Output, armnn::Success, armnn::Undefined, and ITensorHandle::Unmap().
Referenced by RuntimeImpl::Schedule().
void SendNetworkStructure | ( | ) |
Definition at line 344 of file LoadedNetwork.cpp.
References TimelineUtilityMethods::GetTimelineUtils(), armnn::Input, LabelsAndEventClasses::NETWORK_GUID, armnn::Output, and Graph::TopologicalSort().