From 99d9d4a7c62715328378a95b8140862cb0f599fb Mon Sep 17 00:00:00 2001 From: Jan Eilers Date: Wed, 6 Nov 2019 10:02:16 +0000 Subject: IVGCVSW-4069 Add ProfilingGuid to Network Added ProfilingGuid to * INetwork, * Network, * IOptimizedNetwork and * OptimizedNetwork !android-nn-driver:2234 !armnn:2250 Signed-off-by: Jan Eilers Change-Id: I235116992cc47b4f385b7eb9da514c6350ca00f4 --- include/armnn/INetwork.hpp | 3 +++ src/armnn/Network.cpp | 20 ++++++++++++-------- src/armnn/Network.hpp | 6 ++++++ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/include/armnn/INetwork.hpp b/include/armnn/INetwork.hpp index 6efc84fdf2..647f072804 100644 --- a/include/armnn/INetwork.hpp +++ b/include/armnn/INetwork.hpp @@ -95,6 +95,8 @@ public: virtual Status PrintGraph() = 0; + virtual profiling::ProfilingGuid GetGuid() const = 0; + /// Adds an input layer to the network. /// @param id - User generated id to uniquely identify a particular input. The same id needs to be specified. /// when passing the inputs to the IRuntime::EnqueueWorkload() function. @@ -540,6 +542,7 @@ public: virtual Status PrintGraph() = 0; virtual Status SerializeToDot(std::ostream& stream) const = 0; + virtual profiling::ProfilingGuid GetGuid() const = 0; protected: ~IOptimizedNetwork() {} diff --git a/src/armnn/Network.cpp b/src/armnn/Network.cpp index b1cb5a871a..573f6a19e8 100644 --- a/src/armnn/Network.cpp +++ b/src/armnn/Network.cpp @@ -22,6 +22,8 @@ #include #include +#include + #include #include #include @@ -53,12 +55,6 @@ void INetwork::Destroy(INetwork* network) delete boost::polymorphic_downcast(network); } -Status Network::PrintGraph() -{ - m_Graph->Print(); - return Status::Success; -} - void IOptimizedNetwork::Destroy(IOptimizedNetwork* network) { delete boost::polymorphic_downcast(network); @@ -925,7 +921,8 @@ IOptimizedNetworkPtr Optimize(const INetwork& inNetwork, } Network::Network() -: m_Graph(std::make_unique()) +: m_Graph(std::make_unique()), + m_Guid(profiling::ProfilingService::Instance().NextGuid()) { } @@ -933,6 +930,12 @@ Network::~Network() { } +Status Network::PrintGraph() +{ + m_Graph->Print(); + return Status::Success; +} + IConnectableLayer* Network::AddInputLayer(LayerBindingId id, const char* name) { return m_Graph->AddLayer(id, name); @@ -1563,7 +1566,8 @@ void Network::Accept(ILayerVisitor& visitor) const } OptimizedNetwork::OptimizedNetwork(std::unique_ptr graph) - : m_Graph(std::move(graph)) + : m_Graph(std::move(graph)), + m_Guid(profiling::ProfilingService::Instance().NextGuid()) { } diff --git a/src/armnn/Network.hpp b/src/armnn/Network.hpp index 49cf4dac09..0a11941340 100644 --- a/src/armnn/Network.hpp +++ b/src/armnn/Network.hpp @@ -34,6 +34,8 @@ public: Status PrintGraph() override; + profiling::ProfilingGuid GetGuid() const final { return m_Guid; }; + IConnectableLayer* AddInputLayer(LayerBindingId id, const char* name=nullptr) override; IConnectableLayer* AddArgMinMaxLayer(const ArgMinMaxDescriptor& desc, @@ -248,6 +250,7 @@ private: const char* name); std::unique_ptr m_Graph; + profiling::ProfilingGuid m_Guid; }; class OptimizedNetwork final : public IOptimizedNetwork @@ -259,10 +262,13 @@ public: Status PrintGraph() override; Status SerializeToDot(std::ostream& stream) const override; + profiling::ProfilingGuid GetGuid() const final { return m_Guid; }; + Graph& GetGraph() { return *m_Graph; } private: std::unique_ptr m_Graph; + profiling::ProfilingGuid m_Guid; }; -- cgit v1.2.1