diff options
author | Mike Kelly <mike.kelly@arm.com> | 2021-04-07 20:10:49 +0100 |
---|---|---|
committer | finn.williams <finn.williams@arm.com> | 2021-04-08 11:23:47 +0000 |
commit | 55a8ffda24fff5515803df10fb4863d46a1effdf (patch) | |
tree | e314dea48f22ae88d452527b2decaca61df108ad /src/armnn/AsyncNetwork.hpp | |
parent | b76eaed55a89330b3b448c4f4522b3fc94a4f38d (diff) | |
download | armnn-55a8ffda24fff5515803df10fb4863d46a1effdf.tar.gz |
IVGCVSW-5823 Refactor Async Network API
* Moved IAsyncNetwork into IRuntime.
* All LoadedNetworks can be executed Asynchronously.
Signed-off-by: Mike Kelly <mike.kelly@arm.com>
Change-Id: Ibbc901ab9110dc2f881425b75489bccf9ad54169
Diffstat (limited to 'src/armnn/AsyncNetwork.hpp')
-rw-r--r-- | src/armnn/AsyncNetwork.hpp | 106 |
1 files changed, 0 insertions, 106 deletions
diff --git a/src/armnn/AsyncNetwork.hpp b/src/armnn/AsyncNetwork.hpp deleted file mode 100644 index 9bdc7eebd7..0000000000 --- a/src/armnn/AsyncNetwork.hpp +++ /dev/null @@ -1,106 +0,0 @@ -// -// Copyright © 2021 Arm Ltd and Contributors. All rights reserved. -// SPDX-License-Identifier: MIT -// - -#pragma once - -#include <armnn/IAsyncNetwork.hpp> -#include <armnn/Tensor.hpp> -#include <armnn/Types.hpp> - -#include "LayerFwd.hpp" -#include "Network.hpp" -#include "Profiling.hpp" -#include "WorkingMemHandle.hpp" - -#include <armnn/backends/IBackendInternal.hpp> -#include <backendsCommon/TensorHandleFactoryRegistry.hpp> -#include <backendsCommon/Workload.hpp> -#include <backendsCommon/WorkloadFactory.hpp> -#include <ProfilingService.hpp> -#include <TimelineUtilityMethods.hpp> - -#include <unordered_map> - -namespace armnn -{ - -namespace experimental -{ - -class AsyncNetworkImpl final -{ -public: - using WorkloadQueue = std::vector<std::unique_ptr<IWorkload>>; - - AsyncNetworkImpl(std::unique_ptr<IOptimizedNetwork> net, - const INetworkProperties &networkProperties, - profiling::ProfilingService &profilingService); - - ~AsyncNetworkImpl() { FreeWorkingMemory(); } - - TensorInfo GetInputTensorInfo(LayerBindingId layerId) const; - TensorInfo GetOutputTensorInfo(LayerBindingId layerId) const; - - /// Thread safe execution of the network. Returns once execution is complete. - /// Will block until this and any other thread using the same workingMem object completes. - virtual Status Execute(const InputTensors& inputTensors, - const OutputTensors& outputTensors, - IWorkingMemHandle& workingMemHandle); - - /// Create a new unique WorkingMemHandle object. Create multiple handles if you wish to have - /// overlapped Execution by calling this function from different threads. - std::unique_ptr<IWorkingMemHandle> CreateWorkingMemHandle(); - - /// Get the profiler used for this network - std::shared_ptr<IProfiler> GetProfiler() const; - - /// Register a debug callback function to be used with this network - void RegisterDebugCallback(const DebugCallbackFunction& func); - -private: - void FreeWorkingMemory(); - - void CollectInputTensorHandles(std::unordered_map<LayerGuid, std::vector<ITensorHandle*> >& tensorHandles, - std::vector<ITensorHandle*>& inputs, - const armnn::Layer* layer, - const TensorHandleFactoryRegistry& registry, - const bool isMemoryManaged = false); - - void CreateOutputTensorHandles(std::unordered_map<LayerGuid, std::vector<ITensorHandle*> >& tensorHandles, - std::vector<ITensorHandle*>& outputs, - const armnn::Layer* layer, - const TensorHandleFactoryRegistry& registry, - const bool isMemoryManaged = false); - - void EnqueueInput(const BindableLayer& layer, const ConstTensor& inputTensor, WorkingMemHandle& handle); - - void EnqueueOutput(const BindableLayer& layer, const Tensor& outputTensor, WorkingMemHandle& handle); - - using BackendPtrMap = std::unordered_map<BackendId, IBackendInternalUniquePtr>; - - using WorkloadFactoryWithMemoryManager = - std::pair<IBackendInternal::IWorkloadFactoryPtr, IBackendInternal::IMemoryManagerSharedPtr>; - - using WorkloadFactoryMap = std::unordered_map<BackendId, WorkloadFactoryWithMemoryManager>; - - const IWorkloadFactory& GetWorkloadFactory(const Layer& layer) const; - - BackendPtrMap m_Backends; - WorkloadFactoryMap m_WorkloadFactories; - - std::unique_ptr<IOptimizedNetwork> m_OptimizedNetwork; - INetworkProperties m_NetworkProperties; - WorkloadQueue m_WorkloadQueue; - std::shared_ptr<IProfiler> m_Profiler; - - TensorHandleFactoryRegistry m_TensorHandleFactoryRegistry; - - /// Profiling Service Instance - profiling::ProfilingService& m_ProfilingService; -}; - -} // end experimental namespace - -} // end armnn namespace |