diff options
author | Jim Flynn <jim.flynn@arm.com> | 2020-07-14 09:50:59 +0100 |
---|---|---|
committer | Jim Flynn <jim.flynn@arm.com> | 2020-07-14 17:20:04 +0100 |
commit | f7713212f080771e0c6d53d939da59a9ea2e7da0 (patch) | |
tree | c176d4448ed36804b6bac3806d55c74f113e2256 /src/armnn | |
parent | 6da6a45d09ac8d7ea956c09ba241c9e0840ecb25 (diff) | |
download | armnn-f7713212f080771e0c6d53d939da59a9ea2e7da0.tar.gz |
IVGCVSW-5101 Add a SOL/EOL and a process ID label to Network
Change-Id: I6261f46404a3aab5c069bca40586994d31d26fe8
Signed-off-by: Jim Flynn <jim.flynn@arm.com>
Diffstat (limited to 'src/armnn')
-rw-r--r-- | src/armnn/LoadedNetwork.cpp | 13 | ||||
-rw-r--r-- | src/armnn/LoadedNetwork.hpp | 2 | ||||
-rw-r--r-- | src/armnn/Runtime.cpp | 14 | ||||
-rw-r--r-- | src/armnn/test/RuntimeTests.cpp | 40 |
4 files changed, 67 insertions, 2 deletions
diff --git a/src/armnn/LoadedNetwork.cpp b/src/armnn/LoadedNetwork.cpp index 0dd75aa649..593539d3ee 100644 --- a/src/armnn/LoadedNetwork.cpp +++ b/src/armnn/LoadedNetwork.cpp @@ -7,6 +7,7 @@ #include "Layer.hpp" #include "Graph.hpp" #include "Network.hpp" +#include <Processes.hpp> #include "Runtime.hpp" #include "Profiling.hpp" #include "HeapProfiling.hpp" @@ -196,6 +197,13 @@ LoadedNetwork::LoadedNetwork(std::unique_ptr<OptimizedNetwork> net, if (timelineUtils) { timelineUtils->CreateTypedEntity(networkGuid, LabelsAndEventClasses::NETWORK_GUID); + // Mark the network with a start of life event + timelineUtils->RecordEvent(networkGuid, LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS); + // and with the process ID + int processID = armnnUtils::Processes::GetCurrentId(); + std::stringstream ss; + ss << processID; + timelineUtils->MarkEntityWithLabel(networkGuid, ss.str(), LabelsAndEventClasses::PROCESS_ID_GUID); } //Then create workloads. @@ -298,6 +306,11 @@ void LoadedNetwork::SendNetworkStructure() timelineUtils->Commit(); } +profiling::ProfilingGuid LoadedNetwork::GetNetworkGuid() +{ + return m_OptimizedNetwork->GetGuid(); +} + TensorInfo LoadedNetwork::GetInputTensorInfo(LayerBindingId layerId) const { for (auto&& inputLayer : m_OptimizedNetwork->GetGraph().GetInputLayers()) diff --git a/src/armnn/LoadedNetwork.hpp b/src/armnn/LoadedNetwork.hpp index 8c2103019e..39b6089ac9 100644 --- a/src/armnn/LoadedNetwork.hpp +++ b/src/armnn/LoadedNetwork.hpp @@ -58,6 +58,8 @@ public: void SendNetworkStructure(); + profiling::ProfilingGuid GetNetworkGuid(); + private: void AllocateWorkingMemory(std::lock_guard<std::mutex>& lock); diff --git a/src/armnn/Runtime.cpp b/src/armnn/Runtime.cpp index 28e2df22ab..63f39c6529 100644 --- a/src/armnn/Runtime.cpp +++ b/src/armnn/Runtime.cpp @@ -6,6 +6,7 @@ #include <armnn/Version.hpp> #include <armnn/BackendRegistry.hpp> +#include <LabelsAndEventClasses.hpp> #include <armnn/Logging.hpp> #include <armnn/utility/Timer.hpp> @@ -117,9 +118,22 @@ Status Runtime::UnloadNetwork(NetworkId networkId) return Status::Failure; } + std::unique_ptr<profiling::TimelineUtilityMethods> timelineUtils = + profiling::TimelineUtilityMethods::GetTimelineUtils(m_ProfilingService); { std::lock_guard<std::mutex> lockGuard(m_Mutex); + // If timeline recording is on mark the Network end of life + if (timelineUtils) + { + auto search = m_LoadedNetworks.find(networkId); + if (search != m_LoadedNetworks.end()) + { + profiling::ProfilingGuid networkGuid = search->second->GetNetworkGuid(); + timelineUtils->RecordEvent(networkGuid, + profiling::LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS); + } + } if (m_LoadedNetworks.erase(networkId) == 0) { ARMNN_LOG(warning) << "WARNING: Runtime::UnloadNetwork(): " << networkId << " not found!"; diff --git a/src/armnn/test/RuntimeTests.cpp b/src/armnn/test/RuntimeTests.cpp index 7e9acb7d79..12ec8b1ece 100644 --- a/src/armnn/test/RuntimeTests.cpp +++ b/src/armnn/test/RuntimeTests.cpp @@ -6,6 +6,7 @@ #include <armnn/Descriptors.hpp> #include <armnn/IRuntime.hpp> #include <armnn/INetwork.hpp> +#include <Processes.hpp> #include <Runtime.hpp> #include <armnn/TypesUtils.hpp> @@ -414,7 +415,6 @@ BOOST_AUTO_TEST_CASE(ProfilingEnableCpuRef) BOOST_CHECK(readableBuffer != nullptr); unsigned int size = readableBuffer->GetSize(); - BOOST_CHECK(size == 772); const unsigned char* readableData = readableBuffer->GetReadableData(); BOOST_CHECK(readableData != nullptr); @@ -422,7 +422,7 @@ BOOST_AUTO_TEST_CASE(ProfilingEnableCpuRef) unsigned int offset = 0; // Verify Header - VerifyTimelineHeaderBinary(readableData, offset, 764); + VerifyTimelineHeaderBinary(readableData, offset, size - 8); BOOST_TEST_MESSAGE("HEADER OK"); // Post-optimisation network @@ -440,6 +440,42 @@ BOOST_AUTO_TEST_CASE(ProfilingEnableCpuRef) offset); BOOST_TEST_MESSAGE("NETWORK TYPE RELATIONSHIP OK"); + // Network - START OF LIFE + ProfilingGuid networkSolEventGuid = VerifyTimelineEventBinaryPacket(EmptyOptional(), + EmptyOptional(), + EmptyOptional(), + readableData, + offset); + BOOST_TEST_MESSAGE("NETWORK START OF LIFE EVENT OK"); + + // Network - START OF LIFE event relationship + VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, + EmptyOptional(), + optNetGuid, + networkSolEventGuid, + LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS, + readableData, + offset); + BOOST_TEST_MESSAGE("NETWORK START OF LIFE RELATIONSHIP OK"); + + // Process ID Label + int processID = armnnUtils::Processes::GetCurrentId(); + std::stringstream ss; + ss << processID; + std::string processIdLabel = ss.str(); + VerifyTimelineLabelBinaryPacketData(EmptyOptional(), processIdLabel, readableData, offset); + BOOST_TEST_MESSAGE("PROCESS ID LABEL OK"); + + // Entity - Process ID relationship + VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, + EmptyOptional(), + optNetGuid, + EmptyOptional(), + LabelsAndEventClasses::PROCESS_ID_GUID, + readableData, + offset); + BOOST_TEST_MESSAGE("NETWORK PROCESS ID RELATIONSHIP OK"); + // Input layer // Input layer entity VerifyTimelineEntityBinaryPacketData(input->GetGuid(), readableData, offset); |