24.02
|
Go to the documentation of this file.
17 #include <client/include/IInitialiseProfilingService.hpp>
18 #include <client/include/IProfilingService.hpp>
19 #include <client/include/IReportStructure.hpp>
22 #include <unordered_map>
26 using LoadedNetworks = std::unordered_map<NetworkId, std::unique_ptr<LoadedNetwork>>;
48 std::string& errorMessage);
52 std::string& errorMessage,
70 std::vector<ImportedInputId> preImportedInputIds = {},
71 std::vector<ImportedOutputId> preImportedOutputIds = {});
80 std::vector<ImportedInputId> preImportedInputs,
81 std::vector<ImportedOutputId> preImportedOutputs);
113 void ReportStructure(arm::pipe::IProfilingService& profilingService)
override;
122 int GenerateNetworkId();
126 template<
typename Func>
127 void LoadedNetworkFuncSafe(
NetworkId networkId, Func f)
129 #if !defined(ARMNN_DISABLE_THREADS)
130 std::lock_guard<std::mutex> lockGuard(m_Mutex);
132 auto iter = m_LoadedNetworks.find(networkId);
133 if (iter != m_LoadedNetworks.end())
135 f(iter->second.get());
140 void LoadDynamicBackends(
const std::string& overrideBackendPath);
142 #if !defined(ARMNN_DISABLE_THREADS)
143 mutable std::mutex m_Mutex;
149 std::unordered_map<BackendId, IBackendInternal::IBackendContextPtr> m_BackendContexts;
151 int m_NetworkIdCounter;
153 DeviceSpec m_DeviceSpec;
156 std::vector<DynamicBackendPtr> m_DynamicBackends;
159 std::unique_ptr<arm::pipe::IProfilingService> m_ProfilingService;
163 std::set<BackendId> m_AllocatorsAddedByThisRuntime;
void ReportStructure(arm::pipe::IProfilingService &profilingService) override
std::unique_ptr< IOptimizedNetwork, void(*)(IOptimizedNetwork *network)> IOptimizedNetworkPtr
void ClearImportedOutputs(NetworkId networkId, const std::vector< ImportedOutputId > outputIds)
std::vector< std::pair< LayerBindingId, class ConstTensor > > InputTensors
Status LoadNetwork(NetworkId &networkIdOut, IOptimizedNetworkPtr network)
Loads a complete network into the Runtime.
const std::shared_ptr< IProfiler > GetProfiler(NetworkId networkId) const
Gets the profiler corresponding to the given network id.
void ClearImportedInputs(NetworkId networkId, const std::vector< ImportedInputId > inputIds)
const IDeviceSpec & GetDeviceSpec() const
std::vector< std::pair< LayerBindingId, class Tensor > > OutputTensors
std::vector< ImportedInputId > ImportInputs(NetworkId networkId, const InputTensors &inputTensors, MemorySource forceImportMemorySource)
Status UnloadNetwork(NetworkId networkId)
Unloads a network from the Runtime.
arm::pipe::IReportStructure IReportStructure
Status EnqueueWorkload(NetworkId networkId, const InputTensors &inputTensors, const OutputTensors &outputTensors, std::vector< ImportedInputId > preImportedInputIds={}, std::vector< ImportedOutputId > preImportedOutputIds={})
std::vector< ImportedOutputId > ImportOutputs(NetworkId networkId, const OutputTensors &outputTensors, MemorySource forceImportMemorySource)
friend arm::pipe::IProfilingService & GetProfilingService(RuntimeImpl *runtime)
arm::pipe::IInitialiseProfilingService IInitialiseProfilingService
std::unordered_map< NetworkId, std::unique_ptr< LoadedNetwork > > LoadedNetworks
int LayerBindingId
Type of identifiers for bindable layers (inputs, outputs).
RuntimeImpl(const IRuntime::CreationOptions &options)
Creates a runtime for workload execution.
friend void RuntimeLoadedNetworksReserve(RuntimeImpl *runtime)
void RegisterDebugCallback(NetworkId networkId, const DebugCallbackFunction &func)
Registers a callback function to debug layers performing custom computations on intermediate tensors.
std::function< void(LayerGuid guid, unsigned int slotIndex, ITensorHandle *tensorHandle)> DebugCallbackFunction
Define the type of callback for the Debug layer to call.
MemorySource
Define the Memory Source to reduce copies.
Status Execute(IWorkingMemHandle &workingMemHandle, const InputTensors &inputTensors, const OutputTensors &outputTensors, std::vector< ImportedInputId > preImportedInputs, std::vector< ImportedOutputId > preImportedOutputs)
This is an experimental function.
Copyright (c) 2021 ARM Limited and Contributors.
void InitialiseProfilingService(arm::pipe::IProfilingService &profilingService) override
Device specific knowledge to be passed to the optimizer.
std::unique_ptr< IWorkingMemHandle > CreateWorkingMemHandle(NetworkId networkId)
Create a new unique WorkingMemHandle object.
armnn::TensorInfo GetInputTensorInfo(NetworkId networkId, LayerBindingId layerId) const
armnn::TensorInfo GetOutputTensorInfo(NetworkId networkId, LayerBindingId layerId) const