diff options
author | Finn Williams <Finn.Williams@arm.com> | 2021-06-09 17:07:33 +0100 |
---|---|---|
committer | Finn Williams <Finn.Williams@arm.com> | 2021-06-23 17:14:53 +0100 |
commit | f364d5391b08e9071cd965f5765385ec9156b652 (patch) | |
tree | 1ea93ed574a3eb51f5a1f4bb08dc1ad18aa1c6a2 /src/armnn/Runtime.cpp | |
parent | 7a00eaa6ecf121623823b1951c0e6c9093271adf (diff) | |
download | armnn-f364d5391b08e9071cd965f5765385ec9156b652.tar.gz |
IVGCVSW-6062 Rework the async threadpool
!android-nn-driver:5802
* Extract the threadpool from LoadedNetwork/Runtime
* Refactor the threadpool to be handle multiple networks
* Trim IAsyncExecutionCallback and add an InferenceId to AsyncExecutionCallback
* Add AsyncCallbackManager class
Signed-off-by: Finn Williams <Finn.Williams@arm.com>
Change-Id: I36aa2ad29c16bc10ee0706adfeb6b27f60012afb
Diffstat (limited to 'src/armnn/Runtime.cpp')
-rw-r--r-- | src/armnn/Runtime.cpp | 40 |
1 files changed, 1 insertions, 39 deletions
diff --git a/src/armnn/Runtime.cpp b/src/armnn/Runtime.cpp index 374064e408..f16d186191 100644 --- a/src/armnn/Runtime.cpp +++ b/src/armnn/Runtime.cpp @@ -89,15 +89,6 @@ Status IRuntime::Execute(IWorkingMemHandle& workingMemHandle, return pRuntimeImpl->Execute(workingMemHandle, inputTensors, outputTensors); } -void IRuntime::Schedule(NetworkId networkId, - const InputTensors& inputTensors, - const OutputTensors& outputTensors, - const QosExecPriority priority, - std::shared_ptr<IAsyncExecutionCallback> cb) -{ - pRuntimeImpl->Schedule(networkId, inputTensors, outputTensors, priority, cb); -} - Status IRuntime::UnloadNetwork(NetworkId networkId) { return pRuntimeImpl->UnloadNetwork(networkId); @@ -160,8 +151,7 @@ Status RuntimeImpl::LoadNetwork(NetworkId& networkIdOut, std::unique_ptr<IOptimizedNetwork>(rawNetwork), errorMessage, networkProperties, - m_ProfilingService, - networkIdOut); + m_ProfilingService); if (!loadedNetwork) { @@ -460,34 +450,6 @@ Status RuntimeImpl::Execute(IWorkingMemHandle& iWorkingMemHandle, return loadedNetwork->Execute(inputTensors, outputTensors, iWorkingMemHandle); } -void RuntimeImpl::Schedule(NetworkId networkId, - const InputTensors& inputTensors, - const OutputTensors& outputTensors, - const QosExecPriority priority, - std::shared_ptr<IAsyncExecutionCallback> callback) -{ - LoadedNetwork* loadedNetwork = GetLoadedNetworkPtr(networkId); - - if (!loadedNetwork) - { - throw armnn::Exception( - "Network with ID of " + std::to_string(networkId) + " does not exist \n" - ); - } - if (!loadedNetwork->IsAsyncEnabled()) - { - throw armnn::Exception( - "Attempting to schedule Network " + std::to_string(networkId) + " when it is not async enabled \n" - ); - } - - ProfilerManager::GetInstance().RegisterProfiler(loadedNetwork->GetProfiler().get()); - - ARMNN_SCOPED_PROFILING_EVENT(Compute::Undefined, "Schedule"); - - loadedNetwork->Schedule(inputTensors, outputTensors, priority, callback); -} - /// 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> RuntimeImpl::CreateWorkingMemHandle(NetworkId networkId) |