From decd08b89565b18067d229c8c25b6f3a3333c653 Mon Sep 17 00:00:00 2001 From: Jim Flynn Date: Sun, 13 Mar 2022 22:35:46 +0000 Subject: IVGCVSW-6847 replace armnn:Optional with arm::pipe::Optional in profiling code Change-Id: I048c538d4f8c21770aec2b2751c934d9fa15a4dc Signed-off-by: Jim Flynn --- .../armnn/backends/profiling/IBackendProfiling.hpp | 31 +- .../profiling/IBackendProfilingContext.hpp | 4 +- include/armnnTestUtils/MockBackend.hpp | 6 +- profiling/common/include/Optional.hpp | 314 +++++++++++++++++++++ profiling/common/include/ProfilingException.hpp | 5 + src/armnn/test/RuntimeTests.cpp | 140 ++++----- .../ActivateTimelineReportingCommandHandler.hpp | 8 +- .../ConnectionAcknowledgedCommandHandler.hpp | 7 +- src/profiling/CounterDirectory.cpp | 14 +- src/profiling/CounterDirectory.hpp | 32 +-- src/profiling/DirectoryCaptureCommandHandler.cpp | 2 +- src/profiling/DirectoryCaptureCommandHandler.hpp | 2 +- src/profiling/FileOnlyProfilingConnection.hpp | 5 +- src/profiling/ICounterRegistry.hpp | 28 +- src/profiling/IProfilingService.cpp | 2 +- src/profiling/IProfilingService.hpp | 5 +- .../PeriodicCounterSelectionCommandHandler.hpp | 2 +- .../ProfilingConnectionDumpToFileDecorator.hpp | 3 +- src/profiling/ProfilingService.hpp | 2 +- src/profiling/RegisterBackendCounters.cpp | 12 +- src/profiling/RegisterBackendCounters.hpp | 15 +- src/profiling/SocketProfilingConnection.cpp | 5 +- src/profiling/SocketProfilingConnection.hpp | 1 - src/profiling/test/ProfilingMocks.hpp | 11 +- src/profiling/test/ProfilingTestUtils.cpp | 201 ++++++------- src/profiling/test/ProfilingTestUtils.hpp | 20 +- src/profiling/test/ProfilingTests.cpp | 50 ++-- src/profiling/test/SendCounterPacketTests.cpp | 4 +- src/profiling/test/SendCounterPacketTests.hpp | 2 - src/profiling/test/TimelineUtilityMethodsTests.cpp | 51 ++-- 30 files changed, 656 insertions(+), 328 deletions(-) create mode 100644 profiling/common/include/Optional.hpp diff --git a/include/armnn/backends/profiling/IBackendProfiling.hpp b/include/armnn/backends/profiling/IBackendProfiling.hpp index 564bd6142d..9affab2ade 100644 --- a/include/armnn/backends/profiling/IBackendProfiling.hpp +++ b/include/armnn/backends/profiling/IBackendProfiling.hpp @@ -4,11 +4,10 @@ // #pragma once -#include - #include #include +#include #include #include @@ -56,25 +55,25 @@ public: virtual uint16_t RegisterDevice(const std::string& deviceName, uint16_t cores = 0, - const armnn::Optional& parentCategoryName - = armnn::EmptyOptional()) = 0; + const arm::pipe::Optional& parentCategoryName + = arm::pipe::EmptyOptional()) = 0; virtual uint16_t RegisterCounterSet(const std::string& counterSetName, uint16_t count = 0, - const armnn::Optional& parentCategoryName - = armnn::EmptyOptional()) = 0; + const arm::pipe::Optional& parentCategoryName + = arm::pipe::EmptyOptional()) = 0; virtual uint16_t RegisterCounter(const uint16_t uid, - const std::string& parentCategoryName, - uint16_t counterClass, - uint16_t interpolation, - double multiplier, - const std::string& name, - const std::string& description, - const armnn::Optional& units = armnn::EmptyOptional(), - const armnn::Optional& numberOfCores = armnn::EmptyOptional(), - const armnn::Optional& deviceUid = armnn::EmptyOptional(), - const armnn::Optional& counterSetUid = armnn::EmptyOptional()) = 0; + const std::string& parentCategoryName, + uint16_t counterClass, + uint16_t interpolation, + double multiplier, + const std::string& name, + const std::string& description, + const arm::pipe::Optional& units = arm::pipe::EmptyOptional(), + const arm::pipe::Optional& numberOfCores = arm::pipe::EmptyOptional(), + const arm::pipe::Optional& deviceUid = arm::pipe::EmptyOptional(), + const arm::pipe::Optional& counterSetUid = arm::pipe::EmptyOptional()) = 0; virtual ~IRegisterBackendCounters() {} }; diff --git a/include/armnn/backends/profiling/IBackendProfilingContext.hpp b/include/armnn/backends/profiling/IBackendProfilingContext.hpp index 0b0b0facdf..a1ed05e43d 100644 --- a/include/armnn/backends/profiling/IBackendProfilingContext.hpp +++ b/include/armnn/backends/profiling/IBackendProfilingContext.hpp @@ -18,8 +18,8 @@ public: virtual ~IBackendProfilingContext() {} virtual uint16_t RegisterCounters(uint16_t currentMaxGlobalCounterID) = 0; - virtual armnn::Optional ActivateCounters(uint32_t capturePeriod, const std::vector& - counterIds) = 0; + virtual arm::pipe::Optional ActivateCounters( + uint32_t capturePeriod, const std::vector& counterIds) = 0; virtual std::vector ReportCounterValues() = 0; virtual bool EnableProfiling(bool flag) = 0; virtual bool EnableTimelineReporting(bool flag) = 0; diff --git a/include/armnnTestUtils/MockBackend.hpp b/include/armnnTestUtils/MockBackend.hpp index 425062ac28..266c049c2f 100644 --- a/include/armnnTestUtils/MockBackend.hpp +++ b/include/armnnTestUtils/MockBackend.hpp @@ -162,7 +162,7 @@ public: return nextMaxGlobalCounterId; } - Optional ActivateCounters(uint32_t capturePeriod, const std::vector& counterIds) + arm::pipe::Optional ActivateCounters(uint32_t capturePeriod, const std::vector& counterIds) { if (capturePeriod == 0 || counterIds.size() == 0) { @@ -170,11 +170,11 @@ public: } else if (capturePeriod == 15939u) { - return armnn::Optional("ActivateCounters example test error"); + return arm::pipe::Optional("ActivateCounters example test error"); } m_CapturePeriod = capturePeriod; m_ActiveCounters = counterIds; - return armnn::Optional(); + return arm::pipe::Optional(); } std::vector ReportCounterValues() diff --git a/profiling/common/include/Optional.hpp b/profiling/common/include/Optional.hpp new file mode 100644 index 0000000000..e2d6c67e2a --- /dev/null +++ b/profiling/common/include/Optional.hpp @@ -0,0 +1,314 @@ +// +// Copyright © 2022 Arm Ltd. All rights reserved. +// SPDX-License-Identifier: MIT +// +#pragma once + +#include "ProfilingException.hpp" + +#include +#include + +/// Optional is a drop in replacement for std::optional until we migrate +/// to c++-17. Only a subset of the optional features are implemented that +/// we intend to use in ArmNN. + +/// There are two distinct implementations here: +/// +/// 1, for normal constructable/destructable types and reference types +/// 2, for reference types + +/// The std::optional features we support are: +/// +/// - has_value() and operator bool() to tell if the optional has a value +/// - value() returns a reference to the held object +/// + +namespace arm +{ + +namespace pipe +{ + +/// EmptyOptional is used to initialize the Optional class in case we want +/// to have default value for an Optional in a function declaration. +struct EmptyOptional {}; + +/// Disambiguation tag that can be passed to the constructor to indicate that +/// the contained object should be constructed in-place +struct ConstructInPlace +{ + explicit ConstructInPlace() = default; +}; + +#define ARM_PIPE_CONSTRUCT_IN_PLACE arm::pipe::ConstructInPlace{} + +/// OptionalBase is the common functionality between reference and non-reference +/// optional types. +class OptionalBase +{ +public: + OptionalBase() noexcept + : m_HasValue{false} + { + } + + bool has_value() const noexcept + { + return m_HasValue; + } + + /// Conversion to bool, so can be used in if-statements and similar contexts expecting a bool. + /// Note this is explicit so that it doesn't get implicitly converted to a bool in unwanted cases, + /// for example "Optional == Optional" should not compile. + explicit operator bool() const noexcept + { + return has_value(); + } + +protected: + OptionalBase(bool hasValue) noexcept + : m_HasValue{hasValue} + { + } + + bool m_HasValue; +}; + +/// +/// The default implementation is the non-reference case. This +/// has an unsigned char array for storing the optional value which +/// is in-place constructed there. +/// +template +class OptionalReferenceSwitch : public OptionalBase +{ +public: + using Base = OptionalBase; + + OptionalReferenceSwitch() noexcept : Base{} {} + OptionalReferenceSwitch(EmptyOptional) noexcept : Base{} {} + + OptionalReferenceSwitch(const T& value) + : Base{} + { + Construct(value); + } + + template + OptionalReferenceSwitch(ConstructInPlace, Args&&... args) + : Base{} + { + Construct(ARM_PIPE_CONSTRUCT_IN_PLACE, std::forward(args)...); + } + + OptionalReferenceSwitch(const OptionalReferenceSwitch& other) + : Base{} + { + *this = other; + } + + OptionalReferenceSwitch& operator=(const T& value) + { + reset(); + Construct(value); + return *this; + } + + OptionalReferenceSwitch& operator=(const OptionalReferenceSwitch& other) + { + reset(); + if (other.has_value()) + { + Construct(other.value()); + } + + return *this; + } + + OptionalReferenceSwitch& operator=(EmptyOptional) + { + reset(); + return *this; + } + + ~OptionalReferenceSwitch() + { + reset(); + } + + void reset() + { + if (Base::has_value()) + { + value().T::~T(); + Base::m_HasValue = false; + } + } + + const T& value() const + { + if (!Base::has_value()) + { + throw BadOptionalAccessException("Optional has no value"); + } + + auto valuePtr = reinterpret_cast(m_Storage); + return *valuePtr; + } + + T& value() + { + if (!Base::has_value()) + { + throw BadOptionalAccessException("Optional has no value"); + } + + auto valuePtr = reinterpret_cast(m_Storage); + return *valuePtr; + } + +private: + void Construct(const T& value) + { + new (m_Storage) T(value); + m_HasValue = true; + } + + template + void Construct(ConstructInPlace, Args&&... args) + { + new (m_Storage) T(std::forward(args)...); + m_HasValue = true; + } + + alignas(alignof(T)) unsigned char m_Storage[sizeof(T)]; +}; + +/// +/// This is the special case for reference types. This holds a pointer +/// to the referenced type. This doesn't own the referenced memory and +/// it never calls delete on the pointer. +/// +template +class OptionalReferenceSwitch : public OptionalBase +{ +public: + using Base = OptionalBase; + using NonRefT = typename std::remove_reference::type; + + OptionalReferenceSwitch() noexcept : Base{}, m_Storage{nullptr} {} + OptionalReferenceSwitch(EmptyOptional) noexcept : Base{}, m_Storage{nullptr} {} + + OptionalReferenceSwitch(const OptionalReferenceSwitch& other) : Base{} + { + *this = other; + } + + OptionalReferenceSwitch(T value) + : Base{true} + , m_Storage{&value} + { + } + + template + OptionalReferenceSwitch(ConstructInPlace, Args&&... args) = delete; + + OptionalReferenceSwitch& operator=(const T value) + { + m_Storage = &value; + Base::m_HasValue = true; + return *this; + } + + OptionalReferenceSwitch& operator=(const OptionalReferenceSwitch& other) + { + m_Storage = other.m_Storage; + Base::m_HasValue = other.has_value(); + return *this; + } + + OptionalReferenceSwitch& operator=(EmptyOptional) + { + reset(); + return *this; + } + + ~OptionalReferenceSwitch() + { + reset(); + } + + void reset() + { + Base::m_HasValue = false; + m_Storage = nullptr; + } + + const T value() const + { + if (!Base::has_value()) + { + throw BadOptionalAccessException("Optional has no value"); + } + + return *m_Storage; + } + + T value() + { + if (!Base::has_value()) + { + throw BadOptionalAccessException("Optional has no value"); + } + + return *m_Storage; + } + +private: + NonRefT* m_Storage; +}; + +template +class Optional final : public OptionalReferenceSwitch::value, T> +{ +public: + using BaseSwitch = OptionalReferenceSwitch::value, T>; + + Optional() noexcept : BaseSwitch{} {} + Optional(const T& value) : BaseSwitch{value} {} + Optional& operator=(const Optional& other) = default; + Optional(EmptyOptional empty) : BaseSwitch{empty} {} + Optional(const Optional& other) : BaseSwitch{other} {} + Optional(const BaseSwitch& other) : BaseSwitch{other} {} + + template + explicit Optional(ConstructInPlace, Args&&... args) : + BaseSwitch(ARM_PIPE_CONSTRUCT_IN_PLACE, std::forward(args)...) {} + + /// Two optionals are considered equal if they are both empty or both contain values which + /// themselves are considered equal (via their own == operator). + bool operator==(const Optional& rhs) const + { + if (!this->has_value() && !rhs.has_value()) + { + return true; + } + if (this->has_value() && rhs.has_value() && this->value() == rhs.value()) + { + return true; + } + return false; + } +}; + +/// Utility template that constructs an object of type T in-place and wraps +/// it inside an Optional object +template +Optional MakeOptional(Args&&... args) +{ + return Optional(ARM_PIPE_CONSTRUCT_IN_PLACE, std::forward(args)...); +} + +} // namespace pipe +} // namespace arm diff --git a/profiling/common/include/ProfilingException.hpp b/profiling/common/include/ProfilingException.hpp index 82b724aaa0..135798817a 100644 --- a/profiling/common/include/ProfilingException.hpp +++ b/profiling/common/include/ProfilingException.hpp @@ -70,6 +70,11 @@ public: using ProfilingException::ProfilingException; }; +class BadOptionalAccessException : public ProfilingException +{ + using ProfilingException::ProfilingException; +}; + class BufferExhaustion : public ProfilingException { public: diff --git a/src/armnn/test/RuntimeTests.cpp b/src/armnn/test/RuntimeTests.cpp index fc16dbbad9..fcfcc48f96 100644 --- a/src/armnn/test/RuntimeTests.cpp +++ b/src/armnn/test/RuntimeTests.cpp @@ -712,7 +712,7 @@ TEST_CASE("ProfilingEnableCpuRef") // Entity - Type relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), optNetGuid, LabelsAndEventClasses::NETWORK_GUID, LabelsAndEventClasses::TYPE_GUID, @@ -720,15 +720,15 @@ TEST_CASE("ProfilingEnableCpuRef") offset); // Network - START OF LIFE - ProfilingGuid networkSolEventGuid = VerifyTimelineEventBinaryPacket(EmptyOptional(), - EmptyOptional(), - EmptyOptional(), + ProfilingGuid networkSolEventGuid = VerifyTimelineEventBinaryPacket(arm::pipe::EmptyOptional(), + arm::pipe::EmptyOptional(), + arm::pipe::EmptyOptional(), readableData, offset); // Network - START OF LIFE event relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), optNetGuid, networkSolEventGuid, LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS, @@ -740,13 +740,13 @@ TEST_CASE("ProfilingEnableCpuRef") std::stringstream ss; ss << processID; std::string processIdLabel = ss.str(); - VerifyTimelineLabelBinaryPacketData(EmptyOptional(), processIdLabel, readableData, offset); + VerifyTimelineLabelBinaryPacketData(arm::pipe::EmptyOptional(), processIdLabel, readableData, offset); // Entity - Process ID relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), optNetGuid, - EmptyOptional(), + arm::pipe::EmptyOptional(), LabelsAndEventClasses::PROCESS_ID_GUID, readableData, offset); @@ -756,11 +756,12 @@ TEST_CASE("ProfilingEnableCpuRef") VerifyTimelineEntityBinaryPacketData(input->GetGuid(), readableData, offset); // Name Entity - ProfilingGuid inputLabelGuid = VerifyTimelineLabelBinaryPacketData(EmptyOptional(), "input", readableData, offset); + ProfilingGuid inputLabelGuid = VerifyTimelineLabelBinaryPacketData( + arm::pipe::EmptyOptional(), "input", readableData, offset); // Entity - Name relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), input->GetGuid(), inputLabelGuid, LabelsAndEventClasses::NAME_GUID, @@ -769,7 +770,7 @@ TEST_CASE("ProfilingEnableCpuRef") // Entity - Type relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), input->GetGuid(), LabelsAndEventClasses::LAYER_GUID, LabelsAndEventClasses::TYPE_GUID, @@ -778,7 +779,7 @@ TEST_CASE("ProfilingEnableCpuRef") // Network - Input layer relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), optNetGuid, input->GetGuid(), LabelsAndEventClasses::CHILD_GUID, @@ -791,11 +792,11 @@ TEST_CASE("ProfilingEnableCpuRef") // Name entity ProfilingGuid normalizationLayerNameGuid = VerifyTimelineLabelBinaryPacketData( - EmptyOptional(), "normalization", readableData, offset); + arm::pipe::EmptyOptional(), "normalization", readableData, offset); // Entity - Name relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), normalize->GetGuid(), normalizationLayerNameGuid, LabelsAndEventClasses::NAME_GUID, @@ -804,7 +805,7 @@ TEST_CASE("ProfilingEnableCpuRef") // Entity - Type relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), normalize->GetGuid(), LabelsAndEventClasses::LAYER_GUID, LabelsAndEventClasses::TYPE_GUID, @@ -813,7 +814,7 @@ TEST_CASE("ProfilingEnableCpuRef") // Network - Normalize layer relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), optNetGuid, normalize->GetGuid(), LabelsAndEventClasses::CHILD_GUID, @@ -822,7 +823,7 @@ TEST_CASE("ProfilingEnableCpuRef") // Input layer - Normalize layer relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), input->GetGuid(), normalize->GetGuid(), LabelsAndEventClasses::CONNECTION_GUID, @@ -832,11 +833,11 @@ TEST_CASE("ProfilingEnableCpuRef") // Normalization workload // Normalization workload entity ProfilingGuid normalizationWorkloadGuid = VerifyTimelineEntityBinaryPacketData( - EmptyOptional(), readableData, offset); + arm::pipe::EmptyOptional(), readableData, offset); // Entity - Type relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), normalizationWorkloadGuid, LabelsAndEventClasses::WORKLOAD_GUID, LabelsAndEventClasses::TYPE_GUID, @@ -845,11 +846,11 @@ TEST_CASE("ProfilingEnableCpuRef") // BackendId entity ProfilingGuid cpuRefLabelGuid = VerifyTimelineLabelBinaryPacketData( - EmptyOptional(), "CpuRef", readableData, offset); + arm::pipe::EmptyOptional(), "CpuRef", readableData, offset); // Entity - BackendId relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), normalizationWorkloadGuid, cpuRefLabelGuid, LabelsAndEventClasses::BACKENDID_GUID, @@ -858,7 +859,7 @@ TEST_CASE("ProfilingEnableCpuRef") // Normalize layer - Normalize workload relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), normalize->GetGuid(), normalizationWorkloadGuid, LabelsAndEventClasses::CHILD_GUID, @@ -871,11 +872,11 @@ TEST_CASE("ProfilingEnableCpuRef") // Name entity ProfilingGuid outputLabelGuid = VerifyTimelineLabelBinaryPacketData( - EmptyOptional(), "output", readableData, offset); + arm::pipe::EmptyOptional(), "output", readableData, offset); // Entity - Name relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), output->GetGuid(), outputLabelGuid, LabelsAndEventClasses::NAME_GUID, @@ -884,7 +885,7 @@ TEST_CASE("ProfilingEnableCpuRef") // Entity - Type relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), output->GetGuid(), LabelsAndEventClasses::LAYER_GUID, LabelsAndEventClasses::TYPE_GUID, @@ -893,7 +894,7 @@ TEST_CASE("ProfilingEnableCpuRef") // Network - Output layer relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), optNetGuid, output->GetGuid(), LabelsAndEventClasses::CHILD_GUID, @@ -902,7 +903,7 @@ TEST_CASE("ProfilingEnableCpuRef") // Normalize layer - Output layer relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), normalize->GetGuid(), output->GetGuid(), LabelsAndEventClasses::CONNECTION_GUID, @@ -955,11 +956,12 @@ TEST_CASE("ProfilingEnableCpuRef") // Input workload // Input workload entity - ProfilingGuid inputWorkloadGuid = VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset); + ProfilingGuid inputWorkloadGuid = VerifyTimelineEntityBinaryPacketData( + arm::pipe::EmptyOptional(), readableData, offset); // Entity - Type relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), inputWorkloadGuid, LabelsAndEventClasses::WORKLOAD_GUID, LabelsAndEventClasses::TYPE_GUID, @@ -968,11 +970,11 @@ TEST_CASE("ProfilingEnableCpuRef") // BackendId entity ProfilingGuid CpuRefLabelGuid = VerifyTimelineLabelBinaryPacketData( - EmptyOptional(), "CpuRef", readableData, offset); + arm::pipe::EmptyOptional(), "CpuRef", readableData, offset); // Entity - BackendId relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), inputWorkloadGuid, CpuRefLabelGuid, LabelsAndEventClasses::BACKENDID_GUID, @@ -981,7 +983,7 @@ TEST_CASE("ProfilingEnableCpuRef") // Input layer - Input workload relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), input->GetGuid(), inputWorkloadGuid, LabelsAndEventClasses::CHILD_GUID, @@ -1004,11 +1006,12 @@ TEST_CASE("ProfilingEnableCpuRef") // Output workload // Output workload entity - ProfilingGuid outputWorkloadGuid = VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset); + ProfilingGuid outputWorkloadGuid = VerifyTimelineEntityBinaryPacketData( + arm::pipe::EmptyOptional(), readableData, offset); // Entity - Type relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), outputWorkloadGuid, LabelsAndEventClasses::WORKLOAD_GUID, LabelsAndEventClasses::TYPE_GUID, @@ -1016,11 +1019,11 @@ TEST_CASE("ProfilingEnableCpuRef") offset); // BackendId entity - VerifyTimelineLabelBinaryPacketData(EmptyOptional(), "CpuRef", readableData, offset); + VerifyTimelineLabelBinaryPacketData(arm::pipe::EmptyOptional(), "CpuRef", readableData, offset); // Entity - BackendId relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), outputWorkloadGuid, CpuRefLabelGuid, LabelsAndEventClasses::BACKENDID_GUID, @@ -1029,7 +1032,7 @@ TEST_CASE("ProfilingEnableCpuRef") // Output layer - Output workload relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), output->GetGuid(), outputWorkloadGuid, LabelsAndEventClasses::CHILD_GUID, @@ -1052,11 +1055,12 @@ TEST_CASE("ProfilingEnableCpuRef") // Inference timeline trace // Inference entity - ProfilingGuid inferenceGuid = VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset); + ProfilingGuid inferenceGuid = VerifyTimelineEntityBinaryPacketData( + arm::pipe::EmptyOptional(), readableData, offset); // Entity - Type relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), inferenceGuid, LabelsAndEventClasses::INFERENCE_GUID, LabelsAndEventClasses::TYPE_GUID, @@ -1065,7 +1069,7 @@ TEST_CASE("ProfilingEnableCpuRef") // Network - Inference relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), optNetGuid, inferenceGuid, LabelsAndEventClasses::EXECUTION_OF_GUID, @@ -1075,11 +1079,11 @@ TEST_CASE("ProfilingEnableCpuRef") // Start Inference life // Event packet - timeline, threadId, eventGuid ProfilingGuid inferenceEventGuid = VerifyTimelineEventBinaryPacket( - EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset); + arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); // Inference - event relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), inferenceGuid, inferenceEventGuid, LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS, @@ -1090,11 +1094,11 @@ TEST_CASE("ProfilingEnableCpuRef") // Input workload execution // Input workload execution entity ProfilingGuid inputWorkloadExecutionGuid = VerifyTimelineEntityBinaryPacketData( - EmptyOptional(), readableData, offset); + arm::pipe::EmptyOptional(), readableData, offset); // Entity - Type relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), inputWorkloadExecutionGuid, LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID, LabelsAndEventClasses::TYPE_GUID, @@ -1103,7 +1107,7 @@ TEST_CASE("ProfilingEnableCpuRef") // Inference - Workload execution relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), inferenceGuid, inputWorkloadExecutionGuid, LabelsAndEventClasses::CHILD_GUID, @@ -1112,7 +1116,7 @@ TEST_CASE("ProfilingEnableCpuRef") // Workload - Workload execution relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), inputWorkloadGuid, inputWorkloadExecutionGuid, LabelsAndEventClasses::EXECUTION_OF_GUID, @@ -1122,11 +1126,11 @@ TEST_CASE("ProfilingEnableCpuRef") // Start Input workload execution life // Event packet - timeline, threadId, eventGuid ProfilingGuid inputWorkloadExecutionSOLEventId = VerifyTimelineEventBinaryPacket( - EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset); + arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); // Input workload execution - event relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), inputWorkloadExecutionGuid, inputWorkloadExecutionSOLEventId, LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS, @@ -1136,11 +1140,11 @@ TEST_CASE("ProfilingEnableCpuRef") // End of Input workload execution life // Event packet - timeline, threadId, eventGuid ProfilingGuid inputWorkloadExecutionEOLEventId = VerifyTimelineEventBinaryPacket( - EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset); + arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); // Input workload execution - event relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), inputWorkloadExecutionGuid, inputWorkloadExecutionEOLEventId, LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS, @@ -1150,11 +1154,11 @@ TEST_CASE("ProfilingEnableCpuRef") // Normalize workload execution // Normalize workload execution entity ProfilingGuid normalizeWorkloadExecutionGuid = VerifyTimelineEntityBinaryPacketData( - EmptyOptional(), readableData, offset); + arm::pipe::EmptyOptional(), readableData, offset); // Entity - Type relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), normalizeWorkloadExecutionGuid, LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID, LabelsAndEventClasses::TYPE_GUID, @@ -1163,7 +1167,7 @@ TEST_CASE("ProfilingEnableCpuRef") // Inference - Workload execution relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), inferenceGuid, normalizeWorkloadExecutionGuid, LabelsAndEventClasses::CHILD_GUID, @@ -1172,7 +1176,7 @@ TEST_CASE("ProfilingEnableCpuRef") // Workload - Workload execution relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), normalizationWorkloadGuid, normalizeWorkloadExecutionGuid, LabelsAndEventClasses::EXECUTION_OF_GUID, @@ -1182,11 +1186,11 @@ TEST_CASE("ProfilingEnableCpuRef") // Start Normalize workload execution life // Event packet - timeline, threadId, eventGuid ProfilingGuid normalizationWorkloadExecutionSOLEventGuid = VerifyTimelineEventBinaryPacket( - EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset); + arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); // Normalize workload execution - event relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), normalizeWorkloadExecutionGuid, normalizationWorkloadExecutionSOLEventGuid, LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS, @@ -1196,11 +1200,11 @@ TEST_CASE("ProfilingEnableCpuRef") // End of Normalize workload execution life // Event packet - timeline, threadId, eventGuid ProfilingGuid normalizationWorkloadExecutionEOLEventGuid = VerifyTimelineEventBinaryPacket( - EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset); + arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); // Normalize workload execution - event relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), normalizeWorkloadExecutionGuid, normalizationWorkloadExecutionEOLEventGuid, LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS, @@ -1210,11 +1214,11 @@ TEST_CASE("ProfilingEnableCpuRef") // Output workload execution // Output workload execution entity ProfilingGuid outputWorkloadExecutionGuid = VerifyTimelineEntityBinaryPacketData( - EmptyOptional(), readableData, offset); + arm::pipe::EmptyOptional(), readableData, offset); // Entity - Type relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), outputWorkloadExecutionGuid, LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID, LabelsAndEventClasses::TYPE_GUID, @@ -1223,7 +1227,7 @@ TEST_CASE("ProfilingEnableCpuRef") // Inference - Workload execution relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), inferenceGuid, outputWorkloadExecutionGuid, LabelsAndEventClasses::CHILD_GUID, @@ -1232,7 +1236,7 @@ TEST_CASE("ProfilingEnableCpuRef") // Workload - Workload execution relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), outputWorkloadGuid, outputWorkloadExecutionGuid, LabelsAndEventClasses::EXECUTION_OF_GUID, @@ -1242,11 +1246,11 @@ TEST_CASE("ProfilingEnableCpuRef") // Start Output workload execution life // Event packet - timeline, threadId, eventGuid ProfilingGuid outputWorkloadExecutionSOLEventGuid = VerifyTimelineEventBinaryPacket( - EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset); + arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); // Output workload execution - event relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), outputWorkloadExecutionGuid, outputWorkloadExecutionSOLEventGuid, LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS, @@ -1256,11 +1260,11 @@ TEST_CASE("ProfilingEnableCpuRef") // End of Normalize workload execution life // Event packet - timeline, threadId, eventGuid ProfilingGuid outputWorkloadExecutionEOLEventGuid = VerifyTimelineEventBinaryPacket( - EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset); + arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); // Output workload execution - event relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), outputWorkloadExecutionGuid, outputWorkloadExecutionEOLEventGuid, LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS, @@ -1270,11 +1274,11 @@ TEST_CASE("ProfilingEnableCpuRef") // End of Inference life // Event packet - timeline, threadId, eventGuid ProfilingGuid inferenceEOLEventGuid = VerifyTimelineEventBinaryPacket( - EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset); + arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); // Inference - event relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), inferenceGuid, inferenceEOLEventGuid, LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS, diff --git a/src/profiling/ActivateTimelineReportingCommandHandler.hpp b/src/profiling/ActivateTimelineReportingCommandHandler.hpp index ecc7076810..6b311fe851 100644 --- a/src/profiling/ActivateTimelineReportingCommandHandler.hpp +++ b/src/profiling/ActivateTimelineReportingCommandHandler.hpp @@ -10,12 +10,10 @@ #include "IReportStructure.hpp" #include "INotifyBackends.hpp" -#include "armnn/Optional.hpp" - #include +#include #include - namespace arm { @@ -30,7 +28,7 @@ public: uint32_t version, SendTimelinePacket& sendTimelinePacket, ProfilingStateMachine& profilingStateMachine, - armnn::Optional reportStructure, + arm::pipe::Optional reportStructure, std::atomic& timelineReporting, INotifyBackends& notifyBackends) : CommandHandlerFunctor(familyId, packetId, version), @@ -49,7 +47,7 @@ private: std::atomic& m_TimelineReporting; INotifyBackends& m_BackendNotifier; - armnn::Optional m_ReportStructure; + arm::pipe::Optional m_ReportStructure; }; } // namespace pipe diff --git a/src/profiling/ConnectionAcknowledgedCommandHandler.hpp b/src/profiling/ConnectionAcknowledgedCommandHandler.hpp index 9ea3bd4059..d69e0be5c1 100644 --- a/src/profiling/ConnectionAcknowledgedCommandHandler.hpp +++ b/src/profiling/ConnectionAcknowledgedCommandHandler.hpp @@ -35,8 +35,8 @@ public: ISendTimelinePacket& sendTimelinePacket, ProfilingStateMachine& profilingStateMachine, IProfilingServiceStatus& profilingServiceStatus, - armnn::Optional backendProfilingContexts = - armnn::EmptyOptional()) + arm::pipe::Optional backendProfilingContexts = + arm::pipe::EmptyOptional()) : CommandHandlerFunctor(familyId, packetId, version) , m_CounterDirectory(counterDirectory) , m_SendCounterPacket(sendCounterPacket) @@ -60,11 +60,10 @@ private: ISendTimelinePacket& m_SendTimelinePacket; ProfilingStateMachine& m_StateMachine; IProfilingServiceStatus& m_ProfilingServiceStatus; - armnn::Optional m_BackendProfilingContext; + arm::pipe::Optional m_BackendProfilingContext; std::atomic m_TimelineEnabled; }; } // namespace pipe } // namespace arm - diff --git a/src/profiling/CounterDirectory.cpp b/src/profiling/CounterDirectory.cpp index b8eddb4140..0f6147f833 100644 --- a/src/profiling/CounterDirectory.cpp +++ b/src/profiling/CounterDirectory.cpp @@ -50,7 +50,7 @@ const Category* CounterDirectory::RegisterCategory(const std::string& categoryNa const Device* CounterDirectory::RegisterDevice(const std::string& deviceName, uint16_t cores, - const armnn::Optional& parentCategoryName) + const arm::pipe::Optional& parentCategoryName) { // Check that the given device name is valid if (deviceName.empty() || @@ -112,7 +112,7 @@ const Device* CounterDirectory::RegisterDevice(const std::string& deviceName, const CounterSet* CounterDirectory::RegisterCounterSet(const std::string& counterSetName, uint16_t count, - const armnn::Optional& parentCategoryName) + const arm::pipe::Optional& parentCategoryName) { // Check that the given counter set name is valid if (counterSetName.empty() || @@ -184,10 +184,10 @@ const Counter* CounterDirectory::RegisterCounter(const std::string& applicationN double multiplier, const std::string& name, const std::string& description, - const armnn::Optional& units, - const armnn::Optional& numberOfCores, - const armnn::Optional& deviceUid, - const armnn::Optional& counterSetUid) + const arm::pipe::Optional& units, + const arm::pipe::Optional& numberOfCores, + const arm::pipe::Optional& deviceUid, + const arm::pipe::Optional& counterSetUid) { // Check that the given parent category name is valid if (parentCategoryName.empty() || @@ -498,7 +498,7 @@ CountersIt CounterDirectory::FindCounter(const std::string& counterName) const }); } -uint16_t CounterDirectory::GetNumberOfCores(const armnn::Optional& numberOfCores, +uint16_t CounterDirectory::GetNumberOfCores(const arm::pipe::Optional& numberOfCores, uint16_t deviceUid) { // To get the number of cores, apply the following rules: diff --git a/src/profiling/CounterDirectory.hpp b/src/profiling/CounterDirectory.hpp index b655f92b2f..ecc349edff 100644 --- a/src/profiling/CounterDirectory.hpp +++ b/src/profiling/CounterDirectory.hpp @@ -30,24 +30,24 @@ public: const Category* RegisterCategory (const std::string& categoryName) override; const Device* RegisterDevice (const std::string& deviceName, uint16_t cores = 0, - const armnn::Optional& parentCategoryName - = armnn::EmptyOptional()) override; + const arm::pipe::Optional& parentCategoryName + = arm::pipe::EmptyOptional()) override; const CounterSet* RegisterCounterSet(const std::string& counterSetName, uint16_t count = 0, - const armnn::Optional& parentCategoryName - = armnn::EmptyOptional()) override; + const arm::pipe::Optional& parentCategoryName + = arm::pipe::EmptyOptional()) override; const Counter* RegisterCounter(const std::string& backendId, - const uint16_t uid, - const std::string& parentCategoryName, - uint16_t counterClass, - uint16_t interpolation, - double multiplier, - const std::string& name, - const std::string& description, - const armnn::Optional& units = armnn::EmptyOptional(), - const armnn::Optional& numberOfCores = armnn::EmptyOptional(), - const armnn::Optional& deviceUid = armnn::EmptyOptional(), - const armnn::Optional& counterSetUid = armnn::EmptyOptional()) override; + const uint16_t uid, + const std::string& parentCategoryName, + uint16_t counterClass, + uint16_t interpolation, + double multiplier, + const std::string& name, + const std::string& description, + const arm::pipe::Optional& units = arm::pipe::EmptyOptional(), + const arm::pipe::Optional& numberOfCores = arm::pipe::EmptyOptional(), + const arm::pipe::Optional& deviceUid = arm::pipe::EmptyOptional(), + const arm::pipe::Optional& counterSetUid = arm::pipe::EmptyOptional()) override; // Getters for counts uint16_t GetCategoryCount() const override { return arm::pipe::numeric_cast(m_Categories.size()); } @@ -94,7 +94,7 @@ private: CounterSetsIt FindCounterSet(const std::string& counterSetName) const; CountersIt FindCounter(uint16_t counterUid) const; CountersIt FindCounter(const std::string& counterName) const; - uint16_t GetNumberOfCores(const armnn::Optional& numberOfCores, + uint16_t GetNumberOfCores(const arm::pipe::Optional& numberOfCores, uint16_t deviceUid); }; diff --git a/src/profiling/DirectoryCaptureCommandHandler.cpp b/src/profiling/DirectoryCaptureCommandHandler.cpp index ac11f68bd5..4011c9b1ff 100644 --- a/src/profiling/DirectoryCaptureCommandHandler.cpp +++ b/src/profiling/DirectoryCaptureCommandHandler.cpp @@ -289,7 +289,7 @@ std::vector DirectoryCaptureCommandHandler::ReadEve descriptionOffset + uint32_t_size); - eventRecords[i].m_CounterUnits = unitsOffset == 0 ? armnn::Optional() : + eventRecords[i].m_CounterUnits = unitsOffset == 0 ? arm::pipe::Optional() : GetStringNameFromBuffer(data, eventRecordsOffsets[i] + offset + unitsOffset + uint32_t_size); } diff --git a/src/profiling/DirectoryCaptureCommandHandler.hpp b/src/profiling/DirectoryCaptureCommandHandler.hpp index 751eae3c99..007cf05d18 100644 --- a/src/profiling/DirectoryCaptureCommandHandler.hpp +++ b/src/profiling/DirectoryCaptureCommandHandler.hpp @@ -26,7 +26,7 @@ struct CounterDirectoryEventRecord std::string m_CounterName; uint16_t m_CounterSetUid; uint16_t m_CounterUid; - armnn::Optional m_CounterUnits; + arm::pipe::Optional m_CounterUnits; uint16_t m_DeviceUid; uint16_t m_MaxCounterUid; }; diff --git a/src/profiling/FileOnlyProfilingConnection.hpp b/src/profiling/FileOnlyProfilingConnection.hpp index 190803f811..48fb4d37f2 100644 --- a/src/profiling/FileOnlyProfilingConnection.hpp +++ b/src/profiling/FileOnlyProfilingConnection.hpp @@ -6,9 +6,11 @@ #pragma once #include +#include + +#include "DirectoryCaptureCommandHandler.hpp" #include "IProfilingConnection.hpp" #include "ProfilingUtils.hpp" -#include "Runtime.hpp" #include #include @@ -16,6 +18,7 @@ #include #include #include +#include #include #include #include diff --git a/src/profiling/ICounterRegistry.hpp b/src/profiling/ICounterRegistry.hpp index 72b08a6f93..5c34e7a3de 100644 --- a/src/profiling/ICounterRegistry.hpp +++ b/src/profiling/ICounterRegistry.hpp @@ -5,7 +5,7 @@ #pragma once -#include +#include namespace arm { @@ -23,24 +23,24 @@ public: virtual const Device* RegisterDevice (const std::string& deviceName, uint16_t cores, - const armnn::Optional& parentCategoryName) = 0; + const arm::pipe::Optional& parentCategoryName) = 0; virtual const CounterSet* RegisterCounterSet(const std::string& counterSetName, uint16_t count, - const armnn::Optional& parentCategoryName) = 0; + const arm::pipe::Optional& parentCategoryName) = 0; virtual const Counter* RegisterCounter(const std::string& backendId, - const uint16_t uid, - const std::string& parentCategoryName, - uint16_t counterClass, - uint16_t interpolation, - double multiplier, - const std::string& name, - const std::string& description, - const armnn::Optional& units = armnn::EmptyOptional(), - const armnn::Optional& numberOfCores = armnn::EmptyOptional(), - const armnn::Optional& deviceUid = armnn::EmptyOptional(), - const armnn::Optional& counterSetUid = armnn::EmptyOptional()) = 0; + const uint16_t uid, + const std::string& parentCategoryName, + uint16_t counterClass, + uint16_t interpolation, + double multiplier, + const std::string& name, + const std::string& description, + const arm::pipe::Optional& units = arm::pipe::EmptyOptional(), + const arm::pipe::Optional& numberOfCores = arm::pipe::EmptyOptional(), + const arm::pipe::Optional& deviceUid = arm::pipe::EmptyOptional(), + const arm::pipe::Optional& counterSetUid = arm::pipe::EmptyOptional()) = 0; }; diff --git a/src/profiling/IProfilingService.cpp b/src/profiling/IProfilingService.cpp index cd85bb9327..3bae941a47 100644 --- a/src/profiling/IProfilingService.cpp +++ b/src/profiling/IProfilingService.cpp @@ -15,7 +15,7 @@ namespace pipe std::unique_ptr IProfilingService::CreateProfilingService( uint16_t maxGlobalCounterId, IInitialiseProfilingService& initialiser, - armnn::Optional reportStructure) + arm::pipe::Optional reportStructure) { return std::make_unique(maxGlobalCounterId, initialiser, reportStructure); } diff --git a/src/profiling/IProfilingService.hpp b/src/profiling/IProfilingService.hpp index 912265ee76..bc16860029 100644 --- a/src/profiling/IProfilingService.hpp +++ b/src/profiling/IProfilingService.hpp @@ -17,7 +17,8 @@ #include #include -#include + +#include #include namespace arm @@ -34,7 +35,7 @@ public: static std::unique_ptr CreateProfilingService( uint16_t maxGlobalCounterId, IInitialiseProfilingService& initialiser, - armnn::Optional reportStructure = armnn::EmptyOptional()); + arm::pipe::Optional reportStructure = arm::pipe::EmptyOptional()); virtual ~IProfilingService() {}; virtual std::unique_ptr GetSendTimelinePacket() const = 0; virtual const ICounterMappings& GetCounterMappings() const = 0; diff --git a/src/profiling/PeriodicCounterSelectionCommandHandler.hpp b/src/profiling/PeriodicCounterSelectionCommandHandler.hpp index 98a8ee0aec..103258ab88 100644 --- a/src/profiling/PeriodicCounterSelectionCommandHandler.hpp +++ b/src/profiling/PeriodicCounterSelectionCommandHandler.hpp @@ -81,7 +81,7 @@ private: const uint32_t capturePeriod, const std::vector counterIds) { - armnn::Optional errorMsg = + arm::pipe::Optional errorMsg = m_BackendProfilingContexts.at(backendId)->ActivateCounters(capturePeriod, counterIds); if(errorMsg.has_value()) diff --git a/src/profiling/ProfilingConnectionDumpToFileDecorator.hpp b/src/profiling/ProfilingConnectionDumpToFileDecorator.hpp index 2cbd98f9d1..5807947463 100644 --- a/src/profiling/ProfilingConnectionDumpToFileDecorator.hpp +++ b/src/profiling/ProfilingConnectionDumpToFileDecorator.hpp @@ -8,8 +8,7 @@ #include "IProfilingConnection.hpp" #include "ProfilingUtils.hpp" -#include -#include +#include #include #include diff --git a/src/profiling/ProfilingService.hpp b/src/profiling/ProfilingService.hpp index 22349d0808..e43642cf19 100644 --- a/src/profiling/ProfilingService.hpp +++ b/src/profiling/ProfilingService.hpp @@ -52,7 +52,7 @@ public: ProfilingService(uint16_t maxGlobalCounterId, IInitialiseProfilingService& initialiser, - armnn::Optional reportStructure = armnn::EmptyOptional()) + arm::pipe::Optional reportStructure = arm::pipe::EmptyOptional()) : m_Options() , m_TimelineReporting(false) , m_ProfilingConnectionFactory(new ProfilingConnectionFactory()) diff --git a/src/profiling/RegisterBackendCounters.cpp b/src/profiling/RegisterBackendCounters.cpp index dcafe3b226..79ffa20981 100644 --- a/src/profiling/RegisterBackendCounters.cpp +++ b/src/profiling/RegisterBackendCounters.cpp @@ -18,7 +18,7 @@ void RegisterBackendCounters::RegisterCategory(const std::string& categoryName) uint16_t RegisterBackendCounters::RegisterDevice(const std::string& deviceName, uint16_t cores, - const armnn::Optional& parentCategoryName) + const arm::pipe::Optional& parentCategoryName) { const Device* devicePtr = m_CounterDirectory.RegisterDevice(deviceName, cores, parentCategoryName); return devicePtr->m_Uid; @@ -26,7 +26,7 @@ uint16_t RegisterBackendCounters::RegisterDevice(const std::string& deviceName, uint16_t RegisterBackendCounters::RegisterCounterSet(const std::string& counterSetName, uint16_t count, - const armnn::Optional& parentCategoryName) + const arm::pipe::Optional& parentCategoryName) { const CounterSet* counterSetPtr = m_CounterDirectory.RegisterCounterSet(counterSetName, count, parentCategoryName); return counterSetPtr->m_Uid; @@ -39,10 +39,10 @@ uint16_t RegisterBackendCounters::RegisterCounter(const uint16_t uid, double multiplier, const std::string& name, const std::string& description, - const armnn::Optional& units, - const armnn::Optional& numberOfCores, - const armnn::Optional& deviceUid, - const armnn::Optional& counterSetUid) + const arm::pipe::Optional& units, + const arm::pipe::Optional& numberOfCores, + const arm::pipe::Optional& deviceUid, + const arm::pipe::Optional& counterSetUid) { ++m_CurrentMaxGlobalCounterID; const Counter* counterPtr = m_CounterDirectory.RegisterCounter(m_BackendId, diff --git a/src/profiling/RegisterBackendCounters.hpp b/src/profiling/RegisterBackendCounters.hpp index 88234df273..e3045b2b8c 100644 --- a/src/profiling/RegisterBackendCounters.hpp +++ b/src/profiling/RegisterBackendCounters.hpp @@ -33,12 +33,13 @@ public: uint16_t RegisterDevice(const std::string& deviceName, uint16_t cores = 0, - const armnn::Optional& parentCategoryName = armnn::EmptyOptional()) override; + const arm::pipe::Optional& parentCategoryName = + arm::pipe::EmptyOptional()) override; uint16_t RegisterCounterSet(const std::string& counterSetName, uint16_t count = 0, - const armnn::Optional& parentCategoryName - = armnn::EmptyOptional()) override; + const arm::pipe::Optional& parentCategoryName + = arm::pipe::EmptyOptional()) override; uint16_t RegisterCounter(const uint16_t uid, const std::string& parentCategoryName, @@ -47,10 +48,10 @@ public: double multiplier, const std::string& name, const std::string& description, - const armnn::Optional& units = armnn::EmptyOptional(), - const armnn::Optional& numberOfCores = armnn::EmptyOptional(), - const armnn::Optional& deviceUid = armnn::EmptyOptional(), - const armnn::Optional& counterSetUid = armnn::EmptyOptional()) override; + const arm::pipe::Optional& units = arm::pipe::EmptyOptional(), + const arm::pipe::Optional& numberOfCores = arm::pipe::EmptyOptional(), + const arm::pipe::Optional& deviceUid = arm::pipe::EmptyOptional(), + const arm::pipe::Optional& counterSetUid = arm::pipe::EmptyOptional()) override; private: uint16_t m_CurrentMaxGlobalCounterID; diff --git a/src/profiling/SocketProfilingConnection.cpp b/src/profiling/SocketProfilingConnection.cpp index 4787136685..a211567f7f 100644 --- a/src/profiling/SocketProfilingConnection.cpp +++ b/src/profiling/SocketProfilingConnection.cpp @@ -5,9 +5,10 @@ #include "SocketProfilingConnection.hpp" -#include "common/include/SocketConnectionException.hpp" +#include #include +#include #include #include @@ -149,7 +150,7 @@ arm::pipe::Packet SocketProfilingConnection::ReadPacket(uint32_t timeout) { // This is a corner case. The socket as been woken up but not with any data. // We'll throw a timeout exception to loop around again. - throw armnn::TimeoutException( + throw arm::pipe::TimeoutException( "SocketProfilingConnection: File descriptor was polled but no data was available to receive."); } diff --git a/src/profiling/SocketProfilingConnection.hpp b/src/profiling/SocketProfilingConnection.hpp index 31b17aa8fe..52616c9a27 100644 --- a/src/profiling/SocketProfilingConnection.hpp +++ b/src/profiling/SocketProfilingConnection.hpp @@ -5,7 +5,6 @@ #include "IProfilingConnection.hpp" -#include #include #pragma once diff --git a/src/profiling/test/ProfilingMocks.hpp b/src/profiling/test/ProfilingMocks.hpp index 4da167a7ec..1b5a36686c 100644 --- a/src/profiling/test/ProfilingMocks.hpp +++ b/src/profiling/test/ProfilingMocks.hpp @@ -13,11 +13,10 @@ #include #include -#include - #include #include #include +#include #include #include @@ -512,10 +511,10 @@ public: double multiplier, const std::string& name, const std::string& description, - const armnn::Optional& units = armnn::EmptyOptional(), - const armnn::Optional& numberOfCores = armnn::EmptyOptional(), - const armnn::Optional& deviceUid = armnn::EmptyOptional(), - const armnn::Optional& counterSetUid = armnn::EmptyOptional()) + const arm::pipe::Optional& units = arm::pipe::EmptyOptional(), + const arm::pipe::Optional& numberOfCores = arm::pipe::EmptyOptional(), + const arm::pipe::Optional& deviceUid = arm::pipe::EmptyOptional(), + const arm::pipe::Optional& counterSetUid = arm::pipe::EmptyOptional()) { arm::pipe::IgnoreUnused(backendId); diff --git a/src/profiling/test/ProfilingTestUtils.cpp b/src/profiling/test/ProfilingTestUtils.cpp index 2cd20b4716..7fe7069c01 100644 --- a/src/profiling/test/ProfilingTestUtils.cpp +++ b/src/profiling/test/ProfilingTestUtils.cpp @@ -102,7 +102,7 @@ void VerifyTimelineHeaderBinary(const unsigned char* readableData, offset += uint32_t_size; } -ProfilingGuid VerifyTimelineLabelBinaryPacketData(Optional guid, +ProfilingGuid VerifyTimelineLabelBinaryPacketData(arm::pipe::Optional guid, const std::string& label, const unsigned char* readableData, unsigned int& offset) @@ -177,10 +177,10 @@ void VerifyTimelineEventClassBinaryPacketData(ProfilingGuid guid, } void VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType relationshipType, - Optional relationshipGuid, - Optional headGuid, - Optional tailGuid, - Optional attributeGuid, + arm::pipe::Optional relationshipGuid, + arm::pipe::Optional headGuid, + arm::pipe::Optional tailGuid, + arm::pipe::Optional attributeGuid, const unsigned char* readableData, unsigned int& offset) { @@ -270,7 +270,7 @@ void VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType relati offset += uint64_t_size; } -ProfilingGuid VerifyTimelineEntityBinaryPacketData(Optional guid, +ProfilingGuid VerifyTimelineEntityBinaryPacketData(arm::pipe::Optional guid, const unsigned char* readableData, unsigned int& offset) { @@ -304,9 +304,9 @@ ProfilingGuid VerifyTimelineEntityBinaryPacketData(Optional guid, return entityGuid; } -ProfilingGuid VerifyTimelineEventBinaryPacket(Optional timestamp, - Optional threadId, - Optional eventGuid, +ProfilingGuid VerifyTimelineEventBinaryPacket(arm::pipe::Optional timestamp, + arm::pipe::Optional threadId, + arm::pipe::Optional eventGuid, const unsigned char* readableData, unsigned int& offset) { @@ -403,10 +403,10 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) }; ConstTensor weights(weightInfo, weightsData); - Optional optionalBiases; + armnn::Optional optionalBiases; std::vector biasesData{ 1.0f, 0.0f, 0.0f }; ConstTensor biases(biasInfo, biasesData); - optionalBiases = Optional(biases); + optionalBiases = armnn::Optional(biases); // Input layer IConnectableLayer* input = net->AddInputLayer(0, "input"); @@ -468,7 +468,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Entity - Type relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), optNetGuid, LabelsAndEventClasses::NETWORK_GUID, LabelsAndEventClasses::TYPE_GUID, @@ -476,15 +476,15 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) offset); // Network - START OF LIFE - ProfilingGuid networkSolEventGuid = VerifyTimelineEventBinaryPacket(EmptyOptional(), - EmptyOptional(), - EmptyOptional(), + ProfilingGuid networkSolEventGuid = VerifyTimelineEventBinaryPacket(arm::pipe::EmptyOptional(), + arm::pipe::EmptyOptional(), + arm::pipe::EmptyOptional(), readableData, offset); // Network - START OF LIFE event relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), optNetGuid, networkSolEventGuid, LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS, @@ -496,13 +496,14 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) std::stringstream ss; ss << processID; std::string processIdLabel = ss.str(); - VerifyTimelineLabelBinaryPacketData(EmptyOptional(), processIdLabel, readableData, offset); + VerifyTimelineLabelBinaryPacketData( + arm::pipe::EmptyOptional(), processIdLabel, readableData, offset); // Entity - Process ID relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), optNetGuid, - EmptyOptional(), + arm::pipe::EmptyOptional(), LabelsAndEventClasses::PROCESS_ID_GUID, readableData, offset); @@ -512,11 +513,12 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) VerifyTimelineEntityBinaryPacketData(input->GetGuid(), readableData, offset); // Name Entity - ProfilingGuid inputLabelGuid = VerifyTimelineLabelBinaryPacketData(EmptyOptional(), "input", readableData, offset); + ProfilingGuid inputLabelGuid = VerifyTimelineLabelBinaryPacketData( + arm::pipe::EmptyOptional(), "input", readableData, offset); // Entity - Name relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), input->GetGuid(), inputLabelGuid, LabelsAndEventClasses::NAME_GUID, @@ -525,7 +527,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Entity - Type relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), input->GetGuid(), LabelsAndEventClasses::LAYER_GUID, LabelsAndEventClasses::TYPE_GUID, @@ -534,7 +536,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Network - Input layer relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), optNetGuid, input->GetGuid(), LabelsAndEventClasses::CHILD_GUID, @@ -547,11 +549,11 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Name entity ProfilingGuid conv2dNameLabelGuid = VerifyTimelineLabelBinaryPacketData( - EmptyOptional(), "", readableData, offset); + arm::pipe::EmptyOptional(), "", readableData, offset); // Entity - Name relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), conv2d->GetGuid(), conv2dNameLabelGuid, LabelsAndEventClasses::NAME_GUID, @@ -560,7 +562,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Entity - Type relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), conv2d->GetGuid(), LabelsAndEventClasses::LAYER_GUID, LabelsAndEventClasses::TYPE_GUID, @@ -569,7 +571,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Network - Conv2d layer relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), optNetGuid, conv2d->GetGuid(), LabelsAndEventClasses::CHILD_GUID, @@ -578,7 +580,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Input layer - Conv2d layer relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), input->GetGuid(), conv2d->GetGuid(), LabelsAndEventClasses::CONNECTION_GUID, @@ -587,11 +589,12 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Conv2d workload // Conv2d workload entity - ProfilingGuid conv2DWorkloadGuid = VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset); + ProfilingGuid conv2DWorkloadGuid = VerifyTimelineEntityBinaryPacketData( + arm::pipe::EmptyOptional(), readableData, offset); // Entity - Type relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), conv2DWorkloadGuid, LabelsAndEventClasses::WORKLOAD_GUID, LabelsAndEventClasses::TYPE_GUID, @@ -600,11 +603,11 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // BackendId entity ProfilingGuid backendIdLabelGuid = VerifyTimelineLabelBinaryPacketData( - EmptyOptional(), backendId.Get(), readableData, offset); + arm::pipe::EmptyOptional(), backendId.Get(), readableData, offset); // Entity - BackendId relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), conv2DWorkloadGuid, backendIdLabelGuid, LabelsAndEventClasses::BACKENDID_GUID, @@ -614,7 +617,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Conv2d layer - Conv2d workload relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), conv2d->GetGuid(), conv2DWorkloadGuid, LabelsAndEventClasses::CHILD_GUID, @@ -627,11 +630,11 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Name entity ProfilingGuid absLabelGuid = VerifyTimelineLabelBinaryPacketData( - EmptyOptional(), "abs", readableData, offset); + arm::pipe::EmptyOptional(), "abs", readableData, offset); // Entity - Name relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), abs->GetGuid(), absLabelGuid, LabelsAndEventClasses::NAME_GUID, @@ -640,7 +643,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Entity - Type relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), abs->GetGuid(), LabelsAndEventClasses::LAYER_GUID, LabelsAndEventClasses::TYPE_GUID, @@ -649,7 +652,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Network - Abs layer relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), optNetGuid, abs->GetGuid(), LabelsAndEventClasses::CHILD_GUID, @@ -658,7 +661,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Conv2d layer - Abs layer relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), conv2d->GetGuid(), abs->GetGuid(), LabelsAndEventClasses::CONNECTION_GUID, @@ -667,11 +670,12 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Abs workload // Abs workload entity - ProfilingGuid absWorkloadGuid = VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset); + ProfilingGuid absWorkloadGuid = VerifyTimelineEntityBinaryPacketData( + arm::pipe::EmptyOptional(), readableData, offset); // Entity - Type relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), absWorkloadGuid, LabelsAndEventClasses::WORKLOAD_GUID, LabelsAndEventClasses::TYPE_GUID, @@ -679,11 +683,11 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) offset); // BackendId entity - VerifyTimelineLabelBinaryPacketData(EmptyOptional(), backendId.Get(), readableData, offset); + VerifyTimelineLabelBinaryPacketData(arm::pipe::EmptyOptional(), backendId.Get(), readableData, offset); // Entity - BackendId relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), absWorkloadGuid, backendIdLabelGuid, LabelsAndEventClasses::BACKENDID_GUID, @@ -692,7 +696,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Abs layer - Abs workload relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), abs->GetGuid(), absWorkloadGuid, LabelsAndEventClasses::CHILD_GUID, @@ -705,11 +709,11 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Name entity ProfilingGuid outputLabelGuid = VerifyTimelineLabelBinaryPacketData( - EmptyOptional(), "output", readableData, offset); + arm::pipe::EmptyOptional(), "output", readableData, offset); // Entity - Name relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), output->GetGuid(), outputLabelGuid, LabelsAndEventClasses::NAME_GUID, @@ -718,7 +722,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Entity - Type relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), output->GetGuid(), LabelsAndEventClasses::LAYER_GUID, LabelsAndEventClasses::TYPE_GUID, @@ -727,7 +731,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Network - Output layer relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), optNetGuid, output->GetGuid(), LabelsAndEventClasses::CHILD_GUID, @@ -736,7 +740,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Abs layer - Output layer relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), abs->GetGuid(), output->GetGuid(), LabelsAndEventClasses::CONNECTION_GUID, @@ -789,11 +793,12 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Input workload // Input workload entity - ProfilingGuid inputWorkloadGuid = VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset); + ProfilingGuid inputWorkloadGuid = VerifyTimelineEntityBinaryPacketData( + arm::pipe::EmptyOptional(), readableData, offset); // Entity - Type relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), inputWorkloadGuid, LabelsAndEventClasses::WORKLOAD_GUID, LabelsAndEventClasses::TYPE_GUID, @@ -801,11 +806,11 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) offset); // BackendId entity - VerifyTimelineLabelBinaryPacketData(EmptyOptional(), backendId.Get(), readableData, offset); + VerifyTimelineLabelBinaryPacketData(arm::pipe::EmptyOptional(), backendId.Get(), readableData, offset); // Entity - BackendId relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), inputWorkloadGuid, backendIdLabelGuid, LabelsAndEventClasses::BACKENDID_GUID, @@ -814,7 +819,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Input layer - Input workload relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), input->GetGuid(), inputWorkloadGuid, LabelsAndEventClasses::CHILD_GUID, @@ -837,11 +842,12 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Output workload // Output workload entity - ProfilingGuid outputWorkloadGuid = VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset); + ProfilingGuid outputWorkloadGuid = VerifyTimelineEntityBinaryPacketData( + arm::pipe::EmptyOptional(), readableData, offset); // Entity - Type relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), outputWorkloadGuid, LabelsAndEventClasses::WORKLOAD_GUID, LabelsAndEventClasses::TYPE_GUID, @@ -849,11 +855,11 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) offset); // BackendId entity - VerifyTimelineLabelBinaryPacketData(EmptyOptional(), backendId.Get(), readableData, offset); + VerifyTimelineLabelBinaryPacketData(arm::pipe::EmptyOptional(), backendId.Get(), readableData, offset); // Entity - BackendId relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), outputWorkloadGuid, backendIdLabelGuid, LabelsAndEventClasses::BACKENDID_GUID, @@ -862,7 +868,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Output layer - Output workload relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), output->GetGuid(), outputWorkloadGuid, LabelsAndEventClasses::CHILD_GUID, @@ -886,11 +892,12 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Inference timeline trace // Inference entity - ProfilingGuid inferenceGuid = VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset); + ProfilingGuid inferenceGuid = VerifyTimelineEntityBinaryPacketData( + arm::pipe::EmptyOptional(), readableData, offset); // Entity - Type relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), inferenceGuid, LabelsAndEventClasses::INFERENCE_GUID, LabelsAndEventClasses::TYPE_GUID, @@ -899,7 +906,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Network - Inference relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), optNetGuid, inferenceGuid, LabelsAndEventClasses::EXECUTION_OF_GUID, @@ -909,11 +916,11 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Start Inference life // Event packet - timeline, threadId, eventGuid ProfilingGuid inferenceEventGuid = VerifyTimelineEventBinaryPacket( - EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset); + arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); // Inference - event relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), inferenceGuid, inferenceEventGuid, LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS, @@ -924,11 +931,11 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Input workload execution // Input workload execution entity ProfilingGuid inputWorkloadExecutionGuid = VerifyTimelineEntityBinaryPacketData( - EmptyOptional(), readableData, offset); + arm::pipe::EmptyOptional(), readableData, offset); // Entity - Type relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), inputWorkloadExecutionGuid, LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID, LabelsAndEventClasses::TYPE_GUID, @@ -937,7 +944,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Inference - Workload execution relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), inferenceGuid, inputWorkloadExecutionGuid, LabelsAndEventClasses::CHILD_GUID, @@ -946,7 +953,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Workload - Workload execution relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), inputWorkloadGuid, inputWorkloadExecutionGuid, LabelsAndEventClasses::EXECUTION_OF_GUID, @@ -956,11 +963,11 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Start Input workload execution life // Event packet - timeline, threadId, eventGuid ProfilingGuid inputWorkloadExecutionSOLEventId = VerifyTimelineEventBinaryPacket( - EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset); + arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); // Input workload execution - event relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), inputWorkloadExecutionGuid, inputWorkloadExecutionSOLEventId, LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS, @@ -970,11 +977,11 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // End of Input workload execution life // Event packet - timeline, threadId, eventGuid ProfilingGuid inputWorkloadExecutionEOLEventId = VerifyTimelineEventBinaryPacket( - EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset); + arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); // Input workload execution - event relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), inputWorkloadExecutionGuid, inputWorkloadExecutionEOLEventId, LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS, @@ -984,11 +991,11 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Conv2d workload execution // Conv2d workload execution entity ProfilingGuid conv2DWorkloadExecutionGuid = VerifyTimelineEntityBinaryPacketData( - EmptyOptional(), readableData, offset); + arm::pipe::EmptyOptional(), readableData, offset); // Entity - Type relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), conv2DWorkloadExecutionGuid, LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID, LabelsAndEventClasses::TYPE_GUID, @@ -997,7 +1004,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Inference - Workload execution relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), inferenceGuid, conv2DWorkloadExecutionGuid, LabelsAndEventClasses::CHILD_GUID, @@ -1006,7 +1013,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Workload - Workload execution relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), conv2DWorkloadGuid, conv2DWorkloadExecutionGuid, LabelsAndEventClasses::EXECUTION_OF_GUID, @@ -1016,11 +1023,11 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Start Conv2d workload execution life // Event packet - timeline, threadId, eventGuid ProfilingGuid conv2DWorkloadExecutionSOLEventGuid = VerifyTimelineEventBinaryPacket( - EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset); + arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); // Conv2d workload execution - event relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), conv2DWorkloadExecutionGuid, conv2DWorkloadExecutionSOLEventGuid, LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS, @@ -1030,11 +1037,11 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // End of Conv2d workload execution life // Event packet - timeline, threadId, eventGuid ProfilingGuid conv2DWorkloadExecutionEOLEventGuid = VerifyTimelineEventBinaryPacket( - EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset); + arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); // Conv2d workload execution - event relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), conv2DWorkloadExecutionGuid, conv2DWorkloadExecutionEOLEventGuid, LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS, @@ -1044,11 +1051,11 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Abs workload execution // Abs workload execution entity ProfilingGuid absWorkloadExecutionGuid = VerifyTimelineEntityBinaryPacketData( - EmptyOptional(), readableData, offset); + arm::pipe::EmptyOptional(), readableData, offset); // Entity - Type relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), absWorkloadExecutionGuid, LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID, LabelsAndEventClasses::TYPE_GUID, @@ -1057,7 +1064,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Inference - Workload execution relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), inferenceGuid, absWorkloadExecutionGuid, LabelsAndEventClasses::CHILD_GUID, @@ -1066,7 +1073,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Workload - Workload execution relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), absWorkloadGuid, absWorkloadExecutionGuid, LabelsAndEventClasses::EXECUTION_OF_GUID, @@ -1076,11 +1083,11 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Start Abs workload execution life // Event packet - timeline, threadId, eventGuid ProfilingGuid absWorkloadExecutionSOLEventGuid = VerifyTimelineEventBinaryPacket( - EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset); + arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); // Abs workload execution - event relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), absWorkloadExecutionGuid, absWorkloadExecutionSOLEventGuid, LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS, @@ -1090,11 +1097,11 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // End of Abs workload execution life // Event packet - timeline, threadId, eventGuid ProfilingGuid absWorkloadExecutionEOLEventGuid = VerifyTimelineEventBinaryPacket( - EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset); + arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); // Abs workload execution - event relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), absWorkloadExecutionGuid, absWorkloadExecutionEOLEventGuid, LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS, @@ -1104,11 +1111,11 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Output workload execution // Output workload execution entity ProfilingGuid outputWorkloadExecutionGuid = VerifyTimelineEntityBinaryPacketData( - EmptyOptional(), readableData, offset); + arm::pipe::EmptyOptional(), readableData, offset); // Entity - Type relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), outputWorkloadExecutionGuid, LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID, LabelsAndEventClasses::TYPE_GUID, @@ -1117,7 +1124,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Inference - Workload execution relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), inferenceGuid, outputWorkloadExecutionGuid, LabelsAndEventClasses::CHILD_GUID, @@ -1126,7 +1133,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Workload - Workload execution relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), outputWorkloadGuid, outputWorkloadExecutionGuid, LabelsAndEventClasses::EXECUTION_OF_GUID, @@ -1136,11 +1143,11 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Start Output workload execution life // Event packet - timeline, threadId, eventGuid ProfilingGuid outputWorkloadExecutionSOLEventGuid = VerifyTimelineEventBinaryPacket( - EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset); + arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); // Output workload execution - event relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), outputWorkloadExecutionGuid, outputWorkloadExecutionSOLEventGuid, LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS, @@ -1150,11 +1157,11 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // End of Normalize workload execution life // Event packet - timeline, threadId, eventGuid ProfilingGuid outputWorkloadExecutionEOLEventGuid = VerifyTimelineEventBinaryPacket( - EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset); + arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); // Output workload execution - event relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), outputWorkloadExecutionGuid, outputWorkloadExecutionEOLEventGuid, LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS, @@ -1164,11 +1171,11 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // End of Inference life // Event packet - timeline, threadId, eventGuid ProfilingGuid inferenceEOLEventGuid = VerifyTimelineEventBinaryPacket( - EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset); + arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); // Inference - event relationship VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), inferenceGuid, inferenceEOLEventGuid, LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS, diff --git a/src/profiling/test/ProfilingTestUtils.hpp b/src/profiling/test/ProfilingTestUtils.hpp index 32db72a19d..b4aa372a98 100644 --- a/src/profiling/test/ProfilingTestUtils.hpp +++ b/src/profiling/test/ProfilingTestUtils.hpp @@ -8,10 +8,10 @@ #include "ProfilingUtils.hpp" #include "Runtime.hpp" -#include #include #include +#include #include using namespace armnn; @@ -30,7 +30,7 @@ void VerifyTimelineHeaderBinary(const unsigned char* readableData, unsigned int& offset, uint32_t packetDataLength); -ProfilingGuid VerifyTimelineLabelBinaryPacketData(Optional guid, +ProfilingGuid VerifyTimelineLabelBinaryPacketData(arm::pipe::Optional guid, const std::string& label, const unsigned char* readableData, unsigned int& offset); @@ -41,20 +41,20 @@ void VerifyTimelineEventClassBinaryPacketData(ProfilingGuid guid, unsigned int& offset); void VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType relationshipType, - Optional relationshipGuid, - Optional headGuid, - Optional tailGuid, - Optional attributeGuid, + arm::pipe::Optional relationshipGuid, + arm::pipe::Optional headGuid, + arm::pipe::Optional tailGuid, + arm::pipe::Optional attributeGuid, const unsigned char* readableData, unsigned int& offset); -ProfilingGuid VerifyTimelineEntityBinaryPacketData(Optional guid, +ProfilingGuid VerifyTimelineEntityBinaryPacketData(arm::pipe::Optional guid, const unsigned char* readableData, unsigned int& offset); -ProfilingGuid VerifyTimelineEventBinaryPacket(Optional timestamp, - Optional threadId, - Optional eventGuid, +ProfilingGuid VerifyTimelineEventBinaryPacket(arm::pipe::Optional timestamp, + arm::pipe::Optional threadId, + arm::pipe::Optional eventGuid, const unsigned char* readableData, unsigned int& offset); diff --git a/src/profiling/test/ProfilingTests.cpp b/src/profiling/test/ProfilingTests.cpp index 08513182b5..d635ca3fa5 100644 --- a/src/profiling/test/ProfilingTests.cpp +++ b/src/profiling/test/ProfilingTests.cpp @@ -1432,8 +1432,8 @@ TEST_CASE("CheckCounterDirectoryRegisterCounter") 123.45f, "valid name 3", "valid description", - armnn::EmptyOptional(),// Units - armnn::EmptyOptional(),// Number of cores + arm::pipe::EmptyOptional(),// Units + arm::pipe::EmptyOptional(),// Number of cores 0)); // Device UID CHECK(counterDirectory.GetCounterCount() == 3); CHECK(counterWoDevice); @@ -1459,8 +1459,8 @@ TEST_CASE("CheckCounterDirectoryRegisterCounter") 123.45f, "valid name 4", "valid description", - armnn::EmptyOptional(), // Units - armnn::EmptyOptional(), // Number of cores + arm::pipe::EmptyOptional(), // Units + arm::pipe::EmptyOptional(), // Number of cores 100), // Device UID arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterCount() == 3); @@ -1486,8 +1486,8 @@ TEST_CASE("CheckCounterDirectoryRegisterCounter") 123.45f, "valid name 5", std::string("valid description"), - armnn::EmptyOptional(), // Units - armnn::EmptyOptional(), // Number of cores + arm::pipe::EmptyOptional(), // Units + arm::pipe::EmptyOptional(), // Number of cores device->m_Uid)); // Device UID CHECK(counterDirectory.GetCounterCount() == 4); CHECK(counterWDevice); @@ -1514,9 +1514,9 @@ TEST_CASE("CheckCounterDirectoryRegisterCounter") 123.45f, "valid name 6", "valid description", - armnn::EmptyOptional(),// Units - armnn::EmptyOptional(),// No of cores - armnn::EmptyOptional(),// Device UID + arm::pipe::EmptyOptional(),// Units + arm::pipe::EmptyOptional(),// No of cores + arm::pipe::EmptyOptional(),// Device UID 0)); // CounterSet UID CHECK(counterDirectory.GetCounterCount() == 5); CHECK(counterWoCounterSet); @@ -1543,8 +1543,8 @@ TEST_CASE("CheckCounterDirectoryRegisterCounter") "valid ", "name 7", std::string("valid description"), - armnn::EmptyOptional(), // Units - armnn::EmptyOptional(), // Number of cores + arm::pipe::EmptyOptional(), // Units + arm::pipe::EmptyOptional(), // Number of cores 100), // Counter set UID arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterCount() == 5); @@ -1556,10 +1556,10 @@ TEST_CASE("CheckCounterDirectoryRegisterCounter") CHECK_NOTHROW(counterWNumberOfCores = counterDirectory.RegisterCounter( armnn::profiling::BACKEND_ID, 50, categoryName, 0, 1, 123.45f, "valid name 8", "valid description", - armnn::EmptyOptional(), // Units + arm::pipe::EmptyOptional(), // Units numberOfCores, // Number of cores - armnn::EmptyOptional(), // Device UID - armnn::EmptyOptional())); // Counter set UID + arm::pipe::EmptyOptional(), // Device UID + arm::pipe::EmptyOptional())); // Counter set UID CHECK(counterDirectory.GetCounterCount() == 20); CHECK(counterWNumberOfCores); CHECK(counterWNumberOfCores->m_Uid > counter->m_Uid); @@ -1594,10 +1594,10 @@ TEST_CASE("CheckCounterDirectoryRegisterCounter") CHECK_NOTHROW(counterWMultiCoreDevice = counterDirectory.RegisterCounter( armnn::profiling::BACKEND_ID, 19, categoryName, 0, 1, 123.45f, "valid name 9", "valid description", - armnn::EmptyOptional(), // Units - armnn::EmptyOptional(), // Number of cores + arm::pipe::EmptyOptional(), // Units + arm::pipe::EmptyOptional(), // Number of cores multiCoreDevice->m_Uid, // Device UID - armnn::EmptyOptional())); // Counter set UID + arm::pipe::EmptyOptional())); // Counter set UID CHECK(counterDirectory.GetCounterCount() == 24); CHECK(counterWMultiCoreDevice); CHECK(counterWMultiCoreDevice->m_Uid > counter->m_Uid); @@ -1642,10 +1642,10 @@ TEST_CASE("CheckCounterDirectoryRegisterCounter") 123.45f, "valid name 10", "valid description", - armnn::EmptyOptional(), // Units + arm::pipe::EmptyOptional(), // Units numberOfCourse, // Number of cores - armnn::EmptyOptional(), // Device UID - armnn::EmptyOptional()));// Counter set UID + arm::pipe::EmptyOptional(), // Device UID + arm::pipe::EmptyOptional()));// Counter set UID CHECK(counterDirectory.GetCounterCount() == 26); CHECK(counterWMultiCoreDeviceWParentCategory); CHECK(counterWMultiCoreDeviceWParentCategory->m_Uid > counter->m_Uid); @@ -1679,9 +1679,9 @@ TEST_CASE("CheckCounterDirectoryRegisterCounter") CHECK_NOTHROW(counterWCounterSet = counterDirectory.RegisterCounter( armnn::profiling::BACKEND_ID, 300, categoryName, 0, 1, 123.45f, "valid name 11", "valid description", - armnn::EmptyOptional(), // Units + arm::pipe::EmptyOptional(), // Units 0, // Number of cores - armnn::EmptyOptional(), // Device UID + arm::pipe::EmptyOptional(), // Device UID counterSet->m_Uid)); // Counter set UID CHECK(counterDirectory.GetCounterCount() == 27); CHECK(counterWCounterSet); @@ -1703,7 +1703,7 @@ TEST_CASE("CheckCounterDirectoryRegisterCounter") CHECK_NOTHROW(counterWDeviceWCounterSet = counterDirectory.RegisterCounter( armnn::profiling::BACKEND_ID, 23, categoryName, 0, 1, 123.45f, "valid name 12", "valid description", - armnn::EmptyOptional(), // Units + arm::pipe::EmptyOptional(), // Units 1, // Number of cores device->m_Uid, // Device UID counterSet->m_Uid)); // Counter set UID @@ -1737,8 +1737,8 @@ TEST_CASE("CheckCounterDirectoryRegisterCounter") CHECK_NOTHROW(anotherCounter = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, 24, anotherCategoryName, 1, 0, .00043f, "valid name", "valid description", - armnn::EmptyOptional(), // Units - armnn::EmptyOptional(), // Number of cores + arm::pipe::EmptyOptional(), // Units + arm::pipe::EmptyOptional(), // Number of cores device->m_Uid, // Device UID counterSet->m_Uid)); // Counter set UID CHECK(counterDirectory.GetCounterCount() == 29); diff --git a/src/profiling/test/SendCounterPacketTests.cpp b/src/profiling/test/SendCounterPacketTests.cpp index abd4cee600..bdc1d5167d 100644 --- a/src/profiling/test/SendCounterPacketTests.cpp +++ b/src/profiling/test/SendCounterPacketTests.cpp @@ -1251,7 +1251,7 @@ TEST_CASE("SendCounterDirectoryPacketTest2") "counter2", "counter2description", std::string("counter2units"), - armnn::EmptyOptional(), + arm::pipe::EmptyOptional(), device2->m_Uid, 0)); CHECK(counterDirectory.GetCounterCount() == 5); @@ -1267,7 +1267,7 @@ TEST_CASE("SendCounterDirectoryPacketTest2") 0.0000045399f, "counter3", "counter3description", - armnn::EmptyOptional(), + arm::pipe::EmptyOptional(), numberOfCores, device2->m_Uid, counterSet1->m_Uid)); diff --git a/src/profiling/test/SendCounterPacketTests.hpp b/src/profiling/test/SendCounterPacketTests.hpp index 1f1c3f0b27..626377a960 100644 --- a/src/profiling/test/SendCounterPacketTests.hpp +++ b/src/profiling/test/SendCounterPacketTests.hpp @@ -10,8 +10,6 @@ #include #include -#include - #include #include diff --git a/src/profiling/test/TimelineUtilityMethodsTests.cpp b/src/profiling/test/TimelineUtilityMethodsTests.cpp index 422bc1389d..7e95df1c14 100644 --- a/src/profiling/test/TimelineUtilityMethodsTests.cpp +++ b/src/profiling/test/TimelineUtilityMethodsTests.cpp @@ -60,13 +60,13 @@ TEST_CASE("CreateTypedLabelTest") VerifyTimelineHeaderBinary(readableData, offset, 68); // First dataset sent: TimelineLabelBinaryPacket - VerifyTimelineLabelBinaryPacketData(EmptyOptional(), entityName, readableData, offset); + VerifyTimelineLabelBinaryPacketData(arm::pipe::EmptyOptional(), entityName, readableData, offset); // Second dataset sent: TimelineRelationshipBinaryPacket VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), entityGuid, - EmptyOptional(), + arm::pipe::EmptyOptional(), labelTypeGuid, readableData, offset); @@ -251,28 +251,28 @@ TEST_CASE("CreateNamedTypedChildEntityTest") VerifyTimelineHeaderBinary(readableData, offset, 188); // First dataset sent: TimelineEntityBinaryPacket - VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset); + VerifyTimelineEntityBinaryPacketData(arm::pipe::EmptyOptional(), readableData, offset); // Second dataset sent: TimelineLabelBinaryPacket - VerifyTimelineLabelBinaryPacketData(EmptyOptional(), entityName, readableData, offset); + VerifyTimelineLabelBinaryPacketData(arm::pipe::EmptyOptional(), entityName, readableData, offset); // Third dataset sent: TimelineRelationshipBinaryPacket VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), - EmptyOptional(), - EmptyOptional(), + arm::pipe::EmptyOptional(), + arm::pipe::EmptyOptional(), + arm::pipe::EmptyOptional(), LabelsAndEventClasses::NAME_GUID, readableData, offset); // Fifth dataset sent: TimelineLabelBinaryPacket - VerifyTimelineLabelBinaryPacketData(EmptyOptional(), entityType, readableData, offset); + VerifyTimelineLabelBinaryPacketData(arm::pipe::EmptyOptional(), entityType, readableData, offset); // Sixth dataset sent: TimelineRelationshipBinaryPacket VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), - EmptyOptional(), - EmptyOptional(), + arm::pipe::EmptyOptional(), + arm::pipe::EmptyOptional(), + arm::pipe::EmptyOptional(), LabelsAndEventClasses::TYPE_GUID, readableData, offset); @@ -280,10 +280,10 @@ TEST_CASE("CreateNamedTypedChildEntityTest") // Eighth dataset sent: TimelineRelationshipBinaryPacket VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), parentEntityGuid, - EmptyOptional(), - EmptyOptional(), + arm::pipe::EmptyOptional(), + arm::pipe::EmptyOptional(), readableData, offset); @@ -386,26 +386,26 @@ TEST_CASE("CreateNameTypeEntityTest") // Packets for Name Entity // First dataset sent: TimelineLabelBinaryPacket - VerifyTimelineLabelBinaryPacketData(EmptyOptional(), entityName, readableData, offset); + VerifyTimelineLabelBinaryPacketData(arm::pipe::EmptyOptional(), entityName, readableData, offset); // Second dataset sent: TimelineRelationshipBinaryPacket VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), - EmptyOptional(), - EmptyOptional(), + arm::pipe::EmptyOptional(), + arm::pipe::EmptyOptional(), + arm::pipe::EmptyOptional(), LabelsAndEventClasses::NAME_GUID, readableData, offset); // Packets for Type Entity // First dataset sent: TimelineLabelBinaryPacket - VerifyTimelineLabelBinaryPacketData(EmptyOptional(), entityType, readableData, offset); + VerifyTimelineLabelBinaryPacketData(arm::pipe::EmptyOptional(), entityType, readableData, offset); // Second dataset sent: TimelineRelationshipBinaryPacket VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, - EmptyOptional(), - EmptyOptional(), - EmptyOptional(), + arm::pipe::EmptyOptional(), + arm::pipe::EmptyOptional(), + arm::pipe::EmptyOptional(), LabelsAndEventClasses::TYPE_GUID, readableData, offset); @@ -451,11 +451,12 @@ TEST_CASE("RecordEventTest") VerifyTimelineHeaderBinary(readableData, offset, 60 + ThreadIdSize); // First dataset sent: TimelineEntityBinaryPacket - VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset); + VerifyTimelineEventBinaryPacket( + arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); // Second dataset sent: TimelineRelationshipBinaryPacket VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, - EmptyOptional(), + arm::pipe::EmptyOptional(), entityGuid, eventGuid, eventClassGuid, -- cgit v1.2.1