diff options
author | Colm Donelan <Colm.Donelan@arm.com> | 2020-02-05 17:48:59 +0000 |
---|---|---|
committer | Colm Donelan <colm.donelan@arm.com> | 2020-02-07 09:28:35 +0000 |
commit | 1aff393b359b518925f66901439466f9bc14c49d (patch) | |
tree | 9d31aa1d3dabb4b637093f6fd1a9f1549621c653 /src/armnn/Runtime.cpp | |
parent | 3446057492907d0c7695605a5b9a961a78158d7e (diff) | |
download | armnn-1aff393b359b518925f66901439466f9bc14c49d.tar.gz |
IVGCVSW-4317 Implement the Profiling Context Initialisation
* Call CreateBackendProfilingContext on each backend from Runtime passing
an instance of the BackendProfiling interface.
* Modify the signature of CreateBackendProfilingContext to remove const
and return a shared_ptr to BackendProfilingContext
* Add concrete BackendProfiling class.
* Store BackendProfilingContexts in Profiling service.
Signed-off-by: Colm Donelan <Colm.Donelan@arm.com>
Change-Id: I975eaa2093ae91fa623835f65f9e5b25eb65117a
Diffstat (limited to 'src/armnn/Runtime.cpp')
-rw-r--r-- | src/armnn/Runtime.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/armnn/Runtime.cpp b/src/armnn/Runtime.cpp index 47c998a6fd..c1416f94d7 100644 --- a/src/armnn/Runtime.cpp +++ b/src/armnn/Runtime.cpp @@ -16,6 +16,7 @@ #include <iostream> #include <boost/polymorphic_cast.hpp> +#include <backends/BackendProfiling.hpp> using namespace armnn; using namespace std; @@ -181,6 +182,19 @@ Runtime::Runtime(const CreationOptions& options) m_BackendContexts.emplace(std::make_pair(id, std::move(context))); } supportedBackends.emplace(id); + + unique_ptr<armnn::profiling::IBackendProfiling> profilingIface = + std::make_unique<armnn::profiling::BackendProfiling>(armnn::profiling::BackendProfiling( + options, armnn::profiling::ProfilingService::Instance(), id)); + + // Backends may also provide a profiling context. Ask for it now. + auto profilingContext = backend->CreateBackendProfilingContext(options, profilingIface); + // Backends that don't support profiling will return a null profiling context. + if (profilingContext) + { + // Pass the context onto the profiling service. + armnn::profiling::ProfilingService::Instance().AddBackendProfilingContext(id, profilingContext); + } } catch (const BackendUnavailableException&) { @@ -230,9 +244,11 @@ Runtime::~Runtime() } } + // Clear all dynamic backends. DynamicBackendUtils::DeregisterDynamicBackends(m_DeviceSpec.GetDynamicBackends()); m_DeviceSpec.ClearDynamicBackends(); + m_BackendContexts.clear(); } LoadedNetwork* Runtime::GetLoadedNetworkPtr(NetworkId networkId) const |