diff options
162 files changed, 1163 insertions, 1199 deletions
diff --git a/delegate/include/DelegateOptions.hpp b/delegate/include/DelegateOptions.hpp index 5aa7939e4b..d8c4139083 100644 --- a/delegate/include/DelegateOptions.hpp +++ b/delegate/include/DelegateOptions.hpp @@ -230,10 +230,10 @@ public: const armnn::ProfilingDetailsMethod& GetInternalProfilingDetail() const { return m_InternalProfilingDetail; } void SetExternalProfilingParams( - const armnn::profiling::ProfilingOptions& externalProfilingParams) + const arm::pipe::ProfilingOptions& externalProfilingParams) { m_ProfilingOptions = externalProfilingParams; } - const armnn::profiling::ProfilingOptions& GetExternalProfilingParams() const + const arm::pipe::ProfilingOptions& GetExternalProfilingParams() const { return m_ProfilingOptions; } void SetSerializeToDot(const std::string& serializeToDotFile) { m_SerializeToDot = serializeToDotFile; } @@ -265,7 +265,7 @@ private: armnn::OptimizerOptions m_OptimizerOptions; /// External profiling options. - armnn::profiling::ProfilingOptions m_ProfilingOptions; + arm::pipe::ProfilingOptions m_ProfilingOptions; /// Internal profiling options. /// Indicates whether internal profiling is enabled or not. diff --git a/delegate/include/Version.hpp b/delegate/include/Version.hpp index 88cf8ed4b4..34555b2c6f 100644 --- a/delegate/include/Version.hpp +++ b/delegate/include/Version.hpp @@ -13,8 +13,8 @@ namespace armnnDelegate #define STRINGIFY_MACRO(s) #s // ArmNN Delegate version components -#define DELEGATE_MAJOR_VERSION 25 -#define DELEGATE_MINOR_VERSION 1 +#define DELEGATE_MAJOR_VERSION 26 +#define DELEGATE_MINOR_VERSION 0 #define DELEGATE_PATCH_VERSION 0 /// DELEGATE_VERSION: "X.Y.Z" diff --git a/delegate/src/DelegateOptions.cpp b/delegate/src/DelegateOptions.cpp index 5cfddadf99..9413a4689a 100644 --- a/delegate/src/DelegateOptions.cpp +++ b/delegate/src/DelegateOptions.cpp @@ -59,7 +59,7 @@ DelegateOptions::DelegateOptions(char const* const* options_keys, armnn::OptimizerOptions optimizerOptions; bool internalProfilingState = false; armnn::ProfilingDetailsMethod internalProfilingDetail = armnn::ProfilingDetailsMethod::DetailsWithEvents; - armnn::profiling::ProfilingOptions extProfilingParams; + arm::pipe::ProfilingOptions extProfilingParams; for (size_t i = 0; i < num_options; ++i) { // Process backends diff --git a/delegate/src/MultiLayerFacade.hpp b/delegate/src/MultiLayerFacade.hpp index 02be26cefd..c0df47bac9 100644 --- a/delegate/src/MultiLayerFacade.hpp +++ b/delegate/src/MultiLayerFacade.hpp @@ -91,7 +91,7 @@ public: return m_FirstLayer->InferOutputShapes(inputShapes); } - virtual armnn::LayerGuid GetGuid() const override + virtual LayerGuid GetGuid() const override { return m_FirstLayer->GetGuid(); } diff --git a/delegate/src/test/DelegateOptionsTest.cpp b/delegate/src/test/DelegateOptionsTest.cpp index 54f9c8f0e3..126bf30a25 100644 --- a/delegate/src/test/DelegateOptionsTest.cpp +++ b/delegate/src/test/DelegateOptionsTest.cpp @@ -87,7 +87,7 @@ TEST_CASE ("ArmnnDelegateOptimizerOptionsDebugFunction") // Enable debug with debug callback function armnn::OptimizerOptions optimizerOptions(false, true, false, false); bool callback = false; - auto mockCallback = [&](armnn::LayerGuid guid, unsigned int slotIndex, armnn::ITensorHandle* tensor) + auto mockCallback = [&](LayerGuid guid, unsigned int slotIndex, armnn::ITensorHandle* tensor) { armnn::IgnoreUnused(guid); armnn::IgnoreUnused(slotIndex); diff --git a/include/armnn/BackendId.hpp b/include/armnn/BackendId.hpp index 5849dea8fb..45e2ca8d86 100644 --- a/include/armnn/BackendId.hpp +++ b/include/armnn/BackendId.hpp @@ -169,8 +169,8 @@ namespace armnn namespace profiling { - // Static constant describing ArmNN as a dummy backend - static const BackendId BACKEND_ID("ARMNN"); +// Static constant describing ArmNN as a dummy backend +static const BackendId BACKEND_ID("ARMNN"); } // profiling inline std::ostream& operator<<(std::ostream& os, const BackendId& id) @@ -193,4 +193,3 @@ using BackendIdVector = std::vector<BackendId>; using BackendIdSet = std::unordered_set<BackendId>; } // namespace armnn - diff --git a/include/armnn/BackendRegistry.hpp b/include/armnn/BackendRegistry.hpp index 0d09607de2..08e164c549 100644 --- a/include/armnn/BackendRegistry.hpp +++ b/include/armnn/BackendRegistry.hpp @@ -15,13 +15,19 @@ #include <unordered_map> #include <functional> -namespace armnn +namespace arm +{ +namespace pipe { -namespace profiling +class ProfilingService; + +} // namespace arm +} // namespace pipe + +namespace armnn { - class ProfilingService; -} + class IBackendInternal; using IBackendInternalUniquePtr = std::unique_ptr<IBackendInternal>; using MemoryOptimizerStrategiesMapRef = std::unordered_map<BackendId, std::shared_ptr<IMemoryOptimizerStrategy>>; @@ -38,7 +44,7 @@ public: size_t Size() const; BackendIdSet GetBackendIds() const; std::string GetBackendIdsAsString() const; - void SetProfilingService(armnn::Optional<profiling::ProfilingService&> profilingService); + void SetProfilingService(armnn::Optional<arm::pipe::ProfilingService&> profilingService); void RegisterAllocator(const BackendId& id, std::shared_ptr<ICustomAllocator> alloc); std::unordered_map<BackendId, std::shared_ptr<ICustomAllocator>> GetAllocators(); void RegisterMemoryOptimizerStrategy(const BackendId& id, std::shared_ptr<IMemoryOptimizerStrategy> strategy); @@ -72,7 +78,7 @@ private: BackendRegistry& operator=(const BackendRegistry&) = delete; FactoryStorage m_Factories; - armnn::Optional<profiling::ProfilingService&> m_ProfilingService; + armnn::Optional<arm::pipe::ProfilingService&> m_ProfilingService; std::unordered_map<BackendId, std::shared_ptr<ICustomAllocator>> m_CustomMemoryAllocatorMap; std::unordered_map<BackendId, std::shared_ptr<IMemoryOptimizerStrategy>> m_MemoryOptimizerStrategyMap; }; diff --git a/include/armnn/INetwork.hpp b/include/armnn/INetwork.hpp index 173e8d548a..d962fe715b 100644 --- a/include/armnn/INetwork.hpp +++ b/include/armnn/INetwork.hpp @@ -783,7 +783,7 @@ public: Status PrintGraph(); Status SerializeToDot(std::ostream& stream) const; - profiling::ProfilingGuid GetGuid() const; + arm::pipe::ProfilingGuid GetGuid() const; size_t GetNumInputs() const; size_t GetNumOutputs() const; diff --git a/include/armnn/IProfiler.hpp b/include/armnn/IProfiler.hpp index 1b450d0151..209777671b 100644 --- a/include/armnn/IProfiler.hpp +++ b/include/armnn/IProfiler.hpp @@ -54,12 +54,12 @@ private: void AddLayerDetails(const std::string& name, const DescriptorType& desc, const WorkloadInfo& infos, - const profiling::ProfilingGuid guid); + const arm::pipe::ProfilingGuid guid); Event* BeginEvent(const BackendId& backendId, const std::string& label, std::vector<InstrumentPtr>&& instruments, - const Optional<profiling::ProfilingGuid>& guid); + const Optional<arm::pipe::ProfilingGuid>& guid); std::unique_ptr<ProfilerImpl> pProfilerImpl; @@ -69,7 +69,7 @@ private: friend inline void ProfilingUpdateDescriptions(const std::string& name, const DescriptorType& desc, const WorkloadInfo& infos, - const profiling::ProfilingGuid guid); + const arm::pipe::ProfilingGuid guid); // Friend functions for unit testing, see ProfilerTests.cpp. friend size_t GetProfilerEventSequenceSize(armnn::IProfiler* profiler); diff --git a/include/armnn/IRuntime.hpp b/include/armnn/IRuntime.hpp index 042271fc2b..debb2d6896 100644 --- a/include/armnn/IRuntime.hpp +++ b/include/armnn/IRuntime.hpp @@ -146,7 +146,7 @@ public: uint32_t m_CapturePeriod; /// The format of the file used for outputting profiling data. std::string m_FileFormat; - std::vector<armnn::profiling::ILocalPacketHandlerSharedPtr> m_LocalPacketHandlers; + std::vector<arm::pipe::ILocalPacketHandlerSharedPtr> m_LocalPacketHandlers; }; ExternalProfilingOptions m_ProfilingOptions; diff --git a/include/armnn/Types.hpp b/include/armnn/Types.hpp index 880a6dd816..a804f55468 100644 --- a/include/armnn/Types.hpp +++ b/include/armnn/Types.hpp @@ -12,6 +12,19 @@ #include "Exceptions.hpp" #include "Deprecated.hpp" +namespace arm +{ +namespace pipe +{ + +class ProfilingGuid; + +} // namespace armn +} // namespace pipe + +/// Define LayerGuid type. +using LayerGuid = arm::pipe::ProfilingGuid; + namespace armnn { @@ -357,11 +370,6 @@ private: SizeType m_NumDimMappings; }; -namespace profiling { class ProfilingGuid; } - -/// Define LayerGuid type. -using LayerGuid = profiling::ProfilingGuid; - class ITensorHandle; /// Define the type of callback for the Debug layer to call diff --git a/include/armnn/Version.hpp b/include/armnn/Version.hpp index 7e172246e3..d41c4ec8af 100644 --- a/include/armnn/Version.hpp +++ b/include/armnn/Version.hpp @@ -10,7 +10,7 @@ #define STRINGIFY_MACRO(s) #s // ArmNN version components -#define ARMNN_MAJOR_VERSION 28 +#define ARMNN_MAJOR_VERSION 29 #define ARMNN_MINOR_VERSION 0 #define ARMNN_PATCH_VERSION 0 diff --git a/include/armnn/backends/IBackendInternal.hpp b/include/armnn/backends/IBackendInternal.hpp index c64150a484..06fa5edde8 100644 --- a/include/armnn/backends/IBackendInternal.hpp +++ b/include/armnn/backends/IBackendInternal.hpp @@ -86,8 +86,8 @@ public: using IWorkloadFactoryPtr = std::unique_ptr<IWorkloadFactory>; using IBackendContextPtr = std::unique_ptr<IBackendContext>; /// This is the bridge between backend and backend profiling we'll keep it in the backend namespace. - using IBackendProfilingContextPtr = std::shared_ptr<armnn::profiling::IBackendProfilingContext>; - using IBackendProfilingPtr = std::unique_ptr<armnn::profiling::IBackendProfiling>; + using IBackendProfilingContextPtr = std::shared_ptr<arm::pipe::IBackendProfilingContext>; + using IBackendProfilingPtr = std::unique_ptr<arm::pipe::IBackendProfiling>; using ILayerSupportSharedPtr = std::shared_ptr<ILayerSupport>; using IBackendSpecificModelContextPtr = std::shared_ptr<IBackendModelContext>; diff --git a/include/armnn/backends/IWorkload.hpp b/include/armnn/backends/IWorkload.hpp index ce3914bc5a..20be01658e 100644 --- a/include/armnn/backends/IWorkload.hpp +++ b/include/armnn/backends/IWorkload.hpp @@ -29,7 +29,7 @@ public: virtual void ExecuteAsync(WorkingMemDescriptor& desc) = 0; - virtual profiling::ProfilingGuid GetGuid() const = 0; + virtual arm::pipe::ProfilingGuid GetGuid() const = 0; // SupportsTensorHandleReplacement signals that a given workload is capable of // replacing any of its I/O tensors via ReplaceInput/OutputTensorHandle diff --git a/include/armnn/backends/Workload.hpp b/include/armnn/backends/Workload.hpp index 21109480dc..ddcc5a8f0a 100644 --- a/include/armnn/backends/Workload.hpp +++ b/include/armnn/backends/Workload.hpp @@ -32,7 +32,7 @@ public: BaseWorkload(const QueueDescriptor& descriptor, const WorkloadInfo& info) : m_Data(descriptor), - m_Guid(profiling::ProfilingService::GetNextGuid()) + m_Guid(arm::pipe::ProfilingService::GetNextGuid()) { m_Data.Validate(info); } @@ -52,7 +52,7 @@ public: const QueueDescriptor& GetData() const { return m_Data; } - profiling::ProfilingGuid GetGuid() const final { return m_Guid; } + arm::pipe::ProfilingGuid GetGuid() const final { return m_Guid; } virtual bool SupportsTensorHandleReplacement() const override { @@ -75,7 +75,7 @@ public: protected: QueueDescriptor m_Data; - const profiling::ProfilingGuid m_Guid; + const arm::pipe::ProfilingGuid m_Guid; private: std::mutex m_AsyncWorkloadMutex; diff --git a/include/armnn/backends/profiling/IBackendProfiling.hpp b/include/armnn/backends/profiling/IBackendProfiling.hpp index beb7755741..a04f3c1b99 100644 --- a/include/armnn/backends/profiling/IBackendProfiling.hpp +++ b/include/armnn/backends/profiling/IBackendProfiling.hpp @@ -12,10 +12,10 @@ #include <memory> #include <vector> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { struct CounterValue @@ -55,11 +55,13 @@ public: virtual uint16_t RegisterDevice(const std::string& deviceName, uint16_t cores = 0, - const Optional<std::string>& parentCategoryName = EmptyOptional()) = 0; + const armnn::Optional<std::string>& parentCategoryName + = armnn::EmptyOptional()) = 0; virtual uint16_t RegisterCounterSet(const std::string& counterSetName, uint16_t count = 0, - const Optional<std::string>& parentCategoryName = EmptyOptional()) = 0; + const armnn::Optional<std::string>& parentCategoryName + = armnn::EmptyOptional()) = 0; virtual uint16_t RegisterCounter(const uint16_t uid, const std::string& parentCategoryName, @@ -68,10 +70,10 @@ public: double multiplier, const std::string& name, const std::string& description, - const Optional<std::string>& units = EmptyOptional(), - const Optional<uint16_t>& numberOfCores = EmptyOptional(), - const Optional<uint16_t>& deviceUid = EmptyOptional(), - const Optional<uint16_t>& counterSetUid = EmptyOptional()) = 0; + const armnn::Optional<std::string>& units = armnn::EmptyOptional(), + const armnn::Optional<uint16_t>& numberOfCores = armnn::EmptyOptional(), + const armnn::Optional<uint16_t>& deviceUid = armnn::EmptyOptional(), + const armnn::Optional<uint16_t>& counterSetUid = armnn::EmptyOptional()) = 0; virtual ~IRegisterBackendCounters() {} }; @@ -99,6 +101,6 @@ public: }; -} // namespace profiling +} // namespace pipe -} // namespace armnn
\ No newline at end of file +} // namespace arm
\ No newline at end of file diff --git a/include/armnn/backends/profiling/IBackendProfilingContext.hpp b/include/armnn/backends/profiling/IBackendProfilingContext.hpp index 77959e959b..2e3df48227 100644 --- a/include/armnn/backends/profiling/IBackendProfilingContext.hpp +++ b/include/armnn/backends/profiling/IBackendProfilingContext.hpp @@ -8,9 +8,9 @@ #include <armnn/IRuntime.hpp> #include <vector> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class IBackendProfilingContext @@ -19,12 +19,13 @@ public: virtual ~IBackendProfilingContext() {} virtual uint16_t RegisterCounters(uint16_t currentMaxGlobalCounterID) = 0; - virtual Optional<std::string> ActivateCounters(uint32_t capturePeriod, const std::vector<uint16_t>& counterIds) = 0; + virtual armnn::Optional<std::string> ActivateCounters(uint32_t capturePeriod, const std::vector<uint16_t>& + counterIds) = 0; virtual std::vector<Timestamp> ReportCounterValues() = 0; virtual bool EnableProfiling(bool flag) = 0; virtual bool EnableTimelineReporting(bool flag) = 0; }; using IBackendProfilingContextUniquePtr = std::unique_ptr<IBackendProfilingContext>; -} // namespace profiling -} // namespace armnn
\ No newline at end of file +} // namespace pipe +} // namespace arm
\ No newline at end of file diff --git a/include/armnn/profiling/ILocalPacketHandler.hpp b/include/armnn/profiling/ILocalPacketHandler.hpp index af1b0f88b8..bf7bdbc5c4 100644 --- a/include/armnn/profiling/ILocalPacketHandler.hpp +++ b/include/armnn/profiling/ILocalPacketHandler.hpp @@ -7,6 +7,7 @@ #include <armnn/utility/IgnoreUnused.hpp> +#include "../../../profiling/common/include/TargetEndianess.hpp" #include <cstdint> #include <memory> @@ -17,21 +18,8 @@ namespace arm { namespace pipe { - class Packet; -} // namespace pipe -} // namespace arm - -namespace armnn -{ - -namespace profiling -{ -enum class TargetEndianness -{ - BeWire, - LeWire -}; +class Packet; // the handlers need to be able to do two // things to service the FileOnlyProfilingConnection @@ -45,7 +33,7 @@ public: virtual void SetEndianess(const TargetEndianness& endianness) = 0; - virtual void ReturnPacket(arm::pipe::Packet& packet) = 0; + virtual void ReturnPacket(Packet& packet) = 0; virtual void Close() = 0; }; @@ -62,7 +50,7 @@ public: virtual std::vector<uint32_t> GetHeadersAccepted() = 0; /// process the packet - virtual void HandlePacket(const arm::pipe::Packet& packet) = 0; + virtual void HandlePacket(const Packet& packet) = 0; /// Set a profiling connection on the handler. Only need to implement this /// function if the handler will be writing data back to the profiled application. @@ -73,6 +61,6 @@ public: using ILocalPacketHandlerPtr = std::unique_ptr<ILocalPacketHandler>; using ILocalPacketHandlerSharedPtr = std::shared_ptr<ILocalPacketHandler>; -} // namespace profiling +} // namespace pipe -} // namespace armnn
\ No newline at end of file +} // namespace arm
\ No newline at end of file diff --git a/include/armnn/profiling/ISendTimelinePacket.hpp b/include/armnn/profiling/ISendTimelinePacket.hpp index c5da5219f7..4785e04ef8 100644 --- a/include/armnn/profiling/ISendTimelinePacket.hpp +++ b/include/armnn/profiling/ISendTimelinePacket.hpp @@ -9,10 +9,10 @@ #include <string> #include <vector> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { enum class ProfilingRelationshipType @@ -56,6 +56,6 @@ public: uint64_t attributeGuid) = 0; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/include/armnn/profiling/ProfilingOptions.hpp b/include/armnn/profiling/ProfilingOptions.hpp index 50cd50e5c3..6b4472ca63 100644 --- a/include/armnn/profiling/ProfilingOptions.hpp +++ b/include/armnn/profiling/ProfilingOptions.hpp @@ -16,14 +16,6 @@ namespace pipe { /// The lowest performance data capture interval we support is 10 miliseconds. constexpr unsigned int LOWEST_CAPTURE_PERIOD = 10000u; -} // namespace pipe -} // namespace arm - -namespace armnn -{ - -namespace profiling -{ struct ProfilingOptions { ProfilingOptions() @@ -45,9 +37,9 @@ struct ProfilingOptions { uint32_t m_CapturePeriod; /// The format of the file used for outputting profiling data. std::string m_FileFormat; - std::vector <armnn::profiling::ILocalPacketHandlerSharedPtr> m_LocalPacketHandlers; + std::vector <ILocalPacketHandlerSharedPtr> m_LocalPacketHandlers; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/profiling/common/include/IProfilingGuidGenerator.hpp b/profiling/common/include/IProfilingGuidGenerator.hpp index 34ee9673b5..2fdffc4499 100644 --- a/profiling/common/include/IProfilingGuidGenerator.hpp +++ b/profiling/common/include/IProfilingGuidGenerator.hpp @@ -9,10 +9,10 @@ #include <string> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class IProfilingGuidGenerator @@ -27,6 +27,6 @@ public: virtual ~IProfilingGuidGenerator() {} }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/profiling/common/include/LabelsAndEventClasses.hpp b/profiling/common/include/LabelsAndEventClasses.hpp index 8e3e0b0c67..0c43524294 100644 --- a/profiling/common/include/LabelsAndEventClasses.hpp +++ b/profiling/common/include/LabelsAndEventClasses.hpp @@ -9,10 +9,10 @@ #include "DllExport.hpp" -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class LabelsAndEventClasses @@ -64,6 +64,6 @@ private: static ProfilingGuidGenerator m_GuidGenerator; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/profiling/common/include/ProfilingGuid.hpp b/profiling/common/include/ProfilingGuid.hpp index 4d0dd9b3c9..fef17988e4 100644 --- a/profiling/common/include/ProfilingGuid.hpp +++ b/profiling/common/include/ProfilingGuid.hpp @@ -8,10 +8,10 @@ #include <memory> #include <stdint.h> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { static constexpr uint64_t MIN_STATIC_GUID = 1llu << 63; @@ -70,11 +70,9 @@ struct ProfilingStaticGuid : public ProfilingGuid using ProfilingGuid::ProfilingGuid; }; -} // namespace profiling +} // namespace pipe - - -} // namespace armnn +} // namespace arm @@ -82,9 +80,9 @@ namespace std { /// make ProfilingGuid hashable template <> -struct hash<armnn::profiling::ProfilingGuid> +struct hash<arm::pipe::ProfilingGuid> { - std::size_t operator()(armnn::profiling::ProfilingGuid const& guid) const noexcept + std::size_t operator()(arm::pipe::ProfilingGuid const& guid) const noexcept { return hash<uint64_t>()(uint64_t(guid)); } @@ -92,9 +90,9 @@ struct hash<armnn::profiling::ProfilingGuid> /// make ProfilingDynamicGuid hashable template <> -struct hash<armnn::profiling::ProfilingDynamicGuid> +struct hash<arm::pipe::ProfilingDynamicGuid> { - std::size_t operator()(armnn::profiling::ProfilingDynamicGuid const& guid) const noexcept + std::size_t operator()(arm::pipe::ProfilingDynamicGuid const& guid) const noexcept { return hash<uint64_t>()(uint64_t(guid)); } @@ -102,9 +100,9 @@ struct hash<armnn::profiling::ProfilingDynamicGuid> /// make ProfilingStaticGuid hashable template <> -struct hash<armnn::profiling::ProfilingStaticGuid> +struct hash<arm::pipe::ProfilingStaticGuid> { - std::size_t operator()(armnn::profiling::ProfilingStaticGuid const& guid) const noexcept + std::size_t operator()(arm::pipe::ProfilingStaticGuid const& guid) const noexcept { return hash<uint64_t>()(uint64_t(guid)); } diff --git a/profiling/common/include/ProfilingGuidGenerator.hpp b/profiling/common/include/ProfilingGuidGenerator.hpp index 2b7302bd61..bfee7642e9 100644 --- a/profiling/common/include/ProfilingGuidGenerator.hpp +++ b/profiling/common/include/ProfilingGuidGenerator.hpp @@ -11,10 +11,10 @@ #include <functional> #include <mutex> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class ProfilingGuidGenerator : public IProfilingGuidGenerator @@ -57,6 +57,6 @@ private: std::mutex m_SequenceMutex; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/profiling/common/include/TargetEndianess.hpp b/profiling/common/include/TargetEndianess.hpp new file mode 100644 index 0000000000..8ee8db1d34 --- /dev/null +++ b/profiling/common/include/TargetEndianess.hpp @@ -0,0 +1,12 @@ +// +// Copyright © 2022 Arm Ltd and Contributors. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#pragma once + +enum class TargetEndianness +{ + BeWire, + LeWire +};
\ No newline at end of file diff --git a/profiling/common/src/LabelsAndEventClasses.cpp b/profiling/common/src/LabelsAndEventClasses.cpp index fe6d119c2f..b476ddd2f3 100644 --- a/profiling/common/src/LabelsAndEventClasses.cpp +++ b/profiling/common/src/LabelsAndEventClasses.cpp @@ -5,10 +5,10 @@ #include "LabelsAndEventClasses.hpp" -namespace armnn +namespace arm { -namespace profiling +namespace pipe { ProfilingGuidGenerator LabelsAndEventClasses::m_GuidGenerator; @@ -74,6 +74,6 @@ ProfilingStaticGuid LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS_NAME_ ProfilingStaticGuid LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS( m_GuidGenerator.GenerateStaticId("ARMNN_PROFILING_EOL")); -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/profiling/server/include/basePipeServer/BasePipeServer.hpp b/profiling/server/include/basePipeServer/BasePipeServer.hpp index 1b6dec54ff..c7635421fa 100644 --- a/profiling/server/include/basePipeServer/BasePipeServer.hpp +++ b/profiling/server/include/basePipeServer/BasePipeServer.hpp @@ -8,6 +8,7 @@ #include <common/include/NetworkSockets.hpp> #include <common/include/Packet.hpp> #include <common/include/SocketConnectionException.hpp> +#include <common/include/TargetEndianess.hpp> #include <string> #include <atomic> @@ -18,12 +19,6 @@ namespace arm namespace pipe { -enum class TargetEndianness -{ - BeWire, - LeWire -}; - enum class PacketDirection { Sending, diff --git a/profiling/server/src/basePipeServer/tests/BasePipeServerTests.cpp b/profiling/server/src/basePipeServer/tests/BasePipeServerTests.cpp index f307d98668..03de76911e 100644 --- a/profiling/server/src/basePipeServer/tests/BasePipeServerTests.cpp +++ b/profiling/server/src/basePipeServer/tests/BasePipeServerTests.cpp @@ -25,21 +25,21 @@ TEST_CASE("BasePipeServerTest") // The socket should close once we leave the scope of CHECK_NOTHROW // and socketProfilingConnection should fail to connect - CHECK_THROWS_AS(profiling::SocketProfilingConnection socketProfilingConnection, + CHECK_THROWS_AS(arm::pipe::SocketProfilingConnection socketProfilingConnection, arm::pipe::SocketConnectionException); // Try to initialize a listening socket through the ConnectionHandler again ConnectionHandler connectionHandler(udsNamespace, true); // socketProfilingConnection should connect now - profiling::SocketProfilingConnection socketProfilingConnection; + arm::pipe::SocketProfilingConnection socketProfilingConnection; CHECK(socketProfilingConnection.IsOpen()); auto basePipeServer = connectionHandler.GetNewBasePipeServer(false); // GetNewBasePipeServer will return null if it fails to create a socket CHECK(basePipeServer.get()); - profiling::BufferManager bufferManager; - profiling::SendCounterPacket sendCounterPacket(bufferManager); + arm::pipe::BufferManager bufferManager; + arm::pipe::SendCounterPacket sendCounterPacket(bufferManager); // Check that we can receive a StreamMetaDataPacket sendCounterPacket.SendStreamMetaDataPacket(); diff --git a/profiling/server/src/timelineDecoder/tests/TimelineTests.cpp b/profiling/server/src/timelineDecoder/tests/TimelineTests.cpp index 82c16fee79..15c5c7e56d 100644 --- a/profiling/server/src/timelineDecoder/tests/TimelineTests.cpp +++ b/profiling/server/src/timelineDecoder/tests/TimelineTests.cpp @@ -74,10 +74,10 @@ TEST_CASE("TimelineDirectoryTest") uint32_t uint32_t_size = sizeof(uint32_t); uint32_t uint64_t_size = sizeof(uint64_t); - armnn::profiling::BufferManager bufferManager(5); - armnn::profiling::TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager); + arm::pipe::BufferManager bufferManager(5); + arm::pipe::TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager); - std::unique_ptr<armnn::profiling::ISendTimelinePacket> sendTimelinePacket = + std::unique_ptr<arm::pipe::ISendTimelinePacket> sendTimelinePacket = timelinePacketWriterFactory.GetSendTimelinePacket(); arm::pipe::PacketVersionResolver packetVersionResolver; @@ -97,7 +97,7 @@ TEST_CASE("TimelineDirectoryTest") unsigned int offset = uint32_t_size * 2; - std::unique_ptr<armnn::profiling::IPacketBuffer> packetBuffer = bufferManager.GetReadableBuffer(); + std::unique_ptr<arm::pipe::IPacketBuffer> packetBuffer = bufferManager.GetReadableBuffer(); uint8_t readStreamVersion = ReadUint8(packetBuffer, offset); CHECK(readStreamVersion == 4); @@ -106,7 +106,7 @@ TEST_CASE("TimelineDirectoryTest") CHECK(readPointerBytes == uint64_t_size); offset += uint8_t_size; uint8_t readThreadIdBytes = ReadUint8(packetBuffer, offset); - CHECK(readThreadIdBytes == armnn::profiling::ThreadIdSize); + CHECK(readThreadIdBytes == arm::pipe::ThreadIdSize); offset += uint8_t_size; uint32_t declarationSize = arm::pipe::ReadUint32(packetBuffer->GetReadableData(), offset); @@ -145,10 +145,10 @@ TEST_CASE("TimelineDirectoryTest") TEST_CASE("TimelineCaptureTest") { - armnn::profiling::BufferManager bufferManager(50); - armnn::profiling::TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager); + arm::pipe::BufferManager bufferManager(50); + arm::pipe::TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager); - std::unique_ptr<armnn::profiling::ISendTimelinePacket> sendTimelinePacket = + std::unique_ptr<arm::pipe::ISendTimelinePacket> sendTimelinePacket = timelinePacketWriterFactory.GetSendTimelinePacket(); arm::pipe::PacketVersionResolver packetVersionResolver; @@ -157,7 +157,7 @@ TEST_CASE("TimelineCaptureTest") arm::pipe::TimelineCaptureCommandHandler timelineCaptureCommandHandler( 1, 1, packetVersionResolver.ResolvePacketVersion(1, 1).GetEncodedValue(), timelineDecoder, - armnn::profiling::ThreadIdSize); + arm::pipe::ThreadIdSize); using Status = arm::pipe::ITimelineDecoder::TimelineStatus; CHECK(timelineDecoder.SetEntityCallback(PushEntity) == Status::TimelineStatus_Success); @@ -175,16 +175,16 @@ TEST_CASE("TimelineCaptureTest") const int threadId = armnnUtils::Threads::GetCurrentThreadId(); // need to do a bit of work here to extract the value from threadId - unsigned char* uCharThreadId = new unsigned char[armnn::profiling::ThreadIdSize]();; + unsigned char* uCharThreadId = new unsigned char[arm::pipe::ThreadIdSize]();; uint64_t uint64ThreadId; - arm::pipe::WriteBytes(uCharThreadId, 0, &threadId, armnn::profiling::ThreadIdSize); + arm::pipe::WriteBytes(uCharThreadId, 0, &threadId, arm::pipe::ThreadIdSize); - if (armnn::profiling::ThreadIdSize == 4) + if (arm::pipe::ThreadIdSize == 4) { uint64ThreadId = arm::pipe::ReadUint32(uCharThreadId, 0); } - else if (armnn::profiling::ThreadIdSize == 8) + else if (arm::pipe::ThreadIdSize == 8) { uint64ThreadId = arm::pipe::ReadUint64(uCharThreadId, 0); } @@ -224,8 +224,8 @@ TEST_CASE("TimelineCaptureTest") timelineCaptureCommandHandler); // Send relationship - armnn::profiling::ProfilingRelationshipType relationshipType = - armnn::profiling::ProfilingRelationshipType::DataLink; + arm::pipe::ProfilingRelationshipType relationshipType = + arm::pipe::ProfilingRelationshipType::DataLink; sendTimelinePacket->SendTimelineRelationshipBinaryPacket(relationshipType, relationshipGuid, headGuid, @@ -261,10 +261,10 @@ TEST_CASE("TimelineCaptureTest") TEST_CASE("TimelineCaptureTestMultipleStringsInBuffer") { - armnn::profiling::BufferManager bufferManager(50); - armnn::profiling::TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager); + arm::pipe::BufferManager bufferManager(50); + arm::pipe::TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager); - std::unique_ptr<armnn::profiling::ISendTimelinePacket> sendTimelinePacket = + std::unique_ptr<arm::pipe::ISendTimelinePacket> sendTimelinePacket = timelinePacketWriterFactory.GetSendTimelinePacket(); arm::pipe::PacketVersionResolver packetVersionResolver; @@ -273,7 +273,7 @@ TEST_CASE("TimelineCaptureTestMultipleStringsInBuffer") arm::pipe::TimelineCaptureCommandHandler timelineCaptureCommandHandler( 1, 1, packetVersionResolver.ResolvePacketVersion(1, 1).GetEncodedValue(), timelineDecoder, - armnn::profiling::ThreadIdSize); + arm::pipe::ThreadIdSize); using Status = arm::pipe::TimelineDecoder::TimelineStatus; CHECK(timelineDecoder.SetEntityCallback(PushEntity) == Status::TimelineStatus_Success); @@ -291,16 +291,16 @@ TEST_CASE("TimelineCaptureTestMultipleStringsInBuffer") const int threadId = armnnUtils::Threads::GetCurrentThreadId(); // need to do a bit of work here to extract the value from threadId - unsigned char* uCharThreadId = new unsigned char[armnn::profiling::ThreadIdSize](); + unsigned char* uCharThreadId = new unsigned char[arm::pipe::ThreadIdSize](); uint64_t uint64ThreadId; - arm::pipe::WriteBytes(uCharThreadId, 0, &threadId, armnn::profiling::ThreadIdSize); + arm::pipe::WriteBytes(uCharThreadId, 0, &threadId, arm::pipe::ThreadIdSize); - if ( armnn::profiling::ThreadIdSize == 4 ) + if ( arm::pipe::ThreadIdSize == 4 ) { uint64ThreadId = arm::pipe::ReadUint32(uCharThreadId, 0); - } - else if ( armnn::profiling::ThreadIdSize == 8 ) + } + else if ( arm::pipe::ThreadIdSize == 8 ) { uint64ThreadId = arm::pipe::ReadUint64(uCharThreadId, 0); } @@ -329,8 +329,8 @@ TEST_CASE("TimelineCaptureTestMultipleStringsInBuffer") sendTimelinePacket->SendTimelineLabelBinaryPacket(labelGuid, labelName2); sendTimelinePacket->SendTimelineLabelBinaryPacket(labelGuid, labelName3); // Send relationship - armnn::profiling::ProfilingRelationshipType relationshipType = - armnn::profiling::ProfilingRelationshipType::DataLink; + arm::pipe::ProfilingRelationshipType relationshipType = + arm::pipe::ProfilingRelationshipType::DataLink; sendTimelinePacket->SendTimelineRelationshipBinaryPacket(relationshipType, relationshipGuid, headGuid, diff --git a/python/pyarmnn/README.md b/python/pyarmnn/README.md index 4ac36fafb4..7dc8d8693a 100644 --- a/python/pyarmnn/README.md +++ b/python/pyarmnn/README.md @@ -91,14 +91,14 @@ This step will put all generated files under `./src/pyarmnn/_generated` folder a ```bash $ python setup.py sdist ``` -As the result you will get `./dist/pyarmnn-28.0.0.tar.gz` file. As you can see it is platform independent. +As the result you will get `./dist/pyarmnn-29.0.0.tar.gz` file. As you can see it is platform independent. ##### 5. Build the binary package ```bash $ python setup.py bdist_wheel ``` -As the result you will get something like `./dist/pyarmnn-28.0.0-cp36-cp36m-linux_x86_64.whl` file. As you can see it +As the result you will get something like `./dist/pyarmnn-29.0.0-cp36-cp36m-linux_x86_64.whl` file. As you can see it is platform dependent. # PyArmNN installation @@ -107,8 +107,8 @@ PyArmNN can be distributed as a source package or a binary package (wheel). Binary package is platform dependent, the name of the package will indicate the platform it was built for, e.g.: -* Linux x86 64bit machine: pyarmnn-28.0.0-cp36-cp36m-*linux_x86_64*.whl -* Linux Aarch 64 bit machine: pyarmnn-28.0.0-cp36-cp36m-*linux_aarch64*.whl +* Linux x86 64bit machine: pyarmnn-29.0.0-cp36-cp36m-*linux_x86_64*.whl +* Linux Aarch 64 bit machine: pyarmnn-29.0.0-cp36-cp36m-*linux_aarch64*.whl The source package is platform independent but installation involves compilation of Arm NN python extension. You will need to have g++ compatible with C++ 14 standard and a python development library installed on the build machine. @@ -126,7 +126,7 @@ $ gcc --print-search-dirs ``` Install PyArmNN from binary by pointing to the wheel file: ```bash -$ pip install /path/to/pyarmnn-28.0.0-cp36-cp36m-linux_aarch64.whl +$ pip install /path/to/pyarmnn-29.0.0-cp36-cp36m-linux_aarch64.whl ``` ## Installing from source package @@ -143,7 +143,7 @@ $ export ARMNN_INCLUDE=/full/path/to/armnn/include:/full/path/to/armnn/profilin Install PyArmNN as follows: ```bash -$ pip install /path/to/pyarmnn-28.0.0.tar.gz +$ pip install /path/to/pyarmnn-29.0.0.tar.gz ``` If PyArmNN installation script fails to find Arm NN libraries it will raise an error like this @@ -157,7 +157,7 @@ $ pip show pyarmnn You can also verify it by running the following and getting output similar to below: ```bash $ python -c "import pyarmnn as ann;print(ann.GetVersion())" -'28.0.0' +'29.0.0' ``` # PyArmNN API overview diff --git a/python/pyarmnn/examples/image_classification/README.md b/python/pyarmnn/examples/image_classification/README.md index cc05bbcda5..7275a2523f 100644 --- a/python/pyarmnn/examples/image_classification/README.md +++ b/python/pyarmnn/examples/image_classification/README.md @@ -20,7 +20,7 @@ $ pip show pyarmnn You can also verify it by running the following and getting output similar to below:
```bash
$ python -c "import pyarmnn as ann;print(ann.GetVersion())"
-'28.0.0'
+'29.0.0'
```
##### Dependencies
diff --git a/python/pyarmnn/examples/keyword_spotting/README.MD b/python/pyarmnn/examples/keyword_spotting/README.MD index 4299fa0fd4..d276c08f8e 100644 --- a/python/pyarmnn/examples/keyword_spotting/README.MD +++ b/python/pyarmnn/examples/keyword_spotting/README.MD @@ -18,7 +18,7 @@ You can also verify it by running the following and getting output similar to be ```bash $ python -c "import pyarmnn as ann;print(ann.GetVersion())" -'26.0.0' +'29.0.0' ``` ### Dependencies diff --git a/python/pyarmnn/examples/object_detection/README.md b/python/pyarmnn/examples/object_detection/README.md index 421cfae074..b63295cc89 100644 --- a/python/pyarmnn/examples/object_detection/README.md +++ b/python/pyarmnn/examples/object_detection/README.md @@ -23,7 +23,7 @@ $ pip show pyarmnn You can also verify it by running the following and getting output similar to below: ```bash $ python -c "import pyarmnn as ann;print(ann.GetVersion())" -'28.0.0' +'29.0.0' ``` ##### Dependencies diff --git a/python/pyarmnn/examples/speech_recognition/README.md b/python/pyarmnn/examples/speech_recognition/README.md index c39959bfbc..2cdc8691d2 100644 --- a/python/pyarmnn/examples/speech_recognition/README.md +++ b/python/pyarmnn/examples/speech_recognition/README.md @@ -18,7 +18,7 @@ You can also verify it by running the following and getting output similar to be ```bash $ python -c "import pyarmnn as ann;print(ann.GetVersion())" -'28.0.0' +'29.0.0' ``` ### Dependencies diff --git a/python/pyarmnn/src/pyarmnn/_version.py b/python/pyarmnn/src/pyarmnn/_version.py index e1566d22f7..7c0940e7f3 100644 --- a/python/pyarmnn/src/pyarmnn/_version.py +++ b/python/pyarmnn/src/pyarmnn/_version.py @@ -3,7 +3,7 @@ # SPDX-License-Identifier: MIT import os -version_info = (28, 0, 0) +version_info = (29, 0, 0) __dev_version_env = os.getenv("PYARMNN_DEV_VER", "") @@ -24,7 +24,7 @@ def check_armnn_version(installed_armnn_version: str, expected_armnn_version: st """Compares expected Arm NN version and Arm NN version used to build the package. Args: - installed_armnn_version (str): Arm NN version used to generate the package (e.g. 28.0.0) + installed_armnn_version (str): Arm NN version used to generate the package (e.g. 29.0.0) expected_armnn_version (str): Expected Arm NN version Returns: diff --git a/python/pyarmnn/test/test_setup.py b/python/pyarmnn/test/test_setup.py index 6fab167788..4a6f930cbf 100644 --- a/python/pyarmnn/test/test_setup.py +++ b/python/pyarmnn/test/test_setup.py @@ -87,15 +87,15 @@ def test_gcc_serch_path(): def test_armnn_version(): - check_armnn_version('28.0.0', '28.0.0') + check_armnn_version('29.0.0', '29.0.0') def test_incorrect_armnn_version(): with pytest.raises(AssertionError) as err: - check_armnn_version('28.0.0', '28.1.0') + check_armnn_version('29.0.0', '29.1.0') - assert 'Expected ArmNN version is 28.1.0 but installed ArmNN version is 28.0.0' in str(err.value) + assert 'Expected ArmNN version is 29.1.0 but installed ArmNN version is 29.0.0' in str(err.value) def test_armnn_version_patch_does_not_matter(): - check_armnn_version('28.0.0', '28.0.1') + check_armnn_version('29.0.0', '29.0.1') diff --git a/python/pyarmnn/test/test_version.py b/python/pyarmnn/test/test_version.py index dd60aa367e..f74ae020cf 100644 --- a/python/pyarmnn/test/test_version.py +++ b/python/pyarmnn/test/test_version.py @@ -18,7 +18,7 @@ def test_dev_version(): importlib.reload(v) - assert "28.0.0.dev1" == v.__version__ + assert "29.0.0.dev1" == v.__version__ del os.environ["PYARMNN_DEV_VER"] del v @@ -30,7 +30,7 @@ def test_arm_version_not_affected(): importlib.reload(v) - assert "28.0.0" == v.__arm_ml_version__ + assert "29.0.0" == v.__arm_ml_version__ del os.environ["PYARMNN_DEV_VER"] del v diff --git a/samples/ObjectDetection/Readme.md b/samples/ObjectDetection/Readme.md index ba5883aca9..04ac01195f 100644 --- a/samples/ObjectDetection/Readme.md +++ b/samples/ObjectDetection/Readme.md @@ -168,8 +168,8 @@ From the build directory, copy the following to the host platform: The full list of libs after cross-compilation to copy on your board: ``` libarmnn.so -libarmnn.so.28 -libarmnn.so.28.0 +libarmnn.so.29 +libarmnn.so.29.0 libarmnnTfLiteParser.so libarmnnTfLiteParser.so.24.4 libavcodec.so diff --git a/src/armnn/BackendRegistry.cpp b/src/armnn/BackendRegistry.cpp index ade844fc39..7b1f6bcb5d 100644 --- a/src/armnn/BackendRegistry.cpp +++ b/src/armnn/BackendRegistry.cpp @@ -30,7 +30,7 @@ void BackendRegistry::Register(const BackendId& id, BackendRegistry::FactoryFunc { if (m_ProfilingService.has_value() && m_ProfilingService.value().IsProfilingEnabled()) { - m_ProfilingService.value().IncrementCounterValue(armnn::profiling::REGISTERED_BACKENDS); + m_ProfilingService.value().IncrementCounterValue(arm::pipe::REGISTERED_BACKENDS); } } @@ -43,7 +43,7 @@ void BackendRegistry::Deregister(const BackendId& id) if (m_ProfilingService.has_value() && m_ProfilingService.value().IsProfilingEnabled()) { - m_ProfilingService.value().IncrementCounterValue(armnn::profiling::UNREGISTERED_BACKENDS); + m_ProfilingService.value().IncrementCounterValue(arm::pipe::UNREGISTERED_BACKENDS); } } @@ -102,7 +102,7 @@ void BackendRegistry::Swap(BackendRegistry& instance, BackendRegistry::FactorySt std::swap(instance.m_Factories, other); } -void BackendRegistry::SetProfilingService(armnn::Optional<profiling::ProfilingService&> profilingService) +void BackendRegistry::SetProfilingService(armnn::Optional<arm::pipe::ProfilingService&> profilingService) { m_ProfilingService = profilingService; } diff --git a/src/armnn/JsonPrinter.cpp b/src/armnn/JsonPrinter.cpp index f771cb1786..8085108c31 100644 --- a/src/armnn/JsonPrinter.cpp +++ b/src/armnn/JsonPrinter.cpp @@ -138,7 +138,7 @@ void JsonPrinter::PrintType(armnn::JsonObjectType type) m_OutputStream << R"(")"; } -void JsonPrinter::PrintGuid(armnn::profiling::ProfilingGuid guid) +void JsonPrinter::PrintGuid(arm::pipe::ProfilingGuid guid) { PrintTabs(); m_OutputStream << std::quoted("GUID") << ": " << std::quoted(std::to_string(guid)) << "," << std::endl; diff --git a/src/armnn/JsonPrinter.hpp b/src/armnn/JsonPrinter.hpp index d9b83869d7..05b6e6a510 100644 --- a/src/armnn/JsonPrinter.hpp +++ b/src/armnn/JsonPrinter.hpp @@ -51,9 +51,9 @@ struct JsonChildObject } } - void SetGuid(profiling::ProfilingGuid guid) + void SetGuid(arm::pipe::ProfilingGuid guid) { - m_Guid = Optional<profiling::ProfilingGuid>(guid); + m_Guid = Optional<arm::pipe::ProfilingGuid>(guid); } void AddChild(const JsonChildObject& childObject) @@ -101,7 +101,7 @@ struct JsonChildObject std::string m_Label; Measurement::Unit m_Unit; JsonObjectType m_Type; - Optional<profiling::ProfilingGuid> m_Guid; + Optional<arm::pipe::ProfilingGuid> m_Guid; std::vector<double> m_Measurements; std::vector<std::string> m_LayerDetailsList; std::vector<JsonChildObject> m_Children; @@ -118,7 +118,7 @@ public: void PrintLabel(const std::string& label, size_t id); void PrintUnit(armnn::Measurement::Unit unit); void PrintType(armnn::JsonObjectType type); - void PrintGuid(armnn::profiling::ProfilingGuid guid); + void PrintGuid(arm::pipe::ProfilingGuid guid); void PrintMeasurementsList(const std::vector<double>& measurementsVector); public: diff --git a/src/armnn/Layer.cpp b/src/armnn/Layer.cpp index 4ed179fa22..c827b4b681 100644 --- a/src/armnn/Layer.cpp +++ b/src/armnn/Layer.cpp @@ -202,7 +202,7 @@ Layer::Layer(unsigned int numInputSlots, , m_Type(type) , m_BackendId() , m_BackendHint(EmptyOptional()) -, m_Guid(profiling::ProfilingService::GetNextGuid()) +, m_Guid(arm::pipe::ProfilingService::GetNextGuid()) { IgnoreUnused(layout); m_InputSlots.reserve(numInputSlots); diff --git a/src/armnn/LoadedNetwork.cpp b/src/armnn/LoadedNetwork.cpp index bcceaf4a99..1367552f98 100644 --- a/src/armnn/LoadedNetwork.cpp +++ b/src/armnn/LoadedNetwork.cpp @@ -27,7 +27,7 @@ namespace armnn { using namespace std; -using namespace armnn::profiling; +using namespace arm::pipe; namespace { @@ -82,7 +82,7 @@ void AddWorkloadStructure(std::unique_ptr<TimelineUtilityMethods>& timelineUtils std::unique_ptr<LoadedNetwork> LoadedNetwork::MakeLoadedNetwork(std::unique_ptr<IOptimizedNetwork> net, std::string& errorMessage, const INetworkProperties& networkProperties, - profiling::ProfilingService& profilingService) + ProfilingService& profilingService) { std::unique_ptr<LoadedNetwork> loadedNetwork; @@ -116,7 +116,7 @@ std::unique_ptr<LoadedNetwork> LoadedNetwork::MakeLoadedNetwork(std::unique_ptr< LoadedNetwork::LoadedNetwork(std::unique_ptr<IOptimizedNetwork> net, const INetworkProperties& networkProperties, - profiling::ProfilingService& profilingService) : + ProfilingService& profilingService) : m_OptimizedNetwork(std::move(net)), m_NetworkProperties(networkProperties), m_TensorHandleFactoryRegistry(), @@ -580,7 +580,7 @@ void LoadedNetwork::SendNetworkStructure() timelineUtils->Commit(); } -profiling::ProfilingGuid LoadedNetwork::GetNetworkGuid() +ProfilingGuid LoadedNetwork::GetNetworkGuid() { return m_OptimizedNetwork->GetGuid(); } @@ -912,7 +912,7 @@ Status LoadedNetwork::EnqueueWorkload(const InputTensors& inputTensors, { if (m_ProfilingService.IsProfilingEnabled()) { - m_ProfilingService.IncrementCounterValue(armnn::profiling::INFERENCES_RUN); + m_ProfilingService.IncrementCounterValue(INFERENCES_RUN); } ARMNN_SCOPED_PROFILING_EVENT(Compute::Undefined, "Execute"); ARMNN_SCOPED_HEAP_PROFILING("Executing"); @@ -1142,7 +1142,7 @@ void LoadedNetwork::FreeWorkingMemory() } bool LoadedNetwork::Execute(std::unique_ptr<TimelineUtilityMethods>& timelineUtils, - profiling::ProfilingGuid inferenceGuid) + ProfilingGuid inferenceGuid) { bool success = true; @@ -1682,19 +1682,19 @@ Status LoadedNetwork::Execute(const InputTensors& inputTensors, } }; - std::unique_ptr<profiling::TimelineUtilityMethods> timelineUtils = - profiling::TimelineUtilityMethods::GetTimelineUtils(m_ProfilingService); - profiling::ProfilingGuid inferenceGuid = m_ProfilingService.GetNextGuid(); + std::unique_ptr<TimelineUtilityMethods> timelineUtils = + TimelineUtilityMethods::GetTimelineUtils(m_ProfilingService); + ProfilingGuid inferenceGuid = m_ProfilingService.GetNextGuid(); if (timelineUtils) { // Add inference timeline trace if profiling is enabled. - profiling::ProfilingGuid networkGuid = m_OptimizedNetwork->GetGuid(); - timelineUtils->CreateTypedEntity(inferenceGuid, profiling::LabelsAndEventClasses::INFERENCE_GUID); - timelineUtils->CreateRelationship(profiling::ProfilingRelationshipType::RetentionLink, + ProfilingGuid networkGuid = m_OptimizedNetwork->GetGuid(); + timelineUtils->CreateTypedEntity(inferenceGuid,LabelsAndEventClasses::INFERENCE_GUID); + timelineUtils->CreateRelationship(ProfilingRelationshipType::RetentionLink, networkGuid, inferenceGuid, - profiling::LabelsAndEventClasses::EXECUTION_OF_GUID); - timelineUtils->RecordEvent(inferenceGuid, profiling::LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS); + LabelsAndEventClasses::EXECUTION_OF_GUID); + timelineUtils->RecordEvent(inferenceGuid,LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS); } bool executionSucceeded = true; @@ -1702,7 +1702,7 @@ Status LoadedNetwork::Execute(const InputTensors& inputTensors, if (timelineUtils) { // Add end of life of the inference timeline if profiling is enabled. - timelineUtils->RecordEvent(inferenceGuid, profiling::LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS); + timelineUtils->RecordEvent(inferenceGuid,LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS); timelineUtils->Commit(); } @@ -1762,7 +1762,7 @@ Status LoadedNetwork::Execute(const InputTensors& inputTensors, ARMNN_LOG(error) << "An error occurred attempting to execute a workload: " << error.what(); executionSucceeded = false; }; - profiling::ProfilingDynamicGuid workloadInferenceID(0); + ProfilingDynamicGuid workloadInferenceID(0); try { diff --git a/src/armnn/LoadedNetwork.hpp b/src/armnn/LoadedNetwork.hpp index dc2f4dc10f..09d760454e 100644 --- a/src/armnn/LoadedNetwork.hpp +++ b/src/armnn/LoadedNetwork.hpp @@ -78,7 +78,7 @@ public: static std::unique_ptr<LoadedNetwork> MakeLoadedNetwork(std::unique_ptr<IOptimizedNetwork> net, std::string& errorMessage, const INetworkProperties& networkProperties, - profiling::ProfilingService& profilingService); + arm::pipe::ProfilingService& profilingService); // NOTE we return by reference as the purpose of this method is only to provide // access to the private m_Profiler and in theory we should not need to increment @@ -96,7 +96,7 @@ public: return m_NetworkProperties.m_AsyncEnabled; } - profiling::ProfilingGuid GetNetworkGuid(); + arm::pipe::ProfilingGuid GetNetworkGuid(); private: @@ -112,7 +112,7 @@ private: LoadedNetwork(std::unique_ptr<IOptimizedNetwork> net, const INetworkProperties& networkProperties, - profiling::ProfilingService& profilingService); + arm::pipe::ProfilingService& profilingService); void EnqueueInput(const BindableLayer& layer, ITensorHandle* tensorHandle, const TensorInfo& tensorInfo); @@ -122,8 +122,8 @@ private: void ImportOutputTensor(const Tensor& outputTensor, ITensorHandle* outputTensorHandle); - bool Execute(std::unique_ptr<profiling::TimelineUtilityMethods>& timelineUtils, - profiling::ProfilingGuid inferenceGuid); + bool Execute(std::unique_ptr<arm::pipe::TimelineUtilityMethods>& timelineUtils, + arm::pipe::ProfilingGuid inferenceGuid); const IWorkloadFactory& GetWorkloadFactory(const Layer& layer) const; @@ -158,7 +158,7 @@ private: TensorHandleFactoryRegistry m_TensorHandleFactoryRegistry; - profiling::ProfilingService& m_ProfilingService; + arm::pipe::ProfilingService& m_ProfilingService; struct ImportedTensorHandlePin { diff --git a/src/armnn/Network.cpp b/src/armnn/Network.cpp index 408003ec91..498c4a72ad 100644 --- a/src/armnn/Network.cpp +++ b/src/armnn/Network.cpp @@ -514,7 +514,7 @@ const std::shared_ptr<IProfiler>& IOptimizedNetwork::GetProfiler() const return pOptimizedNetworkImpl->GetGraph().GetProfiler(); } -profiling::ProfilingGuid IOptimizedNetwork::GetGuid() const +arm::pipe::ProfilingGuid IOptimizedNetwork::GetGuid() const { return pOptimizedNetworkImpl->GetGuid(); } @@ -2866,18 +2866,18 @@ void NetworkImpl::ExecuteStrategy(IStrategy& strategy) const OptimizedNetworkImpl::OptimizedNetworkImpl(const OptimizedNetworkImpl& other, const ModelOptions& modelOptions) : m_Graph(new Graph(*other.m_Graph.get())) - , m_Guid(profiling::ProfilingService::GetNextGuid()) + , m_Guid(arm::pipe::ProfilingService::GetNextGuid()) , m_ModelOptions(modelOptions) { } OptimizedNetworkImpl::OptimizedNetworkImpl(std::unique_ptr<Graph> graph) - : m_Graph(std::move(graph)), m_Guid(profiling::ProfilingService::GetNextGuid()) + : m_Graph(std::move(graph)), m_Guid(arm::pipe::ProfilingService::GetNextGuid()) { } OptimizedNetworkImpl::OptimizedNetworkImpl(std::unique_ptr<Graph> graph, const ModelOptions& modelOptions) - : m_Graph(std::move(graph)), m_Guid(profiling::ProfilingService::GetNextGuid()), m_ModelOptions(modelOptions) + : m_Graph(std::move(graph)), m_Guid(arm::pipe::ProfilingService::GetNextGuid()), m_ModelOptions(modelOptions) { } diff --git a/src/armnn/OptimizedNetworkImpl.hpp b/src/armnn/OptimizedNetworkImpl.hpp index 112d585aee..cb0dc4c8cf 100644 --- a/src/armnn/OptimizedNetworkImpl.hpp +++ b/src/armnn/OptimizedNetworkImpl.hpp @@ -19,7 +19,7 @@ public: virtual Status PrintGraph(); virtual Status SerializeToDot(std::ostream& stream) const; - virtual profiling::ProfilingGuid GetGuid() const { return m_Guid; }; + virtual arm::pipe::ProfilingGuid GetGuid() const { return m_Guid; }; virtual size_t GetNumInputs() const; virtual size_t GetNumOutputs() const; @@ -29,7 +29,7 @@ public: private: std::unique_ptr<Graph> m_Graph; - profiling::ProfilingGuid m_Guid; + arm::pipe::ProfilingGuid m_Guid; ModelOptions m_ModelOptions; }; diff --git a/src/armnn/Profiling.cpp b/src/armnn/Profiling.cpp index e7df459103..e18bf475d1 100644 --- a/src/armnn/Profiling.cpp +++ b/src/armnn/Profiling.cpp @@ -206,7 +206,7 @@ Event* ProfilerImpl::BeginEvent(armnn::IProfiler* profiler, const BackendId& backendId, const std::string& label, std::vector<InstrumentPtr>&& instruments, - const Optional<profiling::ProfilingGuid>& guid) + const Optional<arm::pipe::ProfilingGuid>& guid) { Event* parent = m_Parents.empty() ? nullptr : m_Parents.top(); m_EventSequence.push_back(std::make_unique<Event>(label, @@ -310,7 +310,7 @@ void ExtractJsonObjects(unsigned int inferenceIndex, // If profiling GUID is entered, process it if (parentEvent->GetProfilingGuid().has_value()) { - profiling::ProfilingGuid profilingGuid; + arm::pipe::ProfilingGuid profilingGuid; profilingGuid = parentEvent->GetProfilingGuid().value(); parentObject.SetGuid(profilingGuid); } @@ -610,7 +610,7 @@ void IProfiler::Print(std::ostream& outStream) const Event* IProfiler::BeginEvent(const BackendId& backendId, const std::string& label, std::vector<InstrumentPtr>&& instruments, - const Optional<profiling::ProfilingGuid>& guid) + const Optional<arm::pipe::ProfilingGuid>& guid) { return pProfilerImpl->BeginEvent(this, backendId, label, std::move(instruments), guid); } diff --git a/src/armnn/Profiling.hpp b/src/armnn/Profiling.hpp index c6571d1309..b493d228ea 100644 --- a/src/armnn/Profiling.hpp +++ b/src/armnn/Profiling.hpp @@ -39,13 +39,13 @@ public: const BackendId& backendId, const std::string& name, std::vector<InstrumentPtr>&& instruments, - const Optional<profiling::ProfilingGuid>& guid); + const Optional<arm::pipe::ProfilingGuid>& guid); template<typename DescriptorType> void AddLayerDetails(const std::string& label, const DescriptorType& desc, const WorkloadInfo& infos, - const profiling::ProfilingGuid guid) + const arm::pipe::ProfilingGuid guid) { m_ProfilingDetails->AddDetailsToString(label, desc, infos, guid); } @@ -134,7 +134,7 @@ public: template<typename... Args> ScopedProfilingEvent(const BackendId& backendId, - const Optional<profiling::ProfilingGuid>& guid, + const Optional<arm::pipe::ProfilingGuid>& guid, const std::string& name, Args&& ... args) : m_Event(nullptr) @@ -180,7 +180,7 @@ template<typename DescriptorType> inline void ProfilingUpdateDescriptions(const std::string& name, const DescriptorType& desc, const WorkloadInfo& infos, - const profiling::ProfilingGuid guid) + const arm::pipe::ProfilingGuid guid) { IProfiler* profiler(ProfilerManager::GetInstance().GetProfiler()); ///< Profiler used if (profiler && profiler->IsProfilingEnabled()) @@ -193,7 +193,7 @@ template<typename DescriptorType> void IProfiler::AddLayerDetails(const std::string& name, const DescriptorType& desc, const WorkloadInfo& infos, - const profiling::ProfilingGuid guid) + const arm::pipe::ProfilingGuid guid) { return pProfilerImpl->AddLayerDetails(name, desc, infos, guid); } diff --git a/src/armnn/ProfilingDetails.hpp b/src/armnn/ProfilingDetails.hpp index 774565fd93..68ec00e7f8 100644 --- a/src/armnn/ProfilingDetails.hpp +++ b/src/armnn/ProfilingDetails.hpp @@ -34,7 +34,7 @@ public: void AddDetailsToString(const std::string& workloadName, const DescriptorType& desc, const WorkloadInfo& infos, - const profiling::ProfilingGuid guid) + const arm::pipe::ProfilingGuid guid) { // Once details exist, we can assume we're on the second iteration of details if (m_DetailsExist) diff --git a/src/armnn/ProfilingEvent.cpp b/src/armnn/ProfilingEvent.cpp index 31d4b91d23..e341344544 100644 --- a/src/armnn/ProfilingEvent.cpp +++ b/src/armnn/ProfilingEvent.cpp @@ -13,7 +13,7 @@ Event::Event(const std::string& eventName, Event* parent, const BackendId backendId, std::vector<InstrumentPtr>&& instruments, - const Optional<profiling::ProfilingGuid> guid) + const Optional<arm::pipe::ProfilingGuid> guid) : m_EventName(eventName) , m_Profiler(profiler) , m_Parent(parent) @@ -86,7 +86,7 @@ BackendId Event::GetBackendId() const return m_BackendId; } -Optional<profiling::ProfilingGuid> Event::GetProfilingGuid() const +Optional<arm::pipe::ProfilingGuid> Event::GetProfilingGuid() const { return m_ProfilingGuid; } diff --git a/src/armnn/ProfilingEvent.hpp b/src/armnn/ProfilingEvent.hpp index b0d5be70ba..3b9d5261ef 100644 --- a/src/armnn/ProfilingEvent.hpp +++ b/src/armnn/ProfilingEvent.hpp @@ -35,7 +35,7 @@ public: Event* parent, const BackendId backendId, std::vector<InstrumentPtr>&& instrument, - const Optional<profiling::ProfilingGuid> guid); + const Optional<arm::pipe::ProfilingGuid> guid); Event(const Event& other) = delete; @@ -73,7 +73,7 @@ public: /// Get the associated profiling GUID if the event is a workload /// \return Optional GUID of the event - Optional<profiling::ProfilingGuid> GetProfilingGuid() const; + Optional<arm::pipe::ProfilingGuid> GetProfilingGuid() const; /// Assignment operator Event& operator=(const Event& other) = delete; @@ -98,7 +98,7 @@ private: Instruments m_Instruments; /// Workload Profiling id - Optional<profiling::ProfilingGuid> m_ProfilingGuid; + Optional<arm::pipe::ProfilingGuid> m_ProfilingGuid; }; } // namespace armnn diff --git a/src/armnn/RangeTracker.cpp b/src/armnn/RangeTracker.cpp index ae756fbb9c..346c8bdd2e 100644 --- a/src/armnn/RangeTracker.cpp +++ b/src/armnn/RangeTracker.cpp @@ -26,7 +26,7 @@ void RangeTracker::SetRange(const armnn::IConnectableLayer* layer, unsigned int ranges[outputIdx] = std::make_pair(min, max); } -RangeTracker::MinMaxRange RangeTracker::GetRange(armnn::LayerGuid guid, unsigned int idx) const +RangeTracker::MinMaxRange RangeTracker::GetRange(LayerGuid guid, unsigned int idx) const { auto search = m_GuidToRangesMap.find(guid); if (search == m_GuidToRangesMap.end()) diff --git a/src/armnn/Runtime.cpp b/src/armnn/Runtime.cpp index 4998b3597e..640e5947e2 100644 --- a/src/armnn/Runtime.cpp +++ b/src/armnn/Runtime.cpp @@ -206,7 +206,7 @@ Status RuntimeImpl::LoadNetwork(NetworkId& networkIdOut, if (m_ProfilingService.IsProfilingEnabled()) { - m_ProfilingService.IncrementCounterValue(armnn::profiling::NETWORK_LOADS); + m_ProfilingService.IncrementCounterValue(arm::pipe::NETWORK_LOADS); } return Status::Success; @@ -227,8 +227,8 @@ Status RuntimeImpl::UnloadNetwork(NetworkId networkId) return Status::Failure; } - std::unique_ptr<profiling::TimelineUtilityMethods> timelineUtils = - profiling::TimelineUtilityMethods::GetTimelineUtils(m_ProfilingService); + std::unique_ptr<arm::pipe::TimelineUtilityMethods> timelineUtils = + arm::pipe::TimelineUtilityMethods::GetTimelineUtils(m_ProfilingService); { std::lock_guard<std::mutex> lockGuard(m_Mutex); @@ -238,9 +238,9 @@ Status RuntimeImpl::UnloadNetwork(NetworkId networkId) auto search = m_LoadedNetworks.find(networkId); if (search != m_LoadedNetworks.end()) { - profiling::ProfilingGuid networkGuid = search->second->GetNetworkGuid(); + arm::pipe::ProfilingGuid networkGuid = search->second->GetNetworkGuid(); timelineUtils->RecordEvent(networkGuid, - profiling::LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS); + arm::pipe::LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS); } } @@ -252,7 +252,7 @@ Status RuntimeImpl::UnloadNetwork(NetworkId networkId) if (m_ProfilingService.IsProfilingEnabled()) { - m_ProfilingService.IncrementCounterValue(armnn::profiling::NETWORK_UNLOADS); + m_ProfilingService.IncrementCounterValue(arm::pipe::NETWORK_UNLOADS); } } @@ -280,7 +280,7 @@ const std::shared_ptr<IProfiler> RuntimeImpl::GetProfiler(NetworkId networkId) c return nullptr; } -void RuntimeImpl::ReportStructure() // armnn::profiling::IProfilingService& profilingService as param +void RuntimeImpl::ReportStructure() // arm::pipe::IProfilingService& profilingService as param { // No-op for the time being, but this may be useful in future to have the profilingService available // if (profilingService.IsProfilingEnabled()){} @@ -311,7 +311,7 @@ RuntimeImpl::RuntimeImpl(const IRuntime::CreationOptions& options) // goes through the backend registry LoadDynamicBackends(options.m_DynamicBackendsPath); - BackendIdSet supportedBackends; + armnn::BackendIdSet supportedBackends; for (const auto& id : BackendRegistryInstance().GetBackendIds()) { // Store backend contexts for the supported ones @@ -473,9 +473,9 @@ RuntimeImpl::RuntimeImpl(const IRuntime::CreationOptions& options) } supportedBackends.emplace(id); - unique_ptr<armnn::profiling::IBackendProfiling> profilingIface = - std::make_unique<armnn::profiling::BackendProfiling>(armnn::profiling::BackendProfiling( - ConvertExternalProfilingOptions(options.m_ProfilingOptions), m_ProfilingService, id)); + unique_ptr<arm::pipe::IBackendProfiling> profilingIface = + std::make_unique<arm::pipe::BackendProfiling>(arm::pipe::BackendProfiling( + arm::pipe::ConvertExternalProfilingOptions(options.m_ProfilingOptions), m_ProfilingService, id)); // Backends may also provide a profiling context. Ask for it now. auto profilingContext = backend->CreateBackendProfilingContext(options, profilingIface); @@ -494,7 +494,8 @@ RuntimeImpl::RuntimeImpl(const IRuntime::CreationOptions& options) BackendRegistryInstance().SetProfilingService(m_ProfilingService); // pass configuration info to the profiling service - m_ProfilingService.ConfigureProfilingService(ConvertExternalProfilingOptions(options.m_ProfilingOptions)); + m_ProfilingService.ConfigureProfilingService( + arm::pipe::ConvertExternalProfilingOptions(options.m_ProfilingOptions)); if (options.m_ProfilingOptions.m_EnableProfiling) { // try to wait for the profiling service to initialise @@ -734,7 +735,7 @@ void RuntimeImpl::LoadDynamicBackends(const std::string& overrideBackendPath) m_DynamicBackends = DynamicBackendUtils::CreateDynamicBackends(sharedObjects); // Register the dynamic backends in the backend registry - BackendIdSet registeredBackendIds = DynamicBackendUtils::RegisterDynamicBackends(m_DynamicBackends); + armnn::BackendIdSet registeredBackendIds = DynamicBackendUtils::RegisterDynamicBackends(m_DynamicBackends); // Add the registered dynamic backend ids to the list of supported backends m_DeviceSpec.AddSupportedBackends(registeredBackendIds, true); diff --git a/src/armnn/Runtime.hpp b/src/armnn/Runtime.hpp index bd37013ad0..1ac0d21b63 100644 --- a/src/armnn/Runtime.hpp +++ b/src/armnn/Runtime.hpp @@ -25,7 +25,7 @@ namespace armnn { using LoadedNetworks = std::unordered_map<NetworkId, std::unique_ptr<LoadedNetwork>>; -using IReportStructure = profiling::IReportStructure; +using IReportStructure = arm::pipe::IReportStructure; struct RuntimeImpl final : public IReportStructure { @@ -115,7 +115,7 @@ public: private: friend void RuntimeLoadedNetworksReserve(RuntimeImpl* runtime); // See RuntimeTests.cpp - friend profiling::ProfilingService& GetProfilingService(RuntimeImpl* runtime); // See RuntimeTests.cpp + friend arm::pipe::ProfilingService& GetProfilingService(RuntimeImpl* runtime); // See RuntimeTests.cpp int GenerateNetworkId(); @@ -150,7 +150,7 @@ private: std::vector<DynamicBackendPtr> m_DynamicBackends; /// Profiling Service Instance - profiling::ProfilingService m_ProfilingService; + arm::pipe::ProfilingService m_ProfilingService; }; } // namespace armnn diff --git a/src/armnn/test/NetworkTests.cpp b/src/armnn/test/NetworkTests.cpp index 66dbb4ee16..c64c0a0d40 100644 --- a/src/armnn/test/NetworkTests.cpp +++ b/src/armnn/test/NetworkTests.cpp @@ -32,9 +32,9 @@ TEST_SUITE("Network") TEST_CASE("LayerGuids") { armnn::NetworkImpl net; - armnn::LayerGuid inputId = net.AddInputLayer(0)->GetGuid(); - armnn::LayerGuid addId = net.AddAdditionLayer()->GetGuid(); - armnn::LayerGuid outputId = net.AddOutputLayer(0)->GetGuid(); + LayerGuid inputId = net.AddInputLayer(0)->GetGuid(); + LayerGuid addId = net.AddAdditionLayer()->GetGuid(); + LayerGuid outputId = net.AddOutputLayer(0)->GetGuid(); CHECK(inputId != addId); CHECK(addId != outputId); diff --git a/src/armnn/test/RuntimeTests.cpp b/src/armnn/test/RuntimeTests.cpp index e175c12b57..73e36eaf56 100644 --- a/src/armnn/test/RuntimeTests.cpp +++ b/src/armnn/test/RuntimeTests.cpp @@ -539,7 +539,7 @@ TEST_CASE("IVGCVSW_1929_QuantizedSoftmaxIssue") errMessages); FAIL("An exception should have been thrown"); } - catch (const InvalidArgumentException&) + catch (const armnn::InvalidArgumentException&) { // Different exceptions are thrown on different backends } @@ -627,8 +627,8 @@ TEST_CASE("ProfilingDisable") armnn::NetworkId netId; CHECK(runtime.LoadNetwork(netId, std::move(optNet)) == Status::Success); - profiling::ProfilingServiceRuntimeHelper profilingServiceHelper(GetProfilingService(&runtime)); - profiling::BufferManager& bufferManager = profilingServiceHelper.GetProfilingBufferManager(); + ProfilingServiceRuntimeHelper profilingServiceHelper(GetProfilingService(&runtime)); + BufferManager& bufferManager = profilingServiceHelper.GetProfilingBufferManager(); auto readableBuffer = bufferManager.GetReadableBuffer(); // Profiling is not enabled, the post-optimisation structure should not be created @@ -638,7 +638,7 @@ TEST_CASE("ProfilingDisable") TEST_CASE("ProfilingEnableCpuRef") { using namespace armnn; - using namespace armnn::profiling; + using namespace arm::pipe; // Create runtime in which the test will run armnn::IRuntime::CreationOptions options; @@ -649,7 +649,7 @@ TEST_CASE("ProfilingEnableCpuRef") GetProfilingService(&runtime).ResetExternalProfilingOptions( ConvertExternalProfilingOptions(options.m_ProfilingOptions), false); - profiling::ProfilingServiceRuntimeHelper profilingServiceHelper(GetProfilingService(&runtime)); + ProfilingServiceRuntimeHelper profilingServiceHelper(GetProfilingService(&runtime)); profilingServiceHelper.ForceTransitionToState(ProfilingState::NotConnected); profilingServiceHelper.ForceTransitionToState(ProfilingState::WaitingForAck); profilingServiceHelper.ForceTransitionToState(ProfilingState::Active); @@ -680,7 +680,7 @@ TEST_CASE("ProfilingEnableCpuRef") armnn::NetworkId netId; CHECK(runtime.LoadNetwork(netId, std::move(optNet)) == Status::Success); - profiling::BufferManager& bufferManager = profilingServiceHelper.GetProfilingBufferManager(); + BufferManager& bufferManager = profilingServiceHelper.GetProfilingBufferManager(); auto readableBuffer = bufferManager.GetReadableBuffer(); // Profiling is enabled, the post-optimisation structure should be created diff --git a/src/armnnSerializer/Serializer.cpp b/src/armnnSerializer/Serializer.cpp index 4249e08c71..971621d60c 100644 --- a/src/armnnSerializer/Serializer.cpp +++ b/src/armnnSerializer/Serializer.cpp @@ -95,7 +95,7 @@ serializer::ArgMinMaxFunction GetFlatBufferArgMinMaxFunction(armnn::ArgMinMaxFun } } -uint32_t SerializerStrategy::GetSerializedId(armnn::LayerGuid guid) +uint32_t SerializerStrategy::GetSerializedId(LayerGuid guid) { if (m_guidMap.empty()) { diff --git a/src/armnnSerializer/Serializer.hpp b/src/armnnSerializer/Serializer.hpp index bb6455f842..3905e49cd1 100644 --- a/src/armnnSerializer/Serializer.hpp +++ b/src/armnnSerializer/Serializer.hpp @@ -75,7 +75,7 @@ private: flatbuffers::Offset<flatbuffers::Vector<T>> CreateDataVector(const void* memory, unsigned int size); ///Function which maps Guid to an index - uint32_t GetSerializedId(armnn::LayerGuid guid); + uint32_t GetSerializedId(LayerGuid guid); /// Creates the serializer InputSlots for the layer. std::vector<flatbuffers::Offset<armnnSerializer::InputSlot>> CreateInputSlots( @@ -98,7 +98,7 @@ private: std::vector<int> m_outputIds; /// Mapped Guids of all Layers to match our index. - std::unordered_map<armnn::LayerGuid, uint32_t > m_guidMap; + std::unordered_map<LayerGuid, uint32_t > m_guidMap; /// layer within our FlatBuffer index. uint32_t m_layerId; diff --git a/src/armnnTestUtils/TestUtils.cpp b/src/armnnTestUtils/TestUtils.cpp index 9ac0b3986e..44984a9314 100644 --- a/src/armnnTestUtils/TestUtils.cpp +++ b/src/armnnTestUtils/TestUtils.cpp @@ -54,7 +54,7 @@ ModelOptions& GetModelOptionsForTesting(IOptimizedNetwork* optNet) return optNet->pOptimizedNetworkImpl->GetModelOptions(); } -profiling::ProfilingService& GetProfilingService(armnn::RuntimeImpl* runtime) +arm::pipe::ProfilingService& GetProfilingService(armnn::RuntimeImpl* runtime) { return runtime->m_ProfilingService; } diff --git a/src/armnnTestUtils/TestUtils.hpp b/src/armnnTestUtils/TestUtils.hpp index d5b6d1b805..5433d93332 100644 --- a/src/armnnTestUtils/TestUtils.hpp +++ b/src/armnnTestUtils/TestUtils.hpp @@ -53,6 +53,6 @@ namespace armnn { Graph& GetGraphForTesting(IOptimizedNetwork* optNetPtr); ModelOptions& GetModelOptionsForTesting(IOptimizedNetwork* optNetPtr); -profiling::ProfilingService& GetProfilingService(RuntimeImpl* runtime); +arm::pipe::ProfilingService& GetProfilingService(RuntimeImpl* runtime); } // namespace armnn
\ No newline at end of file diff --git a/src/armnnUtils/ProfilingOptionsConverter.cpp b/src/armnnUtils/ProfilingOptionsConverter.cpp index 6d5b35134a..9a256db47c 100644 --- a/src/armnnUtils/ProfilingOptionsConverter.cpp +++ b/src/armnnUtils/ProfilingOptionsConverter.cpp @@ -8,23 +8,28 @@ #include <algorithm> #include <iterator> -namespace armnn +namespace arm { -profiling::ProfilingOptions ConvertExternalProfilingOptions( - const IRuntime::CreationOptions::ExternalProfilingOptions& options) +namespace pipe { - profiling::ProfilingOptions convertedOptions; - convertedOptions.m_EnableProfiling = options.m_EnableProfiling; - convertedOptions.m_TimelineEnabled = options.m_TimelineEnabled; + +ProfilingOptions ConvertExternalProfilingOptions( + const armnn::IRuntime::CreationOptions::ExternalProfilingOptions& options) +{ + ProfilingOptions convertedOptions; + convertedOptions.m_EnableProfiling = options.m_EnableProfiling; + convertedOptions.m_TimelineEnabled = options.m_TimelineEnabled; convertedOptions.m_OutgoingCaptureFile = options.m_OutgoingCaptureFile; convertedOptions.m_IncomingCaptureFile = options.m_IncomingCaptureFile; - convertedOptions.m_FileOnly = options.m_FileOnly; - convertedOptions.m_CapturePeriod = options.m_CapturePeriod; - convertedOptions.m_FileFormat = options.m_FileFormat; + convertedOptions.m_FileOnly = options.m_FileOnly; + convertedOptions.m_CapturePeriod = options.m_CapturePeriod; + convertedOptions.m_FileFormat = options.m_FileFormat; std::copy(options.m_LocalPacketHandlers.begin(), options.m_LocalPacketHandlers.end(), - std::back_inserter(convertedOptions.m_LocalPacketHandlers)); + std::back_inserter(convertedOptions.m_LocalPacketHandlers)); return convertedOptions; } -} // namespace armnn +} // namespace arm + +} // namespace pipe diff --git a/src/armnnUtils/ProfilingOptionsConverter.hpp b/src/armnnUtils/ProfilingOptionsConverter.hpp index 02be849816..3bf1f1920d 100644 --- a/src/armnnUtils/ProfilingOptionsConverter.hpp +++ b/src/armnnUtils/ProfilingOptionsConverter.hpp @@ -8,10 +8,15 @@ #include <armnn/IRuntime.hpp> #include <armnn/profiling/ProfilingOptions.hpp> -namespace armnn +namespace arm { -profiling::ProfilingOptions ConvertExternalProfilingOptions( - const IRuntime::CreationOptions::ExternalProfilingOptions& options); +namespace pipe +{ + +ProfilingOptions ConvertExternalProfilingOptions( + const armnn::IRuntime::CreationOptions::ExternalProfilingOptions& options); + +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/backends/README.md b/src/backends/README.md index 7105319f2a..a8baa15cfd 100644 --- a/src/backends/README.md +++ b/src/backends/README.md @@ -114,7 +114,7 @@ The interface functions to be implemented are: const IMemoryManagerSharedPtr& memoryManager = nullptr) const = 0; virtual IBackendContextPtr CreateBackendContext(const IRuntime::CreationOptions&) const = 0; virtual IBackendProfilingContextPtr CreateBackendProfilingContext(const IRuntime::CreationOptions& creationOptions, - armnn::profiling::IBackendProfiling& backendProfiling) const = 0; + arm::pipe::IBackendProfiling& backendProfiling) const = 0; virtual ILayerSupportSharedPtr GetLayerSupport() const = 0; virtual Optimizations GetOptimizations() const = 0; virtual SubgraphUniquePtr OptimizeSubgraph(const SubgraphView& subgraph, bool& optimizationAttempted) const; diff --git a/src/backends/backendsCommon/test/BackendProfilingTests.cpp b/src/backends/backendsCommon/test/BackendProfilingTests.cpp index 9769b4f7a1..3651696fd3 100644 --- a/src/backends/backendsCommon/test/BackendProfilingTests.cpp +++ b/src/backends/backendsCommon/test/BackendProfilingTests.cpp @@ -30,7 +30,7 @@ #include <limits> #include <backends/BackendProfiling.hpp> -using namespace armnn::profiling; +using namespace arm::pipe; class ReadCounterVals : public IReadCounterValues { @@ -134,7 +134,7 @@ TEST_CASE("BackendProfilingCounterRegisterMockBackendTest") // Check if the MockBackends 3 dummy counters {0, 1, 2-5 (four cores)} are registered armnn::BackendId mockId = armnn::MockBackendId(); - const armnn::profiling::ICounterMappings& counterMap = GetProfilingService(&runtime).GetCounterMappings(); + const ICounterMappings& counterMap = GetProfilingService(&runtime).GetCounterMappings(); CHECK(counterMap.GetGlobalId(0, mockId) == 5 + shiftedId); CHECK(counterMap.GetGlobalId(1, mockId) == 6 + shiftedId); CHECK(counterMap.GetGlobalId(2, mockId) == 7 + shiftedId); @@ -161,20 +161,20 @@ TEST_CASE("TestBackendCounters") ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; - std::unique_ptr<armnn::profiling::IBackendProfiling> cpuBackendProfilingPtr = + std::unique_ptr<IBackendProfiling> cpuBackendProfilingPtr = std::make_unique<BackendProfiling>(options, profilingService, cpuAccId); - std::unique_ptr<armnn::profiling::IBackendProfiling> gpuBackendProfilingPtr = + std::unique_ptr<IBackendProfiling> gpuBackendProfilingPtr = std::make_unique<BackendProfiling>(options, profilingService, gpuAccId); - std::shared_ptr<armnn::profiling::IBackendProfilingContext> cpuProfilingContextPtr = + std::shared_ptr<IBackendProfilingContext> cpuProfilingContextPtr = std::make_shared<armnn::MockBackendProfilingContext>(cpuBackendProfilingPtr); - std::shared_ptr<armnn::profiling::IBackendProfilingContext> gpuProfilingContextPtr = + std::shared_ptr<IBackendProfilingContext> gpuProfilingContextPtr = std::make_shared<armnn::MockBackendProfilingContext>(gpuBackendProfilingPtr); std::unordered_map<armnn::BackendId, - std::shared_ptr<armnn::profiling::IBackendProfilingContext>> backendProfilingContexts; + std::shared_ptr<IBackendProfilingContext>> backendProfilingContexts; backendProfilingContexts[cpuAccId] = cpuProfilingContextPtr; backendProfilingContexts[gpuAccId] = gpuProfilingContextPtr; @@ -409,16 +409,16 @@ TEST_CASE("TestBackendCounterLogging") ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; - std::unique_ptr<armnn::profiling::IBackendProfiling> cpuBackendProfilingPtr = + std::unique_ptr<IBackendProfiling> cpuBackendProfilingPtr = std::make_unique<BackendProfiling>(options, profilingService, cpuAccId); - std::shared_ptr<armnn::profiling::IBackendProfilingContext> cpuProfilingContextPtr = + std::shared_ptr<IBackendProfilingContext> cpuProfilingContextPtr = std::make_shared<armnn::MockBackendProfilingContext>(cpuBackendProfilingPtr); std::unordered_map<armnn::BackendId, - std::shared_ptr<armnn::profiling::IBackendProfilingContext>> backendProfilingContexts; + std::shared_ptr<IBackendProfilingContext>> backendProfilingContexts; uint16_t globalId = 5; counterIdMap.RegisterMapping(globalId, 0, cpuAccId); @@ -461,7 +461,7 @@ TEST_CASE("BackendProfilingContextGetSendTimelinePacket") // Reset the profiling service to the uninitialized state armnn::IRuntime::CreationOptions options; options.m_ProfilingOptions.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ConfigureProfilingService( ConvertExternalProfilingOptions(options.m_ProfilingOptions), true); @@ -478,7 +478,7 @@ TEST_CASE("BackendProfilingContextGetSendTimelinePacket") // Now for the meat of the test. We're just going to send a random packet and make sure there // are no exceptions or errors. The sending of packets is already tested in SendTimelinePacketTests. - std::unique_ptr<armnn::profiling::ISendTimelinePacket> timelinePacket = + std::unique_ptr<ISendTimelinePacket> timelinePacket = backendProfilingIface->GetSendTimelinePacket(); // Send TimelineEntityClassBinaryPacket const uint64_t entityBinaryPacketProfilingGuid = 123456u; @@ -509,9 +509,9 @@ TEST_CASE("GetProfilingGuidGenerator") CHECK(backendProfilingIface); // Get the Guid generator and check the getting two Guid's results in the second being greater than the first. - armnn::profiling::IProfilingGuidGenerator& guidGenerator = backendProfilingIface->GetProfilingGuidGenerator(); - const armnn::profiling::ProfilingDynamicGuid& firstGuid = guidGenerator.NextGuid(); - const armnn::profiling::ProfilingDynamicGuid& secondGuid = guidGenerator.NextGuid(); + IProfilingGuidGenerator& guidGenerator = backendProfilingIface->GetProfilingGuidGenerator(); + const ProfilingDynamicGuid& firstGuid = guidGenerator.NextGuid(); + const ProfilingDynamicGuid& secondGuid = guidGenerator.NextGuid(); CHECK(secondGuid > firstGuid); // Reset the profiling servie after the test. diff --git a/src/backends/backendsCommon/test/MockBackend.hpp b/src/backends/backendsCommon/test/MockBackend.hpp index df133dfed2..9b7b2f37c4 100644 --- a/src/backends/backendsCommon/test/MockBackend.hpp +++ b/src/backends/backendsCommon/test/MockBackend.hpp @@ -26,7 +26,7 @@ public: ~MockBackendInitialiser(); }; -class MockBackendProfilingContext : public profiling::IBackendProfilingContext +class MockBackendProfilingContext : public arm::pipe::IBackendProfilingContext { public: MockBackendProfilingContext(IBackendInternal::IBackendProfilingPtr& backendProfiling) @@ -44,7 +44,7 @@ public: uint16_t RegisterCounters(uint16_t currentMaxGlobalCounterId) { - std::unique_ptr<profiling::IRegisterBackendCounters> counterRegistrar = + std::unique_ptr<arm::pipe::IRegisterBackendCounters> counterRegistrar = m_BackendProfiling->GetCounterRegistrationInterface(static_cast<uint16_t>(currentMaxGlobalCounterId)); std::string categoryName("MockCounters"); @@ -77,17 +77,17 @@ public: return armnn::Optional<std::string>(); } - std::vector<profiling::Timestamp> ReportCounterValues() + std::vector<arm::pipe::Timestamp> ReportCounterValues() { - std::vector<profiling::CounterValue> counterValues; + std::vector<arm::pipe::CounterValue> counterValues; for (auto counterId : m_ActiveCounters) { - counterValues.emplace_back(profiling::CounterValue{ counterId, counterId + 1u }); + counterValues.emplace_back(arm::pipe::CounterValue{ counterId, counterId + 1u }); } uint64_t timestamp = m_CapturePeriod; - return { profiling::Timestamp{ timestamp, counterValues } }; + return { arm::pipe::Timestamp{ timestamp, counterValues } }; } bool EnableProfiling(bool) diff --git a/src/profiling/ActivateTimelineReportingCommandHandler.cpp b/src/profiling/ActivateTimelineReportingCommandHandler.cpp index 77df76f2fe..7f949d361a 100644 --- a/src/profiling/ActivateTimelineReportingCommandHandler.cpp +++ b/src/profiling/ActivateTimelineReportingCommandHandler.cpp @@ -9,10 +9,10 @@ #include <armnn/Exceptions.hpp> #include <fmt/format.h> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { void ActivateTimelineReportingCommandHandler::operator()(const arm::pipe::Packet& packet) @@ -30,7 +30,7 @@ void ActivateTimelineReportingCommandHandler::operator()(const arm::pipe::Packet case ProfilingState::Uninitialised: case ProfilingState::NotConnected: case ProfilingState::WaitingForAck: - throw RuntimeException(fmt::format( + throw armnn::RuntimeException(fmt::format( "Activate Timeline Reporting Command Handler invoked while in a wrong state: {}", GetProfilingStateName(currentState))); case ProfilingState::Active: @@ -56,11 +56,11 @@ void ActivateTimelineReportingCommandHandler::operator()(const arm::pipe::Packet break; default: - throw RuntimeException(fmt::format("Unknown profiling service state: {}", + throw armnn::RuntimeException(fmt::format("Unknown profiling service state: {}", static_cast<int>(currentState))); } } -} // namespace profiling +} // namespace pipe -} // namespace armnn
\ No newline at end of file +} // namespace arm
\ No newline at end of file diff --git a/src/profiling/ActivateTimelineReportingCommandHandler.hpp b/src/profiling/ActivateTimelineReportingCommandHandler.hpp index a40115084b..2564b88bee 100644 --- a/src/profiling/ActivateTimelineReportingCommandHandler.hpp +++ b/src/profiling/ActivateTimelineReportingCommandHandler.hpp @@ -16,10 +16,10 @@ #include <common/include/Packet.hpp> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class ActivateTimelineReportingCommandHandler : public arm::pipe::CommandHandlerFunctor @@ -30,7 +30,7 @@ public: uint32_t version, SendTimelinePacket& sendTimelinePacket, ProfilingStateMachine& profilingStateMachine, - Optional<IReportStructure&> reportStructure, + armnn::Optional<IReportStructure&> reportStructure, std::atomic<bool>& timelineReporting, INotifyBackends& notifyBackends) : CommandHandlerFunctor(familyId, packetId, version), @@ -49,9 +49,9 @@ private: std::atomic<bool>& m_TimelineReporting; INotifyBackends& m_BackendNotifier; - Optional<IReportStructure&> m_ReportStructure; + armnn::Optional<IReportStructure&> m_ReportStructure; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn
\ No newline at end of file +} // namespace arm
\ No newline at end of file diff --git a/src/profiling/BufferManager.cpp b/src/profiling/BufferManager.cpp index be60f2788d..42e32009e4 100644 --- a/src/profiling/BufferManager.cpp +++ b/src/profiling/BufferManager.cpp @@ -6,10 +6,10 @@ #include "BufferManager.hpp" #include "PacketBuffer.hpp" -namespace armnn +namespace arm { -namespace profiling +namespace pipe { BufferManager::BufferManager(unsigned int numberOfBuffers, unsigned int maxPacketSize) @@ -161,6 +161,6 @@ void BufferManager::FlushReadList() } } -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/BufferManager.hpp b/src/profiling/BufferManager.hpp index 4bc7725721..0ab3e0e534 100644 --- a/src/profiling/BufferManager.hpp +++ b/src/profiling/BufferManager.hpp @@ -13,10 +13,10 @@ #include <vector> #include <queue> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class BufferManager : public IBufferManager @@ -71,6 +71,6 @@ private: IConsumer* m_Consumer = nullptr; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/CommandHandler.cpp b/src/profiling/CommandHandler.cpp index 9f536445e9..f709b2826c 100644 --- a/src/profiling/CommandHandler.cpp +++ b/src/profiling/CommandHandler.cpp @@ -8,10 +8,10 @@ #include <armnn/Logging.hpp> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { void CommandHandler::Start(IProfilingConnection& profilingConnection) @@ -85,7 +85,7 @@ void CommandHandler::HandleCommands(IProfilingConnection& profilingConnection) m_KeepRunning.store(false); } } - catch (const Exception& e) + catch (const armnn::Exception& e) { // Log the error and continue ARMNN_LOG(warning) << "An error has occurred when handling a command: " << e.what(); @@ -104,6 +104,6 @@ void CommandHandler::HandleCommands(IProfilingConnection& profilingConnection) m_IsRunning.store(false); } -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/CommandHandler.hpp b/src/profiling/CommandHandler.hpp index b2c9725a34..b097f9ef20 100644 --- a/src/profiling/CommandHandler.hpp +++ b/src/profiling/CommandHandler.hpp @@ -13,10 +13,10 @@ #include <atomic> #include <thread> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class CommandHandler @@ -56,6 +56,6 @@ private: arm::pipe::PacketVersionResolver& m_PacketVersionResolver; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/ConnectionAcknowledgedCommandHandler.cpp b/src/profiling/ConnectionAcknowledgedCommandHandler.cpp index c61c091bc4..63ca741374 100644 --- a/src/profiling/ConnectionAcknowledgedCommandHandler.cpp +++ b/src/profiling/ConnectionAcknowledgedCommandHandler.cpp @@ -10,10 +10,10 @@ #include <fmt/format.h> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { void ConnectionAcknowledgedCommandHandler::operator()(const arm::pipe::Packet& packet) @@ -23,7 +23,7 @@ void ConnectionAcknowledgedCommandHandler::operator()(const arm::pipe::Packet& p { case ProfilingState::Uninitialised: case ProfilingState::NotConnected: - throw RuntimeException(fmt::format("Connection Acknowledged Command Handler invoked while in an " + throw armnn::RuntimeException(fmt::format("Connection Acknowledged Command Handler invoked while in an " "wrong state: {}", GetProfilingStateName(currentState))); case ProfilingState::WaitingForAck: @@ -54,7 +54,7 @@ void ConnectionAcknowledgedCommandHandler::operator()(const arm::pipe::Packet& p // Enable profiling on the backend and assert that it returns true if(!backendContext.second->EnableProfiling(true)) { - throw BackendProfilingException( + throw armnn::BackendProfilingException( "Unable to enable profiling on Backend Id: " + backendContext.first.Get()); } } @@ -67,12 +67,12 @@ void ConnectionAcknowledgedCommandHandler::operator()(const arm::pipe::Packet& p case ProfilingState::Active: return; // NOP default: - throw RuntimeException(fmt::format("Unknown profiling service state: {}", + throw armnn::RuntimeException(fmt::format("Unknown profiling service state: {}", static_cast<int>(currentState))); } } -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/ConnectionAcknowledgedCommandHandler.hpp b/src/profiling/ConnectionAcknowledgedCommandHandler.hpp index bad61b485f..5bb3c95cf5 100644 --- a/src/profiling/ConnectionAcknowledgedCommandHandler.hpp +++ b/src/profiling/ConnectionAcknowledgedCommandHandler.hpp @@ -14,16 +14,16 @@ #include <common/include/CommandHandlerFunctor.hpp> #include <common/include/Packet.hpp> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class ConnectionAcknowledgedCommandHandler final : public arm::pipe::CommandHandlerFunctor { -typedef const std::unordered_map<BackendId, std::shared_ptr<armnn::profiling::IBackendProfilingContext>>& +typedef const std::unordered_map<armnn::BackendId, std::shared_ptr<IBackendProfilingContext>>& BackendProfilingContexts; public: @@ -35,7 +35,8 @@ public: ISendTimelinePacket& sendTimelinePacket, ProfilingStateMachine& profilingStateMachine, IProfilingServiceStatus& profilingServiceStatus, - Optional<BackendProfilingContexts> backendProfilingContexts = EmptyOptional()) + armnn::Optional<BackendProfilingContexts> backendProfilingContexts = + armnn::EmptyOptional()) : CommandHandlerFunctor(familyId, packetId, version) , m_CounterDirectory(counterDirectory) , m_SendCounterPacket(sendCounterPacket) @@ -59,11 +60,11 @@ private: ISendTimelinePacket& m_SendTimelinePacket; ProfilingStateMachine& m_StateMachine; IProfilingServiceStatus& m_ProfilingServiceStatus; - Optional<BackendProfilingContexts> m_BackendProfilingContext; + armnn::Optional<BackendProfilingContexts> m_BackendProfilingContext; std::atomic<bool> m_TimelineEnabled; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/CounterDirectory.cpp b/src/profiling/CounterDirectory.cpp index 9ef379a04e..5a7d8c6165 100644 --- a/src/profiling/CounterDirectory.cpp +++ b/src/profiling/CounterDirectory.cpp @@ -14,10 +14,10 @@ #include <fmt/format.h> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { const Category* CounterDirectory::RegisterCategory(const std::string& categoryName) @@ -52,7 +52,7 @@ const Category* CounterDirectory::RegisterCategory(const std::string& categoryNa const Device* CounterDirectory::RegisterDevice(const std::string& deviceName, uint16_t cores, - const Optional<std::string>& parentCategoryName) + const armnn::Optional<std::string>& parentCategoryName) { // Check that the given device name is valid if (deviceName.empty() || @@ -113,7 +113,7 @@ const Device* CounterDirectory::RegisterDevice(const std::string& deviceName, const CounterSet* CounterDirectory::RegisterCounterSet(const std::string& counterSetName, uint16_t count, - const Optional<std::string>& parentCategoryName) + const armnn::Optional<std::string>& parentCategoryName) { // Check that the given counter set name is valid if (counterSetName.empty() || @@ -178,7 +178,7 @@ const CounterSet* CounterDirectory::RegisterCounterSet(const std::string& counte return counterSetPtr; } -const Counter* CounterDirectory::RegisterCounter(const BackendId& backendId, +const Counter* CounterDirectory::RegisterCounter(const armnn::BackendId& backendId, const uint16_t uid, const std::string& parentCategoryName, uint16_t counterClass, @@ -186,10 +186,10 @@ const Counter* CounterDirectory::RegisterCounter(const BackendId& backendId, double multiplier, const std::string& name, const std::string& description, - const Optional<std::string>& units, - const Optional<uint16_t>& numberOfCores, - const Optional<uint16_t>& deviceUid, - const Optional<uint16_t>& counterSetUid) + const armnn::Optional<std::string>& units, + const armnn::Optional<uint16_t>& numberOfCores, + const armnn::Optional<uint16_t>& deviceUid, + const armnn::Optional<uint16_t>& counterSetUid) { IgnoreUnused(backendId); @@ -502,7 +502,7 @@ CountersIt CounterDirectory::FindCounter(const std::string& counterName) const }); } -uint16_t CounterDirectory::GetNumberOfCores(const Optional<uint16_t>& numberOfCores, +uint16_t CounterDirectory::GetNumberOfCores(const armnn::Optional<uint16_t>& numberOfCores, uint16_t deviceUid) { // To get the number of cores, apply the following rules: @@ -544,6 +544,6 @@ uint16_t CounterDirectory::GetNumberOfCores(const Optional<uint16_t>& numberOfCo return 0; } -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/CounterDirectory.hpp b/src/profiling/CounterDirectory.hpp index a6e788ee1f..ee9b52e8cd 100644 --- a/src/profiling/CounterDirectory.hpp +++ b/src/profiling/CounterDirectory.hpp @@ -14,10 +14,10 @@ #include <armnn/utility/NumericCast.hpp> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class CounterDirectory final : public ICounterDirectory, public ICounterRegistry @@ -30,11 +30,13 @@ public: const Category* RegisterCategory (const std::string& categoryName) override; const Device* RegisterDevice (const std::string& deviceName, uint16_t cores = 0, - const Optional<std::string>& parentCategoryName = EmptyOptional()) override; + const armnn::Optional<std::string>& parentCategoryName + = armnn::EmptyOptional()) override; const CounterSet* RegisterCounterSet(const std::string& counterSetName, uint16_t count = 0, - const Optional<std::string>& parentCategoryName = EmptyOptional()) override; - const Counter* RegisterCounter(const BackendId& backendId, + const armnn::Optional<std::string>& parentCategoryName + = armnn::EmptyOptional()) override; + const Counter* RegisterCounter(const armnn::BackendId& backendId, const uint16_t uid, const std::string& parentCategoryName, uint16_t counterClass, @@ -42,10 +44,10 @@ public: double multiplier, const std::string& name, const std::string& description, - const Optional<std::string>& units = EmptyOptional(), - const Optional<uint16_t>& numberOfCores = EmptyOptional(), - const Optional<uint16_t>& deviceUid = EmptyOptional(), - const Optional<uint16_t>& counterSetUid = EmptyOptional()) override; + const armnn::Optional<std::string>& units = armnn::EmptyOptional(), + const armnn::Optional<uint16_t>& numberOfCores = armnn::EmptyOptional(), + const armnn::Optional<uint16_t>& deviceUid = armnn::EmptyOptional(), + const armnn::Optional<uint16_t>& counterSetUid = armnn::EmptyOptional()) override; // Getters for counts uint16_t GetCategoryCount() const override { return armnn::numeric_cast<uint16_t>(m_Categories.size()); } @@ -92,10 +94,10 @@ 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 Optional<uint16_t>& numberOfCores, + uint16_t GetNumberOfCores(const armnn::Optional<uint16_t>& numberOfCores, uint16_t deviceUid); }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/CounterIdMap.cpp b/src/profiling/CounterIdMap.cpp index 862600538b..bb575705ed 100644 --- a/src/profiling/CounterIdMap.cpp +++ b/src/profiling/CounterIdMap.cpp @@ -7,9 +7,9 @@ #include <armnn/Exceptions.hpp> #include <map> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { void CounterIdMap::RegisterMapping(uint16_t globalCounterId, @@ -52,5 +52,5 @@ const std::pair<uint16_t, armnn::BackendId>& CounterIdMap::GetBackendId(uint16_t return it->second; } -} // namespace profiling -} // namespace armnn +} // namespace pipe +} // namespace arm diff --git a/src/profiling/CounterIdMap.hpp b/src/profiling/CounterIdMap.hpp index 5c1a6ea609..7a3c3614ee 100644 --- a/src/profiling/CounterIdMap.hpp +++ b/src/profiling/CounterIdMap.hpp @@ -7,9 +7,9 @@ #include "armnn/BackendId.hpp" #include <map> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class ICounterMappings @@ -47,5 +47,5 @@ private: std::map<std::pair<uint16_t, armnn::BackendId>, uint16_t> m_BackendCounterIdMap; }; -} // namespace profiling -} // namespace armnn +} // namespace pipe +} // namespace arm diff --git a/src/profiling/DeactivateTimelineReportingCommandHandler.cpp b/src/profiling/DeactivateTimelineReportingCommandHandler.cpp index 37d46c05dc..d9aa7fda45 100644 --- a/src/profiling/DeactivateTimelineReportingCommandHandler.cpp +++ b/src/profiling/DeactivateTimelineReportingCommandHandler.cpp @@ -9,10 +9,10 @@ #include <fmt/format.h> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { void DeactivateTimelineReportingCommandHandler::operator()(const arm::pipe::Packet& packet) @@ -24,7 +24,7 @@ void DeactivateTimelineReportingCommandHandler::operator()(const arm::pipe::Pack case ProfilingState::Uninitialised: case ProfilingState::NotConnected: case ProfilingState::WaitingForAck: - throw RuntimeException(fmt::format( + throw armnn::RuntimeException(fmt::format( "Deactivate Timeline Reporting Command Handler invoked while in a wrong state: {}", GetProfilingStateName(currentState))); case ProfilingState::Active: @@ -42,12 +42,12 @@ void DeactivateTimelineReportingCommandHandler::operator()(const arm::pipe::Pack break; default: - throw RuntimeException(fmt::format("Unknown profiling service state: {}", + throw armnn::RuntimeException(fmt::format("Unknown profiling service state: {}", static_cast<int>(currentState))); } } -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/DeactivateTimelineReportingCommandHandler.hpp b/src/profiling/DeactivateTimelineReportingCommandHandler.hpp index 822e92c425..4d0473ff78 100644 --- a/src/profiling/DeactivateTimelineReportingCommandHandler.hpp +++ b/src/profiling/DeactivateTimelineReportingCommandHandler.hpp @@ -7,14 +7,15 @@ #include "ProfilingStateMachine.hpp" #include "INotifyBackends.hpp" +#include "ProfilingStateMachine.hpp" #include <common/include/CommandHandlerFunctor.hpp> #include <common/include/Packet.hpp> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class DeactivateTimelineReportingCommandHandler : public arm::pipe::CommandHandlerFunctor @@ -41,6 +42,6 @@ private: INotifyBackends& m_BackendNotifier; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn
\ No newline at end of file +} // namespace arm
\ No newline at end of file diff --git a/src/profiling/DirectoryCaptureCommandHandler.cpp b/src/profiling/DirectoryCaptureCommandHandler.cpp index 60463a10c3..75e1aebeb7 100644 --- a/src/profiling/DirectoryCaptureCommandHandler.cpp +++ b/src/profiling/DirectoryCaptureCommandHandler.cpp @@ -11,10 +11,10 @@ #include <atomic> #include <iostream> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { // Utils @@ -40,37 +40,37 @@ void DirectoryCaptureCommandHandler::ParseData(const arm::pipe::Packet& packet) // 0:15 [16] reserved: all zeros offset += uint16_t_size; // 16:31 [16] device_records_count: number of entries in the device_records_pointer_table - deviceRecordCount = profiling::ReadUint16(data, offset); + deviceRecordCount = ReadUint16(data, offset); offset += uint16_t_size; // Body header word 1: // 0:31 [32] device_records_pointer_table_offset: offset to the device_records_pointer_table // The offset is always zero here, as the device record pointer table field is always the first item in the pool - const uint32_t deviceRecordsPointerTableOffset = profiling::ReadUint32(data, offset); + const uint32_t deviceRecordsPointerTableOffset = ReadUint32(data, offset); offset += uint32_t_size; // Body header word 2: // 0:15 [16] reserved: all zeros offset += uint16_t_size; // 16:31 [16] counter_set_count: number of entries in the counter_set_pointer_table - counterSetRecordCount = profiling::ReadUint16(data, offset); + counterSetRecordCount = ReadUint16(data, offset); offset += uint16_t_size; // Body header word 3: // 0:31 [32] counter_set_pointer_table_offset: offset to the counter_set_pointer_table - const uint32_t counterPointerTableSetOffset = profiling::ReadUint32(data, offset); + const uint32_t counterPointerTableSetOffset = ReadUint32(data, offset); offset += uint32_t_size; // Body header word 4: // 0:15 [16] reserved: all zeros offset += uint16_t_size; // 16:31 [16] categories_count: number of entries in the categories_pointer_table - categoryRecordCount = profiling::ReadUint16(data, offset); + categoryRecordCount = ReadUint16(data, offset); offset += uint16_t_size; // Body header word 5: // 0:31 [32] categories_pointer_table_offset: offset to the categories_pointer_table - const uint32_t categoriesPointerTableOffset = profiling::ReadUint32(data, offset); + const uint32_t categoriesPointerTableOffset = ReadUint32(data, offset); offset += uint32_t_size; std::vector<uint32_t> deviceRecordOffsets(deviceRecordCount); @@ -80,21 +80,21 @@ void DirectoryCaptureCommandHandler::ParseData(const arm::pipe::Packet& packet) offset = deviceRecordsPointerTableOffset; for (uint32_t i = 0; i < deviceRecordCount; ++i) { - deviceRecordOffsets[i] = profiling::ReadUint32(data, offset); + deviceRecordOffsets[i] = ReadUint32(data, offset); offset += uint32_t_size; } offset = counterPointerTableSetOffset; for (uint32_t i = 0; i < counterSetRecordCount; ++i) { - counterSetOffsets[i] = profiling::ReadUint32(data, offset); + counterSetOffsets[i] = ReadUint32(data, offset); offset += uint32_t_size; } offset = categoriesPointerTableOffset; for (uint32_t i = 0; i < categoryRecordCount; ++i) { - categoryOffsets[i] = profiling::ReadUint32(data, offset); + categoryOffsets[i] = ReadUint32(data, offset); offset += uint32_t_size; } @@ -104,15 +104,15 @@ void DirectoryCaptureCommandHandler::ParseData(const arm::pipe::Packet& packet) uint32_t deviceRecordOffset = offset + deviceRecordOffsets[deviceIndex]; // Device record word 0: // 0:15 [16] cores: the number of individual streams of counters for one or more cores of some device - uint16_t deviceCores = profiling::ReadUint16(data, deviceRecordOffset); + uint16_t deviceCores = ReadUint16(data, deviceRecordOffset); // 16:31 [16] deviceUid: the unique identifier for the device deviceRecordOffset += uint16_t_size; - uint16_t deviceUid = profiling::ReadUint16(data, deviceRecordOffset); + uint16_t deviceUid = ReadUint16(data, deviceRecordOffset); deviceRecordOffset += uint16_t_size; // Device record word 1: // Offset from the beginning of the device record pool to the name field. - uint32_t nameOffset = profiling::ReadUint32(data, deviceRecordOffset); + uint32_t nameOffset = ReadUint32(data, deviceRecordOffset); deviceRecordOffset = deviceRecordsPointerTableOffset + nameOffset; @@ -128,11 +128,11 @@ void DirectoryCaptureCommandHandler::ParseData(const arm::pipe::Packet& packet) // Counter set record word 0: // 0:15 [16] count: the number of counters which can be active in this set at any one time - uint16_t counterSetCount = profiling::ReadUint16(data, counterSetOffset); + uint16_t counterSetCount = ReadUint16(data, counterSetOffset); counterSetOffset += uint16_t_size; // 16:31 [16] deviceUid: the unique identifier for the counter_set - uint16_t counterSetUid = profiling::ReadUint16(data, counterSetOffset); + uint16_t counterSetUid = ReadUint16(data, counterSetOffset); counterSetOffset += uint16_t_size; // Counter set record word 1: @@ -162,17 +162,17 @@ void DirectoryCaptureCommandHandler::ReadCategoryRecords(const unsigned char* co // 0:15 Reserved, value 0x0000. categoryRecordOffset += uint16_t_size; // 16:31 Number of events belonging to this category. - uint32_t eventCount = profiling::ReadUint16(data, categoryRecordOffset); + uint32_t eventCount = ReadUint16(data, categoryRecordOffset); categoryRecordOffset += uint16_t_size; // Category record word 2 // 0:31 Offset from the beginning of the category data pool to the event_pointer_table - uint32_t eventPointerTableOffset = profiling::ReadUint32(data, categoryRecordOffset); + uint32_t eventPointerTableOffset = ReadUint32(data, categoryRecordOffset); categoryRecordOffset += uint32_t_size; // Category record word 3 // 0:31 Offset from the beginning of the category data pool to the name field. - uint32_t nameOffset = profiling::ReadUint32(data, categoryRecordOffset); + uint32_t nameOffset = ReadUint32(data, categoryRecordOffset); categoryRecordOffset += uint32_t_size; std::vector<uint32_t> eventRecordsOffsets(eventCount); @@ -182,7 +182,7 @@ void DirectoryCaptureCommandHandler::ReadCategoryRecords(const unsigned char* co for (uint32_t eventIndex = 0; eventIndex < eventCount; ++eventIndex) { eventRecordsOffsets[eventIndex] = - profiling::ReadUint32(data, eventPointerTableOffset + uint32_t_size * eventIndex); + ReadUint32(data, eventPointerTableOffset + uint32_t_size * eventIndex); } const std::vector<CounterDirectoryEventRecord>& eventRecords = @@ -218,34 +218,34 @@ std::vector<CounterDirectoryEventRecord> DirectoryCaptureCommandHandler::ReadEve // Event record word 0: // 0:15 [16] count_uid: unique ID for the counter. Must be unique across all counters in all categories - eventRecords[i].m_CounterUid = profiling::ReadUint16(data, eventRecordOffset); + eventRecords[i].m_CounterUid = ReadUint16(data, eventRecordOffset); eventRecordOffset += uint16_t_size; // 16:31 [16] max_counter_uid: if the device this event is associated with has more than one core and there // is one of these counters per core this value will be set to // (counter_uid + cores (from device_record)) - 1. // If there is only a single core then this value will be the same as // the counter_uid value - eventRecords[i].m_MaxCounterUid = profiling::ReadUint16(data, eventRecordOffset); + eventRecords[i].m_MaxCounterUid = ReadUint16(data, eventRecordOffset); eventRecordOffset += uint16_t_size; // Event record word 1: // 0:15 [16] counter_set: UID of the counter_set this event is associated with. Set to zero if the event // is NOT associated with a counter_set - eventRecords[i].m_CounterSetUid = profiling::ReadUint16(data, eventRecordOffset); + eventRecords[i].m_CounterSetUid = ReadUint16(data, eventRecordOffset); eventRecordOffset += uint16_t_size; // 16:31 [16] device: UID of the device this event is associated with. Set to zero if the event is NOT // associated with a device - eventRecords[i].m_DeviceUid = profiling::ReadUint16(data, eventRecordOffset); + eventRecords[i].m_DeviceUid = ReadUint16(data, eventRecordOffset); eventRecordOffset += uint16_t_size; // Event record word 2: // 0:15 [16] interpolation: type describing how to interpolate each data point in a stream of data points - eventRecords[i].m_CounterInterpolation = profiling::ReadUint16(data, eventRecordOffset); + eventRecords[i].m_CounterInterpolation = ReadUint16(data, eventRecordOffset); eventRecordOffset += uint16_t_size; // 16:31 [16] class: type describing how to treat each data point in a stream of data points - eventRecords[i].m_CounterClass = profiling::ReadUint16(data, eventRecordOffset); + eventRecords[i].m_CounterClass = ReadUint16(data, eventRecordOffset); eventRecordOffset += uint16_t_size; // Event record word 3-4: @@ -253,9 +253,9 @@ std::vector<CounterDirectoryEventRecord> DirectoryCaptureCommandHandler::ReadEve // those values as if they are fixed point numbers. Zero is not a valid value uint32_t multiplier[2] = { 0u, 0u }; - multiplier[0] = profiling::ReadUint32(data, eventRecordOffset); + multiplier[0] = ReadUint32(data, eventRecordOffset); eventRecordOffset += uint32_t_size; - multiplier[1] = profiling::ReadUint32(data, eventRecordOffset); + multiplier[1] = ReadUint32(data, eventRecordOffset); eventRecordOffset += uint32_t_size; std::memcpy(&eventRecords[i].m_CounterMultiplier, &multiplier, sizeof(multiplier)); @@ -264,21 +264,21 @@ std::vector<CounterDirectoryEventRecord> DirectoryCaptureCommandHandler::ReadEve // 0:31 [32] name_eventRecordOffset: eventRecordOffset from the // beginning of the event record pool to the name field // The eventRecordOffset is always zero here, as the name field is always the first item in the pool - uint32_t nameOffset = profiling::ReadUint32(data, eventRecordOffset); + uint32_t nameOffset = ReadUint32(data, eventRecordOffset); eventRecordOffset += uint32_t_size; // Event record word 6: // 0:31 [32] description_eventRecordOffset: eventRecordOffset from the // beginning of the event record pool to the description field // The size of the name buffer in bytes - uint32_t descriptionOffset = profiling::ReadUint32(data, eventRecordOffset); + uint32_t descriptionOffset = ReadUint32(data, eventRecordOffset); eventRecordOffset += uint32_t_size; // Event record word 7: // 0:31 [32] units_eventRecordOffset: (optional) eventRecordOffset from the // beginning of the event record pool to the units field. // An eventRecordOffset value of zero indicates this field is not provided - uint32_t unitsOffset = profiling::ReadUint32(data, eventRecordOffset); + uint32_t unitsOffset = ReadUint32(data, eventRecordOffset); eventRecords[i].m_CounterName = GetStringNameFromBuffer(data, offset + eventRecordsOffsets[i] + @@ -290,7 +290,7 @@ std::vector<CounterDirectoryEventRecord> DirectoryCaptureCommandHandler::ReadEve descriptionOffset + uint32_t_size); - eventRecords[i].m_CounterUnits = unitsOffset == 0 ? Optional<std::string>() : + eventRecords[i].m_CounterUnits = unitsOffset == 0 ? armnn::Optional<std::string>() : GetStringNameFromBuffer(data, eventRecordsOffsets[i] + offset + unitsOffset + uint32_t_size); } @@ -313,7 +313,7 @@ void DirectoryCaptureCommandHandler::operator()(const arm::pipe::Packet& packet) if (!m_QuietOperation) { - armnn::profiling::PrintCounterDirectory(m_CounterDirectory); + PrintCounterDirectory(m_CounterDirectory); } } @@ -325,18 +325,18 @@ const ICounterDirectory& DirectoryCaptureCommandHandler::GetCounterDirectory() c std::string DirectoryCaptureCommandHandler::GetStringNameFromBuffer(const unsigned char* const data, uint32_t offset) { std::string deviceName; - uint8_t nextChar = profiling::ReadUint8(data, offset); + uint8_t nextChar = ReadUint8(data, offset); while (isprint(nextChar)) { deviceName += static_cast<char>(nextChar); offset++; - nextChar = profiling::ReadUint8(data, offset); + nextChar = ReadUint8(data, offset); } return deviceName; } -} // namespace profiling +} // namespace pipe -} // namespace armnn
\ No newline at end of file +} // namespace arm
\ No newline at end of file diff --git a/src/profiling/DirectoryCaptureCommandHandler.hpp b/src/profiling/DirectoryCaptureCommandHandler.hpp index 90ae1d400d..8a5241ff84 100644 --- a/src/profiling/DirectoryCaptureCommandHandler.hpp +++ b/src/profiling/DirectoryCaptureCommandHandler.hpp @@ -11,10 +11,10 @@ #include <atomic> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { struct CounterDirectoryEventRecord @@ -26,7 +26,7 @@ struct CounterDirectoryEventRecord std::string m_CounterName; uint16_t m_CounterSetUid; uint16_t m_CounterUid; - Optional<std::string> m_CounterUnits; + armnn::Optional<std::string> m_CounterUnits; uint16_t m_DeviceUid; uint16_t m_MaxCounterUid; }; @@ -80,6 +80,6 @@ private: std::atomic<bool> m_AlreadyParsed; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/FileOnlyProfilingConnection.cpp b/src/profiling/FileOnlyProfilingConnection.cpp index 3b3d7a8284..ee9b8b1701 100644 --- a/src/profiling/FileOnlyProfilingConnection.cpp +++ b/src/profiling/FileOnlyProfilingConnection.cpp @@ -14,10 +14,10 @@ #include <iostream> #include <thread> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { std::vector<uint32_t> StreamMetaDataProcessor::GetHeadersAccepted() @@ -145,7 +145,7 @@ arm::pipe::Packet FileOnlyProfilingConnection::ReadPacket(uint32_t timeout) void FileOnlyProfilingConnection::Fail(const std::string& errorMessage) { Close(); - throw RuntimeException(errorMessage); + throw armnn::RuntimeException(errorMessage); } /// Adds a local packet handler to the FileOnlyProfilingConnection. Invoking this will start @@ -303,6 +303,6 @@ void FileOnlyProfilingConnection::DispatchPacketToHandlers(const arm::pipe::Pack } } -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/FileOnlyProfilingConnection.hpp b/src/profiling/FileOnlyProfilingConnection.hpp index 6204f913f4..9f992d080e 100644 --- a/src/profiling/FileOnlyProfilingConnection.hpp +++ b/src/profiling/FileOnlyProfilingConnection.hpp @@ -20,10 +20,10 @@ #include <queue> #include <thread> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { // forward declaration @@ -128,6 +128,6 @@ private: int m_Timeout; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/Holder.cpp b/src/profiling/Holder.cpp index a366898377..06600807f0 100644 --- a/src/profiling/Holder.cpp +++ b/src/profiling/Holder.cpp @@ -6,10 +6,10 @@ #include <armnn/BackendId.hpp> #include "Holder.hpp" -namespace armnn +namespace arm { -namespace profiling +namespace pipe { CaptureData& CaptureData::operator=(const CaptureData& other) @@ -83,6 +83,6 @@ void Holder::SetCaptureData(uint32_t capturePeriod, } -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/Holder.hpp b/src/profiling/Holder.hpp index 8a89cdac58..612f8dc02e 100644 --- a/src/profiling/Holder.hpp +++ b/src/profiling/Holder.hpp @@ -10,10 +10,10 @@ #include <set> #include "ProfilingUtils.hpp" -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class CaptureData @@ -63,6 +63,6 @@ private: CaptureData m_CaptureData; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/IBufferManager.hpp b/src/profiling/IBufferManager.hpp index 01ecb8222d..6aec43f643 100644 --- a/src/profiling/IBufferManager.hpp +++ b/src/profiling/IBufferManager.hpp @@ -12,10 +12,10 @@ #define MAX_METADATA_PACKET_LENGTH 4096 -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class IBufferManager @@ -38,6 +38,6 @@ public: virtual void FlushReadList() = 0; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/IConsumer.hpp b/src/profiling/IConsumer.hpp index f00f17458b..7a7e5efc64 100644 --- a/src/profiling/IConsumer.hpp +++ b/src/profiling/IConsumer.hpp @@ -5,10 +5,10 @@ #pragma once -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class IConsumer @@ -20,7 +20,7 @@ public: virtual void SetReadyToRead() = 0; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/ICounterDirectory.hpp b/src/profiling/ICounterDirectory.hpp index 4492f854bf..f902f9160b 100644 --- a/src/profiling/ICounterDirectory.hpp +++ b/src/profiling/ICounterDirectory.hpp @@ -13,10 +13,10 @@ #include <unordered_set> #include <unordered_map> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { // Forward declarations @@ -94,7 +94,7 @@ class Counter final { public: // Constructors - Counter(BackendId backendId, + Counter(armnn::BackendId backendId, uint16_t counterUid, uint16_t maxCounterUid, uint16_t counterClass, @@ -119,7 +119,7 @@ public: {} // Fields - BackendId m_BackendId; + armnn::BackendId m_BackendId; uint16_t m_Uid; uint16_t m_MaxCounterUid; uint16_t m_Class; @@ -158,6 +158,6 @@ public: virtual const Counter* GetCounter(uint16_t uid) const = 0; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/ICounterRegistry.hpp b/src/profiling/ICounterRegistry.hpp index 83bc33587c..1d257b82db 100644 --- a/src/profiling/ICounterRegistry.hpp +++ b/src/profiling/ICounterRegistry.hpp @@ -8,10 +8,10 @@ #include <armnn/Optional.hpp> #include <armnn/BackendId.hpp> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class ICounterRegistry @@ -24,13 +24,13 @@ public: virtual const Device* RegisterDevice (const std::string& deviceName, uint16_t cores, - const Optional<std::string>& parentCategoryName) = 0; + const armnn::Optional<std::string>& parentCategoryName) = 0; virtual const CounterSet* RegisterCounterSet(const std::string& counterSetName, uint16_t count, - const Optional<std::string>& parentCategoryName) = 0; + const armnn::Optional<std::string>& parentCategoryName) = 0; - virtual const Counter* RegisterCounter(const BackendId& backendId, + virtual const Counter* RegisterCounter(const armnn::BackendId& backendId, const uint16_t uid, const std::string& parentCategoryName, uint16_t counterClass, @@ -38,13 +38,13 @@ public: double multiplier, const std::string& name, const std::string& description, - const Optional<std::string>& units, - const Optional<uint16_t>& numberOfCores, - const Optional<uint16_t>& deviceUid, - const Optional<uint16_t>& counterSetUid) = 0; + const armnn::Optional<std::string>& units, + const armnn::Optional<uint16_t>& numberOfCores, + const armnn::Optional<uint16_t>& deviceUid, + const armnn::Optional<uint16_t>& counterSetUid) = 0; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/ICounterValues.hpp b/src/profiling/ICounterValues.hpp index 09c26b6722..f49ddf47bb 100644 --- a/src/profiling/ICounterValues.hpp +++ b/src/profiling/ICounterValues.hpp @@ -7,10 +7,10 @@ #include <cstdint> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class IReadCounterValues @@ -41,6 +41,6 @@ public: virtual ~IReadWriteCounterValues() {} }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/INotifyBackends.hpp b/src/profiling/INotifyBackends.hpp index 217ebdef1c..4fa25b70b3 100644 --- a/src/profiling/INotifyBackends.hpp +++ b/src/profiling/INotifyBackends.hpp @@ -5,10 +5,10 @@ #pragma once -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class INotifyBackends @@ -18,7 +18,7 @@ public: virtual void NotifyBackendsForTimelineReporting() = 0; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/IPacketBuffer.hpp b/src/profiling/IPacketBuffer.hpp index 15687a81e9..02c40e4ab1 100644 --- a/src/profiling/IPacketBuffer.hpp +++ b/src/profiling/IPacketBuffer.hpp @@ -7,10 +7,10 @@ #include <memory> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class IReadOnlyPacketBuffer // interface used by the read thread @@ -43,6 +43,6 @@ public: using IPacketBufferPtr = std::unique_ptr<IPacketBuffer>; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/IPeriodicCounterCapture.hpp b/src/profiling/IPeriodicCounterCapture.hpp index bec41dce11..f96d01496e 100644 --- a/src/profiling/IPeriodicCounterCapture.hpp +++ b/src/profiling/IPeriodicCounterCapture.hpp @@ -5,9 +5,9 @@ #pragma once -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class IPeriodicCounterCapture @@ -19,5 +19,5 @@ public: virtual void Stop() = 0; }; -} // namespace profiling -} // namespace armnn +} // namespace pipe +} // namespace arm diff --git a/src/profiling/IProfilingConnection.hpp b/src/profiling/IProfilingConnection.hpp index 7ed714c1a3..988503294a 100644 --- a/src/profiling/IProfilingConnection.hpp +++ b/src/profiling/IProfilingConnection.hpp @@ -11,10 +11,10 @@ #include <cstdint> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class IProfilingConnection @@ -31,6 +31,6 @@ public: virtual arm::pipe::Packet ReadPacket(uint32_t timeout) = 0; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/IProfilingConnectionFactory.hpp b/src/profiling/IProfilingConnectionFactory.hpp index 9b0eda0334..1599914bac 100644 --- a/src/profiling/IProfilingConnectionFactory.hpp +++ b/src/profiling/IProfilingConnectionFactory.hpp @@ -11,10 +11,10 @@ #include <memory> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class IProfilingConnectionFactory @@ -28,6 +28,6 @@ public: virtual IProfilingConnectionPtr GetProfilingConnection(const ProfilingOptions& options) const = 0; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/IProfilingService.hpp b/src/profiling/IProfilingService.hpp index ebdfb39c63..c2e824e6f5 100644 --- a/src/profiling/IProfilingService.hpp +++ b/src/profiling/IProfilingService.hpp @@ -12,10 +12,10 @@ #include <common/include/ProfilingGuidGenerator.hpp> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class IProfilingService : public IProfilingGuidGenerator, public IProfilingServiceStatus @@ -29,7 +29,7 @@ public: virtual CaptureData GetCaptureData() = 0; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/IProfilingServiceStatus.hpp b/src/profiling/IProfilingServiceStatus.hpp index 1d272463ae..3366bdd445 100644 --- a/src/profiling/IProfilingServiceStatus.hpp +++ b/src/profiling/IProfilingServiceStatus.hpp @@ -11,10 +11,10 @@ #include <cstdint> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class IProfilingServiceStatus @@ -25,6 +25,6 @@ public: virtual ~IProfilingServiceStatus() {}; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/IReportStructure.hpp b/src/profiling/IReportStructure.hpp index 1ae049733f..82a84ff6cf 100644 --- a/src/profiling/IReportStructure.hpp +++ b/src/profiling/IReportStructure.hpp @@ -5,10 +5,10 @@ #pragma once -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class IReportStructure @@ -18,7 +18,7 @@ public: virtual void ReportStructure() = 0; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/ISendCounterPacket.hpp b/src/profiling/ISendCounterPacket.hpp index d87a042d76..0e3ae6faf2 100644 --- a/src/profiling/ISendCounterPacket.hpp +++ b/src/profiling/ISendCounterPacket.hpp @@ -8,10 +8,10 @@ #include <armnn/backends/profiling/IBackendProfiling.hpp> #include "ICounterDirectory.hpp" -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class ISendCounterPacket @@ -35,7 +35,7 @@ public: const std::vector<uint16_t>& selectedCounterIds) = 0; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/ISendThread.hpp b/src/profiling/ISendThread.hpp index c5e05b183c..af76a25c56 100644 --- a/src/profiling/ISendThread.hpp +++ b/src/profiling/ISendThread.hpp @@ -7,10 +7,10 @@ #include "IProfilingConnection.hpp" -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class ISendThread @@ -25,7 +25,7 @@ public: virtual void Stop(bool rethrowSendThreadExceptions = true) = 0; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/NullProfilingConnection.hpp b/src/profiling/NullProfilingConnection.hpp index a72d7bfb82..ef09794ec5 100644 --- a/src/profiling/NullProfilingConnection.hpp +++ b/src/profiling/NullProfilingConnection.hpp @@ -9,10 +9,10 @@ #include <armnn/utility/IgnoreUnused.hpp> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class NullProfilingConnection : public IProfilingConnection @@ -36,6 +36,6 @@ class NullProfilingConnection : public IProfilingConnection }; -} // namespace profiling +} // namespace pipe -} // namespace armnn
\ No newline at end of file +} // namespace arm
\ No newline at end of file diff --git a/src/profiling/PacketBuffer.cpp b/src/profiling/PacketBuffer.cpp index 6010493002..fa3e9582f4 100644 --- a/src/profiling/PacketBuffer.cpp +++ b/src/profiling/PacketBuffer.cpp @@ -7,10 +7,10 @@ #include <armnn/Exceptions.hpp> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { PacketBuffer::PacketBuffer(unsigned int maxSize) @@ -62,6 +62,6 @@ void PacketBuffer::Destroy() m_MaxSize = 0; } -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/PacketBuffer.hpp b/src/profiling/PacketBuffer.hpp index 02fe3b99d8..3fa5c608fe 100644 --- a/src/profiling/PacketBuffer.hpp +++ b/src/profiling/PacketBuffer.hpp @@ -9,10 +9,10 @@ #include <memory> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class PacketBuffer : public IPacketBuffer @@ -42,6 +42,6 @@ private: std::unique_ptr<unsigned char[]> m_Data; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/PerJobCounterSelectionCommandHandler.cpp b/src/profiling/PerJobCounterSelectionCommandHandler.cpp index 9e2f0626d3..c90b6c837c 100644 --- a/src/profiling/PerJobCounterSelectionCommandHandler.cpp +++ b/src/profiling/PerJobCounterSelectionCommandHandler.cpp @@ -8,10 +8,10 @@ #include <fmt/format.h> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { void PerJobCounterSelectionCommandHandler::operator()(const arm::pipe::Packet& packet) @@ -44,6 +44,6 @@ void PerJobCounterSelectionCommandHandler::operator()(const arm::pipe::Packet& p } } -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/PerJobCounterSelectionCommandHandler.hpp b/src/profiling/PerJobCounterSelectionCommandHandler.hpp index eef8421900..1d088e495f 100644 --- a/src/profiling/PerJobCounterSelectionCommandHandler.hpp +++ b/src/profiling/PerJobCounterSelectionCommandHandler.hpp @@ -10,10 +10,10 @@ #include <common/include/CommandHandlerFunctor.hpp> #include <common/include/Packet.hpp> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class PerJobCounterSelectionCommandHandler : public arm::pipe::CommandHandlerFunctor @@ -28,13 +28,13 @@ public: , m_StateMachine(profilingStateMachine) {} - void operator()(const arm::pipe::Packet& packet) override; + void operator()(const Packet& packet) override; private: const ProfilingStateMachine& m_StateMachine; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/PeriodicCounterCapture.cpp b/src/profiling/PeriodicCounterCapture.cpp index d914e85cfb..11ad6511fe 100644 --- a/src/profiling/PeriodicCounterCapture.cpp +++ b/src/profiling/PeriodicCounterCapture.cpp @@ -9,10 +9,10 @@ #include <iostream> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { void PeriodicCounterCapture::Start() @@ -105,7 +105,7 @@ void PeriodicCounterCapture::Capture(IReadCounterValues& readCounterValues) { counterValue = readCounterValues.GetDeltaCounterValue(requestedId); } - catch (const Exception& e) + catch (const armnn::Exception& e) { // Report the error and continue ARMNN_LOG(warning) << "An error has occurred when getting a counter value: " @@ -134,6 +134,6 @@ void PeriodicCounterCapture::Capture(IReadCounterValues& readCounterValues) while (m_KeepRunning.load()); } -} // namespace profiling +} // namespace pipe -} // namespace armnn
\ No newline at end of file +} // namespace arm
\ No newline at end of file diff --git a/src/profiling/PeriodicCounterCapture.hpp b/src/profiling/PeriodicCounterCapture.hpp index b7b1a20e1c..c442f425d4 100644 --- a/src/profiling/PeriodicCounterCapture.hpp +++ b/src/profiling/PeriodicCounterCapture.hpp @@ -19,10 +19,10 @@ #include <mutex> #include <thread> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class PeriodicCounterCapture final : public IPeriodicCounterCapture @@ -33,8 +33,7 @@ public: IReadCounterValues& readCounterValue, const ICounterMappings& counterIdMap, const std::unordered_map<armnn::BackendId, - std::shared_ptr<armnn::profiling::IBackendProfilingContext>>& - backendProfilingContexts) + std::shared_ptr<IBackendProfilingContext>>& backendProfilingContexts) : m_CaptureDataHolder(data) , m_IsRunning(false) , m_KeepRunning(false) @@ -63,9 +62,9 @@ private: ISendCounterPacket& m_SendCounterPacket; const ICounterMappings& m_CounterIdMap; const std::unordered_map<armnn::BackendId, - std::shared_ptr<armnn::profiling::IBackendProfilingContext>>& m_BackendProfilingContexts; + std::shared_ptr<IBackendProfilingContext>>& m_BackendProfilingContexts; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/PeriodicCounterSelectionCommandHandler.cpp b/src/profiling/PeriodicCounterSelectionCommandHandler.cpp index f94cb31f62..ae2aa0b94c 100644 --- a/src/profiling/PeriodicCounterSelectionCommandHandler.cpp +++ b/src/profiling/PeriodicCounterSelectionCommandHandler.cpp @@ -13,10 +13,10 @@ #include <vector> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { void PeriodicCounterSelectionCommandHandler::ParseData(const arm::pipe::Packet& packet, CaptureData& captureData) @@ -65,7 +65,7 @@ void PeriodicCounterSelectionCommandHandler::operator()(const arm::pipe::Packet& case ProfilingState::Uninitialised: case ProfilingState::NotConnected: case ProfilingState::WaitingForAck: - throw RuntimeException(fmt::format("Periodic Counter Selection Command Handler invoked while in " + throw armnn::RuntimeException(fmt::format("Periodic Counter Selection Command Handler invoked while in " "an wrong state: {}", GetProfilingStateName(currentState))); case ProfilingState::Active: @@ -161,7 +161,7 @@ void PeriodicCounterSelectionCommandHandler::operator()(const arm::pipe::Packet& break; } default: - throw RuntimeException(fmt::format("Unknown profiling service state: {}", + throw armnn::RuntimeException(fmt::format("Unknown profiling service state: {}", static_cast<int>(currentState))); } } @@ -228,6 +228,6 @@ std::set<armnn::BackendId> PeriodicCounterSelectionCommandHandler::ProcessBacken return activeBackends; } -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/PeriodicCounterSelectionCommandHandler.hpp b/src/profiling/PeriodicCounterSelectionCommandHandler.hpp index ec67391b9c..e8cdf0e5aa 100644 --- a/src/profiling/PeriodicCounterSelectionCommandHandler.hpp +++ b/src/profiling/PeriodicCounterSelectionCommandHandler.hpp @@ -21,10 +21,10 @@ #include <set> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { @@ -35,8 +35,8 @@ public: PeriodicCounterSelectionCommandHandler(uint32_t familyId, uint32_t packetId, uint32_t version, - const std::unordered_map<BackendId, - std::shared_ptr<armnn::profiling::IBackendProfilingContext>>& + const std::unordered_map<armnn::BackendId, + std::shared_ptr<IBackendProfilingContext>>& backendProfilingContexts, const ICounterMappings& counterIdMap, Holder& captureDataHolder, @@ -65,8 +65,8 @@ public: private: std::unordered_map<armnn::BackendId, std::vector<uint16_t>> m_BackendCounterMap; - const std::unordered_map<BackendId, - std::shared_ptr<armnn::profiling::IBackendProfilingContext>>& m_BackendProfilingContexts; + const std::unordered_map<armnn::BackendId, + std::shared_ptr<IBackendProfilingContext>>& m_BackendProfilingContexts; const ICounterMappings& m_CounterIdMap; Holder& m_CaptureDataHolder; const uint16_t m_MaxArmCounterId; @@ -81,7 +81,7 @@ private: const uint32_t capturePeriod, const std::vector<uint16_t> counterIds) { - Optional<std::string> errorMsg = + armnn::Optional<std::string> errorMsg = m_BackendProfilingContexts.at(backendId)->ActivateCounters(capturePeriod, counterIds); if(errorMsg.has_value()) @@ -97,7 +97,7 @@ private: }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/ProfilingConnectionDumpToFileDecorator.cpp b/src/profiling/ProfilingConnectionDumpToFileDecorator.cpp index f00d7fa965..fff26d435b 100644 --- a/src/profiling/ProfilingConnectionDumpToFileDecorator.cpp +++ b/src/profiling/ProfilingConnectionDumpToFileDecorator.cpp @@ -10,10 +10,10 @@ #include <fstream> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { ProfilingConnectionDumpToFileDecorator::ProfilingConnectionDumpToFileDecorator( @@ -154,9 +154,9 @@ bool ProfilingConnectionDumpToFileDecorator::DumpOutgoingToFile(const unsigned c void ProfilingConnectionDumpToFileDecorator::Fail(const std::string& errorMessage) { Close(); - throw RuntimeException(errorMessage); + throw armnn::RuntimeException(errorMessage); } -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/ProfilingConnectionDumpToFileDecorator.hpp b/src/profiling/ProfilingConnectionDumpToFileDecorator.hpp index bf79adc603..2cbd98f9d1 100644 --- a/src/profiling/ProfilingConnectionDumpToFileDecorator.hpp +++ b/src/profiling/ProfilingConnectionDumpToFileDecorator.hpp @@ -16,10 +16,10 @@ #include <string> #include <vector> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class ProfilingConnectionDumpToFileDecorator : public IProfilingConnection @@ -58,6 +58,6 @@ private: bool m_IgnoreFileErrors; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/ProfilingConnectionFactory.cpp b/src/profiling/ProfilingConnectionFactory.cpp index fe42de493b..93ecff2e99 100644 --- a/src/profiling/ProfilingConnectionFactory.cpp +++ b/src/profiling/ProfilingConnectionFactory.cpp @@ -9,10 +9,10 @@ #include "ProfilingConnectionDumpToFileDecorator.hpp" #include "SocketProfilingConnection.hpp" -namespace armnn +namespace arm { -namespace profiling +namespace pipe { std::unique_ptr<IProfilingConnection> ProfilingConnectionFactory::GetProfilingConnection( @@ -56,6 +56,6 @@ std::unique_ptr<IProfilingConnection> ProfilingConnectionFactory::GetProfilingCo } } -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/ProfilingConnectionFactory.hpp b/src/profiling/ProfilingConnectionFactory.hpp index f767ed07c2..441a31a0b8 100644 --- a/src/profiling/ProfilingConnectionFactory.hpp +++ b/src/profiling/ProfilingConnectionFactory.hpp @@ -7,10 +7,10 @@ #include "IProfilingConnectionFactory.hpp" -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class ProfilingConnectionFactory final : public IProfilingConnectionFactory @@ -22,6 +22,6 @@ public: IProfilingConnectionPtr GetProfilingConnection(const ProfilingOptions& options) const override; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/ProfilingService.cpp b/src/profiling/ProfilingService.cpp index c7ebee2ccf..cef8a6d9ea 100644 --- a/src/profiling/ProfilingService.cpp +++ b/src/profiling/ProfilingService.cpp @@ -15,10 +15,10 @@ #include <fmt/format.h> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { ProfilingGuidGenerator ProfilingService::m_GuidGenerator; @@ -38,7 +38,7 @@ void ProfilingService::ResetGuidGenerator() m_GuidGenerator.Reset(); } -void ProfilingService::ResetExternalProfilingOptions(const armnn::profiling::ProfilingOptions& options, +void ProfilingService::ResetExternalProfilingOptions(const arm::pipe::ProfilingOptions& options, bool resetProfilingService) { // Update the profiling options @@ -60,7 +60,7 @@ bool ProfilingService::IsProfilingEnabled() const } ProfilingState ProfilingService::ConfigureProfilingService( - const armnn::profiling::ProfilingOptions& options, + const ProfilingOptions& options, bool resetProfilingService) { ResetExternalProfilingOptions(options, resetProfilingService); @@ -147,7 +147,7 @@ void ProfilingService::Update() ARMNN_ASSERT(m_ProfilingConnectionFactory); m_ProfilingConnection = m_ProfilingConnectionFactory->GetProfilingConnection(m_Options); } - catch (const Exception& e) + catch (const armnn::Exception& e) { ARMNN_LOG(warning) << "An error has occurred when creating the profiling connection: " << e.what(); @@ -185,7 +185,7 @@ void ProfilingService::Update() break; default: - throw RuntimeException(fmt::format("Unknown profiling service state: {}", + throw armnn::RuntimeException(fmt::format("Unknown profiling service state: {}", static_cast<int>(currentState))); } } @@ -205,14 +205,14 @@ void ProfilingService::Disconnect() break; default: - throw RuntimeException(fmt::format("Unknown profiling service state: {}", - static_cast<int>(currentState))); + throw armnn::RuntimeException(fmt::format("Unknown profiling service state: {}", + static_cast<int>(currentState))); } } // Store a profiling context returned from a backend that support profiling, and register its counters -void ProfilingService::AddBackendProfilingContext(const BackendId backendId, - std::shared_ptr<armnn::profiling::IBackendProfilingContext> profilingContext) +void ProfilingService::AddBackendProfilingContext(const armnn::BackendId backendId, + std::shared_ptr<IBackendProfilingContext> profilingContext) { ARMNN_ASSERT(profilingContext != nullptr); // Register the backend counters @@ -279,7 +279,7 @@ CaptureData ProfilingService::GetCaptureData() void ProfilingService::SetCaptureData(uint32_t capturePeriod, const std::vector<uint16_t>& counterIds, - const std::set<BackendId>& activeBackends) + const std::set<armnn::BackendId>& activeBackends) { m_Holder.SetCaptureData(capturePeriod, counterIds, activeBackends); } @@ -344,7 +344,7 @@ void ProfilingService::Initialize() { const Counter* loadedNetworksCounter = m_CounterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - armnn::profiling::NETWORK_LOADS, + NETWORK_LOADS, "ArmNN_Runtime", 0, 0, @@ -360,7 +360,7 @@ void ProfilingService::Initialize() { const Counter* unloadedNetworksCounter = m_CounterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - armnn::profiling::NETWORK_UNLOADS, + NETWORK_UNLOADS, "ArmNN_Runtime", 0, 0, @@ -376,7 +376,7 @@ void ProfilingService::Initialize() { const Counter* registeredBackendsCounter = m_CounterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - armnn::profiling::REGISTERED_BACKENDS, + REGISTERED_BACKENDS, "ArmNN_Runtime", 0, 0, @@ -389,14 +389,14 @@ void ProfilingService::Initialize() // Due to backends being registered before the profiling service becomes active, // we need to set the counter to the correct value here - SetCounterValue(armnn::profiling::REGISTERED_BACKENDS, static_cast<uint32_t>(BackendRegistryInstance().Size())); + SetCounterValue(REGISTERED_BACKENDS, static_cast<uint32_t>(armnn::BackendRegistryInstance().Size())); } // Register a counter for the number of registered backends if (!m_CounterDirectory.IsCounterRegistered("Backends unregistered")) { const Counter* unregisteredBackendsCounter = m_CounterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - armnn::profiling::UNREGISTERED_BACKENDS, + UNREGISTERED_BACKENDS, "ArmNN_Runtime", 0, 0, @@ -412,7 +412,7 @@ void ProfilingService::Initialize() { const Counter* inferencesRunCounter = m_CounterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - armnn::profiling::INFERENCES_RUN, + INFERENCES_RUN, "ArmNN_Runtime", 0, 0, @@ -456,7 +456,7 @@ void ProfilingService::Reset() // ...finally reset the profiling state machine m_StateMachine.Reset(); m_BackendProfilingContexts.clear(); - m_MaxGlobalCounterId = armnn::profiling::MAX_ARMNN_COUNTER; + m_MaxGlobalCounterId = MAX_ARMNN_COUNTER; } void ProfilingService::Stop() @@ -541,6 +541,6 @@ ProfilingService::~ProfilingService() { Stop(); } -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/ProfilingService.hpp b/src/profiling/ProfilingService.hpp index af480f3c5e..ab71b0c768 100644 --- a/src/profiling/ProfilingService.hpp +++ b/src/profiling/ProfilingService.hpp @@ -35,10 +35,10 @@ #include <list> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { // Static constants describing ArmNN's counter UID's static const uint16_t NETWORK_LOADS = 0; @@ -55,10 +55,10 @@ public: using IProfilingConnectionPtr = std::unique_ptr<IProfilingConnection>; using CounterIndices = std::vector<std::atomic<uint32_t>*>; using CounterValues = std::list<std::atomic<uint32_t>>; - using BackendProfilingContext = std::unordered_map<BackendId, - std::shared_ptr<armnn::profiling::IBackendProfilingContext>>; + using BackendProfilingContext = std::unordered_map<armnn::BackendId, + std::shared_ptr<IBackendProfilingContext>>; - ProfilingService(Optional<IReportStructure&> reportStructure = EmptyOptional()) + ProfilingService(armnn::Optional<IReportStructure&> reportStructure = armnn::EmptyOptional()) : m_Options() , m_TimelineReporting(false) , m_CounterDirectory() @@ -126,7 +126,7 @@ public: m_StateMachine, *this) , m_TimelinePacketWriterFactory(m_BufferManager) - , m_MaxGlobalCounterId(armnn::profiling::INFERENCES_RUN) + , m_MaxGlobalCounterId(INFERENCES_RUN) , m_ServiceActive(false) { // Register the "Connection Acknowledged" command handler @@ -149,9 +149,9 @@ public: ~ProfilingService(); // Resets the profiling options, optionally clears the profiling service entirely - void ResetExternalProfilingOptions(const armnn::profiling::ProfilingOptions& options, + void ResetExternalProfilingOptions(const ProfilingOptions& options, bool resetProfilingService = false); - ProfilingState ConfigureProfilingService(const armnn::profiling::ProfilingOptions& options, + ProfilingState ConfigureProfilingService(const ProfilingOptions& options, bool resetProfilingService = false); @@ -162,8 +162,8 @@ public: void Disconnect(); // Store a profiling context returned from a backend that support profiling. - void AddBackendProfilingContext(const BackendId backendId, - std::shared_ptr<armnn::profiling::IBackendProfilingContext> profilingContext); + void AddBackendProfilingContext(const armnn::BackendId backendId, + std::shared_ptr<IBackendProfilingContext> profilingContext); // Enable the recording of timeline events and entities void NotifyBackendsForTimelineReporting() override; @@ -185,7 +185,7 @@ public: CaptureData GetCaptureData() override; void SetCaptureData(uint32_t capturePeriod, const std::vector<uint16_t>& counterIds, - const std::set<BackendId>& activeBackends); + const std::set<armnn::BackendId>& activeBackends); // Setters for the profiling service state void SetCounterValue(uint16_t counterUid, uint32_t value) override; @@ -311,6 +311,6 @@ protected: } }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/ProfilingStateMachine.cpp b/src/profiling/ProfilingStateMachine.cpp index 58fac969ab..a53b978b63 100644 --- a/src/profiling/ProfilingStateMachine.cpp +++ b/src/profiling/ProfilingStateMachine.cpp @@ -9,10 +9,10 @@ #include <sstream> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { namespace @@ -90,6 +90,6 @@ void ProfilingStateMachine::Reset() m_State.store(ProfilingState::Uninitialised); } -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/ProfilingStateMachine.hpp b/src/profiling/ProfilingStateMachine.hpp index cbc65ec8b0..2980556ca8 100644 --- a/src/profiling/ProfilingStateMachine.hpp +++ b/src/profiling/ProfilingStateMachine.hpp @@ -9,10 +9,10 @@ #include <armnn/utility/IgnoreUnused.hpp> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { enum class ProfilingState @@ -35,7 +35,7 @@ public: bool IsOneOfStates(ProfilingState state1) { - IgnoreUnused(state1); + armnn::IgnoreUnused(state1); return false; } @@ -68,7 +68,7 @@ constexpr char const* GetProfilingStateName(ProfilingState state) } } -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/ProfilingUtils.cpp b/src/profiling/ProfilingUtils.cpp index f00f15667b..36578684ca 100644 --- a/src/profiling/ProfilingUtils.cpp +++ b/src/profiling/ProfilingUtils.cpp @@ -19,10 +19,10 @@ #include <iostream> #include <limits> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { namespace @@ -39,7 +39,7 @@ void ThrowIfCantGenerateNextUid(uint16_t uid, uint16_t cores = 0) // running multiple parallel workloads and will not provide multiple streams of data for each event) if (uid == std::numeric_limits<uint16_t>::max()) { - throw RuntimeException("Generating the next UID for profiling would result in an overflow"); + throw armnn::RuntimeException("Generating the next UID for profiling would result in an overflow"); } break; default: // cores > 1 @@ -47,7 +47,7 @@ void ThrowIfCantGenerateNextUid(uint16_t uid, uint16_t cores = 0) // allowed value for a counter UID is consequently: uint16_t_max - cores + 1 if (uid >= std::numeric_limits<uint16_t>::max() - cores + 1) { - throw RuntimeException("Generating the next UID for profiling would result in an overflow"); + throw armnn::RuntimeException("Generating the next UID for profiling would result in an overflow"); } break; } @@ -139,31 +139,6 @@ void WriteUint8(const IPacketBufferPtr& packetBuffer, unsigned int offset, uint8 WriteUint8(packetBuffer->GetWritableData(), offset, value); } -void WriteBytes(unsigned char* buffer, unsigned int offset, const void* value, unsigned int valueSize) -{ - arm::pipe::WriteBytes(buffer, offset, value, valueSize); -} - -void WriteUint64(unsigned char* buffer, unsigned int offset, uint64_t value) -{ - arm::pipe::WriteUint64(buffer, offset, value); -} - -void WriteUint32(unsigned char* buffer, unsigned int offset, uint32_t value) -{ - arm::pipe::WriteUint32(buffer, offset, value); -} - -void WriteUint16(unsigned char* buffer, unsigned int offset, uint16_t value) -{ - arm::pipe::WriteUint16(buffer, offset, value); -} - -void WriteUint8(unsigned char* buffer, unsigned int offset, uint8_t value) -{ - arm::pipe::WriteUint8(buffer, offset, value); -} - void ReadBytes(const IPacketBufferPtr& packetBuffer, unsigned int offset, unsigned int valueSize, uint8_t outValue[]) { ARMNN_ASSERT(packetBuffer); @@ -199,31 +174,6 @@ uint8_t ReadUint8(const IPacketBufferPtr& packetBuffer, unsigned int offset) return ReadUint8(packetBuffer->GetReadableData(), offset); } -void ReadBytes(const unsigned char* buffer, unsigned int offset, unsigned int valueSize, uint8_t outValue[]) -{ - arm::pipe::ReadBytes(buffer, offset, valueSize, outValue); -} - -uint64_t ReadUint64(const unsigned char* buffer, unsigned int offset) -{ - return arm::pipe::ReadUint64(buffer, offset); -} - -uint32_t ReadUint32(const unsigned char* buffer, unsigned int offset) -{ - return arm::pipe::ReadUint32(buffer, offset); -} - -uint16_t ReadUint16(const unsigned char* buffer, unsigned int offset) -{ - return arm::pipe::ReadUint16(buffer, offset); -} - -uint8_t ReadUint8(const unsigned char* buffer, unsigned int offset) -{ - return arm::pipe::ReadUint8(buffer, offset); -} - std::string GetSoftwareInfo() { return std::string("ArmNN"); @@ -724,11 +674,6 @@ TimelinePacketStatus WriteTimelineEventBinary(uint64_t timestamp, return TimelinePacketStatus::Ok; } -std::string CentreAlignFormatting(const std::string& stringToPass, const int spacingWidth) -{ - return arm::pipe::CentreAlignFormatting(stringToPass, spacingWidth); -} - void PrintDeviceDetails(const std::pair<const unsigned short, std::unique_ptr<Device>>& devicePair) { std::string body; @@ -904,7 +849,7 @@ void PrintCounterDirectory(ICounterDirectory& counterDirectory) uint64_t GetTimestamp() { #if USE_CLOCK_MONOTONIC_RAW - using clock = MonotonicClockRaw; + using clock = armnn::MonotonicClockRaw; #else using clock = std::chrono::steady_clock; #endif @@ -942,9 +887,9 @@ arm::pipe::Packet ReceivePacket(const unsigned char* buffer, uint32_t length) return arm::pipe::Packet(metadataIdentifier, dataLength, packetData); } -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm namespace std { diff --git a/src/profiling/ProfilingUtils.hpp b/src/profiling/ProfilingUtils.hpp index b9c8327b0d..e37e109094 100644 --- a/src/profiling/ProfilingUtils.hpp +++ b/src/profiling/ProfilingUtils.hpp @@ -22,10 +22,10 @@ #include <thread> #include <vector> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { constexpr unsigned int ThreadIdSize = sizeof(int); // Is platform dependent @@ -150,9 +150,9 @@ uint64_t GetTimestamp(); arm::pipe::Packet ReceivePacket(const unsigned char* buffer, uint32_t length); -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm namespace std { diff --git a/src/profiling/RegisterBackendCounters.cpp b/src/profiling/RegisterBackendCounters.cpp index 035a2ca8a9..dcafe3b226 100644 --- a/src/profiling/RegisterBackendCounters.cpp +++ b/src/profiling/RegisterBackendCounters.cpp @@ -5,10 +5,10 @@ #include "RegisterBackendCounters.hpp" -namespace armnn +namespace arm { -namespace profiling +namespace pipe { void RegisterBackendCounters::RegisterCategory(const std::string& categoryName) @@ -18,7 +18,7 @@ void RegisterBackendCounters::RegisterCategory(const std::string& categoryName) uint16_t RegisterBackendCounters::RegisterDevice(const std::string& deviceName, uint16_t cores, - const Optional<std::string>& parentCategoryName) + const armnn::Optional<std::string>& 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 Optional<std::string>& parentCategoryName) + const armnn::Optional<std::string>& 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 Optional<std::string>& units, - const Optional<uint16_t>& numberOfCores, - const Optional<uint16_t>& deviceUid, - const Optional<uint16_t>& counterSetUid) + const armnn::Optional<std::string>& units, + const armnn::Optional<uint16_t>& numberOfCores, + const armnn::Optional<uint16_t>& deviceUid, + const armnn::Optional<uint16_t>& counterSetUid) { ++m_CurrentMaxGlobalCounterID; const Counter* counterPtr = m_CounterDirectory.RegisterCounter(m_BackendId, @@ -80,6 +80,6 @@ uint16_t RegisterBackendCounters::RegisterCounter(const uint16_t uid, return m_CurrentMaxGlobalCounterID; } -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/RegisterBackendCounters.hpp b/src/profiling/RegisterBackendCounters.hpp index f81f487472..f25feb5306 100644 --- a/src/profiling/RegisterBackendCounters.hpp +++ b/src/profiling/RegisterBackendCounters.hpp @@ -10,10 +10,10 @@ #include "CounterDirectory.hpp" #include "ProfilingService.hpp" -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class RegisterBackendCounters : public IRegisterBackendCounters @@ -21,7 +21,7 @@ class RegisterBackendCounters : public IRegisterBackendCounters public: RegisterBackendCounters( - uint16_t currentMaxGlobalCounterID, const BackendId& backendId, ProfilingService& profilingService) + uint16_t currentMaxGlobalCounterID, const armnn::BackendId& backendId, ProfilingService& profilingService) : m_CurrentMaxGlobalCounterID(currentMaxGlobalCounterID), m_BackendId(backendId), m_ProfilingService(profilingService), @@ -33,11 +33,12 @@ public: uint16_t RegisterDevice(const std::string& deviceName, uint16_t cores = 0, - const Optional<std::string>& parentCategoryName = EmptyOptional()) override; + const armnn::Optional<std::string>& parentCategoryName = armnn::EmptyOptional()) override; uint16_t RegisterCounterSet(const std::string& counterSetName, uint16_t count = 0, - const Optional<std::string>& parentCategoryName = EmptyOptional()) override; + const armnn::Optional<std::string>& parentCategoryName + = armnn::EmptyOptional()) override; uint16_t RegisterCounter(const uint16_t uid, const std::string& parentCategoryName, @@ -46,18 +47,18 @@ public: double multiplier, const std::string& name, const std::string& description, - const Optional<std::string>& units = EmptyOptional(), - const Optional<uint16_t>& numberOfCores = EmptyOptional(), - const Optional<uint16_t>& deviceUid = EmptyOptional(), - const Optional<uint16_t>& counterSetUid = EmptyOptional()) override; + const armnn::Optional<std::string>& units = armnn::EmptyOptional(), + const armnn::Optional<uint16_t>& numberOfCores = armnn::EmptyOptional(), + const armnn::Optional<uint16_t>& deviceUid = armnn::EmptyOptional(), + const armnn::Optional<uint16_t>& counterSetUid = armnn::EmptyOptional()) override; private: uint16_t m_CurrentMaxGlobalCounterID; - const BackendId& m_BackendId; + const armnn::BackendId& m_BackendId; ProfilingService& m_ProfilingService; ICounterRegistry& m_CounterDirectory; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn
\ No newline at end of file +} // namespace arm
\ No newline at end of file diff --git a/src/profiling/RequestCounterDirectoryCommandHandler.cpp b/src/profiling/RequestCounterDirectoryCommandHandler.cpp index f86470b77d..601f8541ff 100644 --- a/src/profiling/RequestCounterDirectoryCommandHandler.cpp +++ b/src/profiling/RequestCounterDirectoryCommandHandler.cpp @@ -7,10 +7,10 @@ #include <fmt/format.h> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { void RequestCounterDirectoryCommandHandler::operator()(const arm::pipe::Packet& packet) @@ -21,7 +21,7 @@ void RequestCounterDirectoryCommandHandler::operator()(const arm::pipe::Packet& case ProfilingState::Uninitialised: case ProfilingState::NotConnected: case ProfilingState::WaitingForAck: - throw RuntimeException(fmt::format("Request Counter Directory Comand Handler invoked while in an " + throw armnn::RuntimeException(fmt::format("Request Counter Directory Comand Handler invoked while in an " "wrong state: {}", GetProfilingStateName(currentState))); case ProfilingState::Active: @@ -40,11 +40,11 @@ void RequestCounterDirectoryCommandHandler::operator()(const arm::pipe::Packet& break; default: - throw RuntimeException(fmt::format("Unknown profiling service state: {}", + throw armnn::RuntimeException(fmt::format("Unknown profiling service state: {}", static_cast<int>(currentState))); } } -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/RequestCounterDirectoryCommandHandler.hpp b/src/profiling/RequestCounterDirectoryCommandHandler.hpp index 18577b2851..ee2874dfda 100644 --- a/src/profiling/RequestCounterDirectoryCommandHandler.hpp +++ b/src/profiling/RequestCounterDirectoryCommandHandler.hpp @@ -12,10 +12,10 @@ #include <common/include/CommandHandlerFunctor.hpp> #include <common/include/Packet.hpp> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class RequestCounterDirectoryCommandHandler : public arm::pipe::CommandHandlerFunctor @@ -45,6 +45,6 @@ private: const ProfilingStateMachine& m_StateMachine; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/SendCounterPacket.cpp b/src/profiling/SendCounterPacket.cpp index b0bfeb5677..38417e8ecd 100644 --- a/src/profiling/SendCounterPacket.cpp +++ b/src/profiling/SendCounterPacket.cpp @@ -18,10 +18,10 @@ #include <cstring> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { void SendCounterPacket::SendStreamMetaDataPacket() @@ -164,7 +164,7 @@ void SendCounterPacket::SendStreamMetaDataPacket() } catch(...) { - CancelOperationAndThrow<RuntimeException>(writeBuffer, "Error processing packet."); + CancelOperationAndThrow<armnn::RuntimeException>(writeBuffer, "Error processing packet."); } m_BufferManager.Commit(writeBuffer, totalSize, false); @@ -584,7 +584,7 @@ void SendCounterPacket::SendCounterDirectoryPacket(const ICounterDirectory& coun std::string errorMessage; if (!CreateDeviceRecord(device, deviceRecord, errorMessage)) { - CancelOperationAndThrow<RuntimeException>(errorMessage); + CancelOperationAndThrow<armnn::RuntimeException>(errorMessage); } // Update the total size in words of the device records @@ -619,7 +619,7 @@ void SendCounterPacket::SendCounterDirectoryPacket(const ICounterDirectory& coun std::string errorMessage; if (!CreateCounterSetRecord(counterSet, counterSetRecord, errorMessage)) { - CancelOperationAndThrow<RuntimeException>(errorMessage); + CancelOperationAndThrow<armnn::RuntimeException>(errorMessage); } // Update the total size in words of the counter set records @@ -654,7 +654,7 @@ void SendCounterPacket::SendCounterDirectoryPacket(const ICounterDirectory& coun std::string errorMessage; if (!CreateCategoryRecord(category, counterDirectory.GetCounters(), categoryRecord, errorMessage)) { - CancelOperationAndThrow<RuntimeException>(errorMessage); + CancelOperationAndThrow<armnn::RuntimeException>(errorMessage); } // Update the total size in words of the category records @@ -918,6 +918,6 @@ void SendCounterPacket::SendPeriodicCounterSelectionPacket(uint32_t capturePerio m_BufferManager.Commit(writeBuffer, totalSize); } -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/SendCounterPacket.hpp b/src/profiling/SendCounterPacket.hpp index ddf8b2424d..db893c026a 100644 --- a/src/profiling/SendCounterPacket.hpp +++ b/src/profiling/SendCounterPacket.hpp @@ -12,10 +12,10 @@ #include <type_traits> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class SendCounterPacket : public ISendCounterPacket @@ -51,7 +51,7 @@ private: template <typename ExceptionType> void CancelOperationAndThrow(IPacketBufferPtr& writerBuffer, const std::string& errorMessage) { - if (std::is_same<ExceptionType, armnn::profiling::BufferExhaustion>::value) + if (std::is_same<ExceptionType, BufferExhaustion>::value) { m_BufferManager.FlushReadList(); } @@ -85,6 +85,6 @@ protected: std::string& errorMessage); }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/SendThread.cpp b/src/profiling/SendThread.cpp index 1a0e35976e..41385c5cc8 100644 --- a/src/profiling/SendThread.cpp +++ b/src/profiling/SendThread.cpp @@ -14,15 +14,15 @@ #include <cstring> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { -SendThread::SendThread(armnn::profiling::ProfilingStateMachine& profilingStateMachine, - armnn::profiling::IBufferManager& buffer, - armnn::profiling::ISendCounterPacket& sendCounterPacket, +SendThread::SendThread(ProfilingStateMachine& profilingStateMachine, + IBufferManager& buffer, + ISendCounterPacket& sendCounterPacket, int timeout) : m_StateMachine(profilingStateMachine) , m_BufferManager(buffer) @@ -128,7 +128,7 @@ void SendThread::Send(IProfilingConnection& profilingConnection) // An exception should be thrown here, save it to be rethrown later from the main thread so that // it can be caught by the consumer m_SendThreadException = - std::make_exception_ptr(RuntimeException("The send thread should not be running with the " + std::make_exception_ptr(armnn::RuntimeException("The send thread should not be running with the " "profiling service not yet initialized or connected")); return; @@ -270,6 +270,6 @@ bool SendThread::WaitForPacketSent(uint32_t timeout = 1000) return timedOut; } -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/SendThread.hpp b/src/profiling/SendThread.hpp index af1a72bce5..6512c8aac6 100644 --- a/src/profiling/SendThread.hpp +++ b/src/profiling/SendThread.hpp @@ -20,10 +20,10 @@ #include <thread> #include <type_traits> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class SendThread : public ISendThread, public IConsumer @@ -70,6 +70,6 @@ private: }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/SendTimelinePacket.cpp b/src/profiling/SendTimelinePacket.cpp index 11e3d2f489..e44e5aa37c 100644 --- a/src/profiling/SendTimelinePacket.cpp +++ b/src/profiling/SendTimelinePacket.cpp @@ -5,10 +5,10 @@ #include "SendTimelinePacket.hpp" -namespace armnn +namespace arm { -namespace profiling +namespace pipe { void SendTimelinePacket::Commit() @@ -142,9 +142,9 @@ void SendTimelinePacket::SendTimelineMessageDirectoryPackage() TimelinePacketStatus result = WriteTimelineMessageDirectoryPackage(&m_WriteBuffer->GetWritableData()[m_Offset], m_RemainingBufferSize, numberOfBytesWritten); - if (result != armnn::profiling::TimelinePacketStatus::Ok) + if (result != TimelinePacketStatus::Ok) { - throw RuntimeException("Error processing TimelineMessageDirectoryPackage", CHECK_LOCATION()); + throw armnn::RuntimeException("Error processing TimelineMessageDirectoryPackage", CHECK_LOCATION()); } // Commit the message @@ -154,10 +154,10 @@ void SendTimelinePacket::SendTimelineMessageDirectoryPackage() } catch (...) { - throw RuntimeException("Error processing TimelineMessageDirectoryPackage", CHECK_LOCATION()); + throw armnn::RuntimeException("Error processing TimelineMessageDirectoryPackage", CHECK_LOCATION()); } } -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/SendTimelinePacket.hpp b/src/profiling/SendTimelinePacket.hpp index fc9cf6fd25..f915dafea7 100644 --- a/src/profiling/SendTimelinePacket.hpp +++ b/src/profiling/SendTimelinePacket.hpp @@ -13,10 +13,10 @@ #include <memory> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class SendTimelinePacket : public ISendTimelinePacket @@ -97,7 +97,8 @@ void SendTimelinePacket::ForwardWriteBinaryFunction(Func& func, Params&& ... par continue; case TimelinePacketStatus::Error: - throw RuntimeException("Error processing while sending TimelineBinaryPacket", CHECK_LOCATION()); + throw armnn::RuntimeException("Error processing while sending TimelineBinaryPacket", CHECK_LOCATION + ()); default: m_Offset += numberOfBytesWritten; @@ -106,7 +107,7 @@ void SendTimelinePacket::ForwardWriteBinaryFunction(Func& func, Params&& ... par } } } - catch (const RuntimeException& ex) + catch (const armnn::RuntimeException& ex) { // don't swallow in the catch all block throw ex; @@ -116,16 +117,16 @@ void SendTimelinePacket::ForwardWriteBinaryFunction(Func& func, Params&& ... par // ditto throw ex; } - catch (const Exception& ex) + catch (const armnn::Exception& ex) { throw ex; } catch ( ... ) { - throw RuntimeException("Unknown Exception thrown while sending TimelineBinaryPacket", CHECK_LOCATION()); + throw armnn::RuntimeException("Unknown Exception thrown while sending TimelineBinaryPacket", CHECK_LOCATION()); } } -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/SocketProfilingConnection.cpp b/src/profiling/SocketProfilingConnection.cpp index 9de425b62c..4787136685 100644 --- a/src/profiling/SocketProfilingConnection.cpp +++ b/src/profiling/SocketProfilingConnection.cpp @@ -12,9 +12,9 @@ #include <string> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { SocketProfilingConnection::SocketProfilingConnection() @@ -220,5 +220,5 @@ arm::pipe::Packet SocketProfilingConnection::ReceivePacket() return arm::pipe::Packet(metadataIdentifier, dataLength, packetData); } -} // namespace profiling -} // namespace armnn +} // namespace pipe +} // namespace arm diff --git a/src/profiling/SocketProfilingConnection.hpp b/src/profiling/SocketProfilingConnection.hpp index 8d9cb20935..31b17aa8fe 100644 --- a/src/profiling/SocketProfilingConnection.hpp +++ b/src/profiling/SocketProfilingConnection.hpp @@ -10,9 +10,9 @@ #pragma once -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class SocketProfilingConnection : public IProfilingConnection @@ -39,5 +39,5 @@ private: arm::pipe::PollFd m_Socket[1]{}; }; -} // namespace profiling -} // namespace armnn +} // namespace pipe +} // namespace arm diff --git a/src/profiling/TimelinePacketWriterFactory.cpp b/src/profiling/TimelinePacketWriterFactory.cpp index b1de629fae..78eda79ef0 100644 --- a/src/profiling/TimelinePacketWriterFactory.cpp +++ b/src/profiling/TimelinePacketWriterFactory.cpp @@ -7,10 +7,10 @@ #include "SendTimelinePacket.hpp" -namespace armnn +namespace arm { -namespace profiling +namespace pipe { std::unique_ptr<ISendTimelinePacket> TimelinePacketWriterFactory::GetSendTimelinePacket() const @@ -18,6 +18,6 @@ std::unique_ptr<ISendTimelinePacket> TimelinePacketWriterFactory::GetSendTimelin return std::make_unique<SendTimelinePacket>(m_BufferManager); } -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/TimelinePacketWriterFactory.hpp b/src/profiling/TimelinePacketWriterFactory.hpp index a1e9945303..00550ee381 100644 --- a/src/profiling/TimelinePacketWriterFactory.hpp +++ b/src/profiling/TimelinePacketWriterFactory.hpp @@ -10,10 +10,10 @@ #include <memory> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class TimelinePacketWriterFactory @@ -27,6 +27,6 @@ private: IBufferManager& m_BufferManager; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/TimelineUtilityMethods.cpp b/src/profiling/TimelineUtilityMethods.cpp index 7f8c25d066..bc8e7b6ce8 100644 --- a/src/profiling/TimelineUtilityMethods.cpp +++ b/src/profiling/TimelineUtilityMethods.cpp @@ -9,10 +9,10 @@ #include <armnnUtils/Threads.hpp> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { std::unique_ptr<TimelineUtilityMethods> TimelineUtilityMethods::GetTimelineUtils(ProfilingService& profilingService) @@ -114,7 +114,7 @@ ProfilingDynamicGuid TimelineUtilityMethods::CreateNamedTypedEntity(const std::s } // Generate dynamic GUID of the entity - ProfilingDynamicGuid entityGuid = profiling::ProfilingService::GetNextGuid(); + ProfilingDynamicGuid entityGuid = ProfilingService::GetNextGuid(); CreateNamedTypedEntity(entityGuid, name, type); @@ -177,7 +177,7 @@ ProfilingStaticGuid TimelineUtilityMethods::DeclareLabel(const std::string& labe } // Generate a static GUID for the given label name - ProfilingStaticGuid labelGuid = profiling::ProfilingService::GetStaticId(labelName); + ProfilingStaticGuid labelGuid = ProfilingService::GetStaticId(labelName); // Send the new label to the external profiling service, this call throws in case of error m_SendTimelinePacket->SendTimelineLabelBinaryPacket(labelGuid, labelName); @@ -200,7 +200,7 @@ void TimelineUtilityMethods::MarkEntityWithLabel(ProfilingGuid entityGuid, ProfilingStaticGuid labelGuid = DeclareLabel(labelName); // Generate a GUID for the label relationship - ProfilingDynamicGuid relationshipGuid = profiling::ProfilingService::GetNextGuid(); + ProfilingDynamicGuid relationshipGuid = ProfilingService::GetNextGuid(); // Send the new label link to the external profiling service, this call throws in case of error m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink, @@ -214,7 +214,7 @@ void TimelineUtilityMethods::MarkEntityWithType(ProfilingGuid entityGuid, ProfilingStaticGuid typeNameGuid) { // Generate a GUID for the label relationship - ProfilingDynamicGuid relationshipGuid = profiling::ProfilingService::GetNextGuid(); + ProfilingDynamicGuid relationshipGuid = ProfilingService::GetNextGuid(); // Send the new label link to the external profiling service, this call throws in case of error m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink, @@ -256,7 +256,7 @@ ProfilingDynamicGuid TimelineUtilityMethods::CreateNamedTypedChildEntity(Profili ProfilingDynamicGuid childEntityGuid = CreateNamedTypedEntity(entityName, entityType); // Generate a GUID for the retention link relationship - ProfilingDynamicGuid retentionLinkGuid = profiling::ProfilingService::GetNextGuid(); + ProfilingDynamicGuid retentionLinkGuid = ProfilingService::GetNextGuid(); // Send the new retention link to the external profiling service, this call throws in case of error m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink, @@ -291,7 +291,7 @@ void TimelineUtilityMethods::CreateNamedTypedChildEntity(ProfilingGuid childEnti CreateNamedTypedEntity(childEntityGuid, entityName, entityType); // Generate a GUID for the retention link relationship - ProfilingDynamicGuid retentionLinkGuid = profiling::ProfilingService::GetNextGuid(); + ProfilingDynamicGuid retentionLinkGuid = ProfilingService::GetNextGuid(); // Send the new retention link to the external profiling service, this call throws in case of error m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink, @@ -317,7 +317,7 @@ void TimelineUtilityMethods::CreateNamedTypedChildEntity(ProfilingGuid childEnti CreateNamedTypedEntity(childEntityGuid, entityName, typeGuid); // Generate a GUID for the retention link relationship - ProfilingDynamicGuid retentionLinkGuid = profiling::ProfilingService::GetNextGuid(); + ProfilingDynamicGuid retentionLinkGuid = ProfilingService::GetNextGuid(); // Send the new retention link to the external profiling service, this call throws in case of error m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink, @@ -333,7 +333,7 @@ ProfilingDynamicGuid TimelineUtilityMethods::CreateRelationship(ProfilingRelatio ProfilingGuid relationshipCategory) { // Generate a GUID for the relationship - ProfilingDynamicGuid relationshipGuid = profiling::ProfilingService::GetNextGuid(); + ProfilingDynamicGuid relationshipGuid = ProfilingService::GetNextGuid(); // Send the new retention link to the external profiling service, this call throws in case of error m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(relationshipType, @@ -349,7 +349,7 @@ ProfilingDynamicGuid TimelineUtilityMethods::CreateConnectionRelationship(Profil ProfilingGuid tailGuid) { // Generate a GUID for the relationship - ProfilingDynamicGuid relationshipGuid = profiling::ProfilingService::GetNextGuid(); + ProfilingDynamicGuid relationshipGuid = ProfilingService::GetNextGuid(); // Send the new retention link to the external profiling service, this call throws in case of error m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(relationshipType, @@ -378,13 +378,13 @@ ProfilingDynamicGuid TimelineUtilityMethods::RecordEvent(ProfilingGuid entityGui int threadId = armnnUtils::Threads::GetCurrentThreadId(); // Generate a GUID for the event - ProfilingDynamicGuid eventGuid = profiling::ProfilingService::GetNextGuid(); + ProfilingDynamicGuid eventGuid = ProfilingService::GetNextGuid(); // Send the new timeline event to the external profiling service, this call throws in case of error m_SendTimelinePacket->SendTimelineEventBinaryPacket(timestamp, threadId, eventGuid); // Generate a GUID for the execution link - ProfilingDynamicGuid executionLinkId = profiling::ProfilingService::GetNextGuid(); + ProfilingDynamicGuid executionLinkId = ProfilingService::GetNextGuid(); // Send the new execution link to the external profiling service, this call throws in case of error m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink, @@ -399,7 +399,7 @@ ProfilingDynamicGuid TimelineUtilityMethods::RecordEvent(ProfilingGuid entityGui ProfilingDynamicGuid TimelineUtilityMethods::RecordWorkloadInferenceAndStartOfLifeEvent(ProfilingGuid workloadGuid, ProfilingGuid inferenceGuid) { - ProfilingDynamicGuid workloadInferenceGuid = profiling::ProfilingService::GetNextGuid(); + ProfilingDynamicGuid workloadInferenceGuid = ProfilingService::GetNextGuid(); CreateTypedEntity(workloadInferenceGuid, LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID); CreateRelationship(ProfilingRelationshipType::RetentionLink, inferenceGuid, @@ -418,6 +418,6 @@ void TimelineUtilityMethods::RecordEndOfLifeEvent(ProfilingGuid entityGuid) RecordEvent(entityGuid, LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS); } -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/TimelineUtilityMethods.hpp b/src/profiling/TimelineUtilityMethods.hpp index 80d5e8dffe..d0c96587b4 100644 --- a/src/profiling/TimelineUtilityMethods.hpp +++ b/src/profiling/TimelineUtilityMethods.hpp @@ -10,10 +10,10 @@ #include <armnn/Types.hpp> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class TimelineUtilityMethods @@ -95,6 +95,6 @@ private: std::unique_ptr<ISendTimelinePacket> m_SendTimelinePacket; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/backends/BackendProfiling.cpp b/src/profiling/backends/BackendProfiling.cpp index 135174b478..6c0f9b1b5c 100644 --- a/src/profiling/backends/BackendProfiling.cpp +++ b/src/profiling/backends/BackendProfiling.cpp @@ -6,10 +6,10 @@ #include "BackendProfiling.hpp" #include "RegisterBackendCounters.hpp" -namespace armnn +namespace arm { -namespace profiling +namespace pipe { std::unique_ptr<IRegisterBackendCounters> @@ -92,5 +92,6 @@ bool BackendProfiling::IsProfilingEnabled() const return m_ProfilingService.IsProfilingEnabled(); } -} // namespace profiling -} // namespace armnn +} // namespace pipe + +} // namespace arm diff --git a/src/profiling/backends/BackendProfiling.hpp b/src/profiling/backends/BackendProfiling.hpp index 5bf4655dd9..82678a162f 100644 --- a/src/profiling/backends/BackendProfiling.hpp +++ b/src/profiling/backends/BackendProfiling.hpp @@ -8,10 +8,10 @@ #include "ProfilingService.hpp" #include <armnn/backends/profiling/IBackendProfiling.hpp> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class BackendProfiling : public IBackendProfiling @@ -19,7 +19,7 @@ class BackendProfiling : public IBackendProfiling public: BackendProfiling(const ProfilingOptions& options, ProfilingService& profilingService, - const BackendId& backendId) + const armnn::BackendId& backendId) : m_Options(options), m_ProfilingService(profilingService), m_BackendId(backendId) {} @@ -45,7 +45,9 @@ public: private: ProfilingOptions m_Options; ProfilingService& m_ProfilingService; - BackendId m_BackendId; + armnn::BackendId m_BackendId; }; -} // namespace profiling -} // namespace armnn + +} // namespace pipe + +} // namespace arm diff --git a/src/profiling/test/BufferTests.cpp b/src/profiling/test/BufferTests.cpp index e3abe862e4..c4714d6ad4 100644 --- a/src/profiling/test/BufferTests.cpp +++ b/src/profiling/test/BufferTests.cpp @@ -13,7 +13,7 @@ #include <doctest/doctest.h> -using namespace armnn::profiling; +using namespace arm::pipe; TEST_SUITE("BufferTests") { @@ -383,8 +383,8 @@ TEST_CASE("ReadSwTraceMessageExceptionTest0") unsigned int uint32_t_size = sizeof(uint32_t); unsigned int offset = uint32_t_size; - CHECK_THROWS_AS(arm::pipe::ReadSwTraceMessage(packetBuffer->GetReadableData(), offset, packetBuffer->GetSize()), - arm::pipe::ProfilingException); + CHECK_THROWS_AS(ReadSwTraceMessage(packetBuffer->GetReadableData(), offset, packetBuffer->GetSize()), + ProfilingException); } @@ -405,8 +405,8 @@ TEST_CASE("ReadSwTraceMessageExceptionTest1") unsigned int uint32_t_size = sizeof(uint32_t); unsigned int offset = uint32_t_size; - CHECK_THROWS_AS(arm::pipe::ReadSwTraceMessage(packetBuffer->GetReadableData(), offset, packetBuffer->GetSize()), - arm::pipe::ProfilingException); + CHECK_THROWS_AS(ReadSwTraceMessage(packetBuffer->GetReadableData(), offset, packetBuffer->GetSize()), + ProfilingException); } diff --git a/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp b/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp index 03767c0a2a..5c5ee8a0e4 100644 --- a/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp +++ b/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp @@ -19,7 +19,7 @@ #include <sstream> #include <sys/stat.h> -using namespace armnn::profiling; +using namespace arm::pipe; using namespace armnn; using namespace std::chrono_literals; @@ -32,7 +32,7 @@ class FileOnlyHelperService : public ProfilingService { return ProfilingService::WaitForPacketSent(m_ProfilingService, timeout); } - armnn::profiling::ProfilingService m_ProfilingService; + ProfilingService m_ProfilingService; }; TEST_SUITE("FileOnlyProfilingDecoratorTests") diff --git a/src/profiling/test/PrintPacketHeaderHandler.cpp b/src/profiling/test/PrintPacketHeaderHandler.cpp index f85a7b1fcb..393153424d 100644 --- a/src/profiling/test/PrintPacketHeaderHandler.cpp +++ b/src/profiling/test/PrintPacketHeaderHandler.cpp @@ -8,10 +8,10 @@ #include <iostream> #include <sstream> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { std::vector<uint32_t> PrintPacketHeaderHandler::GetHeadersAccepted() @@ -27,6 +27,6 @@ void PrintPacketHeaderHandler::HandlePacket(const arm::pipe::Packet& packet) std::cout << ss.str() << std::endl; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn
\ No newline at end of file +} // namespace arm
\ No newline at end of file diff --git a/src/profiling/test/PrintPacketHeaderHandler.hpp b/src/profiling/test/PrintPacketHeaderHandler.hpp index 397da0b8ea..a05e733c07 100644 --- a/src/profiling/test/PrintPacketHeaderHandler.hpp +++ b/src/profiling/test/PrintPacketHeaderHandler.hpp @@ -9,10 +9,10 @@ #include <common/include/Packet.hpp> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class PrintPacketHeaderHandler : public ILocalPacketHandler @@ -22,6 +22,6 @@ class PrintPacketHeaderHandler : public ILocalPacketHandler virtual void HandlePacket(const arm::pipe::Packet& packet); }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp b/src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp index a851e940b4..3c4800a361 100644 --- a/src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp +++ b/src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp @@ -14,7 +14,7 @@ #include <doctest/doctest.h> -using namespace armnn::profiling; +using namespace arm::pipe; namespace { @@ -32,7 +32,7 @@ public: { // populate packet data and construct packet std::memcpy(m_PacketData.get(), g_DataPtr, g_DataLength); - m_Packet = std::make_unique<arm::pipe::Packet>(0u, g_DataLength, m_PacketData); + m_Packet = std::make_unique<Packet>(0u, g_DataLength, m_PacketData); } ~DummyProfilingConnection() = default; @@ -54,7 +54,7 @@ public: return true; } - arm::pipe::Packet ReadPacket(uint32_t timeout) override + Packet ReadPacket(uint32_t timeout) override { armnn::IgnoreUnused(timeout); return std::move(*m_Packet); @@ -63,7 +63,7 @@ public: private: bool m_Open; std::unique_ptr<unsigned char[]> m_PacketData; - std::unique_ptr<arm::pipe::Packet> m_Packet; + std::unique_ptr<Packet> m_Packet; }; std::vector<char> ReadDumpFile(const std::string& dumpFileName) @@ -105,8 +105,8 @@ TEST_CASE("DumpIncomingValidFile") ProfilingConnectionDumpToFileDecorator decorator(std::make_unique<DummyProfilingConnection>(), options, false); // NOTE: unique_ptr is needed here because operator=() is deleted for Packet - std::unique_ptr<arm::pipe::Packet> packet; - CHECK_NOTHROW(packet = std::make_unique<arm::pipe::Packet>(decorator.ReadPacket(0))); + std::unique_ptr<Packet> packet; + CHECK_NOTHROW(packet = std::make_unique<Packet>(decorator.ReadPacket(0))); decorator.Close(); diff --git a/src/profiling/test/ProfilingGuidTest.cpp b/src/profiling/test/ProfilingGuidTest.cpp index 30cfae82ca..0537badc33 100644 --- a/src/profiling/test/ProfilingGuidTest.cpp +++ b/src/profiling/test/ProfilingGuidTest.cpp @@ -14,7 +14,7 @@ #include <fmt/format.h> #include <thread> -using namespace armnn::profiling; +using namespace arm::pipe; TEST_SUITE("ProfilingGuidTests") { @@ -93,10 +93,10 @@ TEST_CASE("StaticGuidGeneratorCollisionTest") // If we're running on a 32bit system it is more likely to get a GUID clash over 1 million executions. // We can generally detect this when the GUID turns out to be MIN_STATIC_GUID. Output a warning // message rather than error in this case. - if (guid == ProfilingGuid(armnn::profiling::MIN_STATIC_GUID)) + if (guid == ProfilingGuid(MIN_STATIC_GUID)) { WARN("MIN_STATIC_GUID returned more than once from GenerateStaticId."); - } + } else { FAIL(fmt::format("GUID collision occurred: {} -> {}", str, guid)); diff --git a/src/profiling/test/ProfilingMocks.hpp b/src/profiling/test/ProfilingMocks.hpp index 491f057599..5e7d31a914 100644 --- a/src/profiling/test/ProfilingMocks.hpp +++ b/src/profiling/test/ProfilingMocks.hpp @@ -27,10 +27,10 @@ #include <mutex> #include <thread> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class MockProfilingConnection : public IProfilingConnection @@ -131,7 +131,7 @@ public: arm::pipe::Packet ReadPacket(uint32_t timeout) override { - IgnoreUnused(timeout); + armnn::IgnoreUnused(timeout); // Simulate a delay in the reading process. The default timeout is way too long. std::this_thread::sleep_for(std::chrono::milliseconds(5)); @@ -165,7 +165,7 @@ class MockProfilingConnectionFactory : public IProfilingConnectionFactory public: IProfilingConnectionPtr GetProfilingConnection(const ProfilingOptions& options) const override { - IgnoreUnused(options); + armnn::IgnoreUnused(options); return std::make_unique<MockProfilingConnection>(); } }; @@ -404,7 +404,7 @@ public: void SendCounterDirectoryPacket(const ICounterDirectory& counterDirectory) override { - IgnoreUnused(counterDirectory); + armnn::IgnoreUnused(counterDirectory); std::string message("SendCounterDirectoryPacket"); unsigned int reserved = 0; @@ -416,7 +416,7 @@ public: void SendPeriodicCounterCapturePacket(uint64_t timestamp, const std::vector<CounterValue>& values) override { - IgnoreUnused(timestamp, values); + armnn::IgnoreUnused(timestamp, values); std::string message("SendPeriodicCounterCapturePacket"); unsigned int reserved = 0; @@ -428,7 +428,7 @@ public: void SendPeriodicCounterSelectionPacket(uint32_t capturePeriod, const std::vector<uint16_t>& selectedCounterIds) override { - IgnoreUnused(capturePeriod, selectedCounterIds); + armnn::IgnoreUnused(capturePeriod, selectedCounterIds); std::string message("SendPeriodicCounterSelectionPacket"); unsigned int reserved = 0; @@ -505,7 +505,7 @@ public: return counterSetPtr; } - const Counter* RegisterCounter(const BackendId& backendId, + const Counter* RegisterCounter(const armnn::BackendId& backendId, const uint16_t uid, const std::string& parentCategoryName, uint16_t counterClass, @@ -518,7 +518,7 @@ public: const armnn::Optional<uint16_t>& deviceUid = armnn::EmptyOptional(), const armnn::Optional<uint16_t>& counterSetUid = armnn::EmptyOptional()) { - IgnoreUnused(backendId); + armnn::IgnoreUnused(backendId); // Get the number of cores from the argument only uint16_t deviceCores = numberOfCores.has_value() ? numberOfCores.value() : 0; @@ -602,19 +602,19 @@ public: const Device* GetDevice(uint16_t uid) const override { - IgnoreUnused(uid); + armnn::IgnoreUnused(uid); return nullptr; // Not used by the unit tests } const CounterSet* GetCounterSet(uint16_t uid) const override { - IgnoreUnused(uid); + armnn::IgnoreUnused(uid); return nullptr; // Not used by the unit tests } const Counter* GetCounter(uint16_t uid) const override { - IgnoreUnused(uid); + armnn::IgnoreUnused(uid); return nullptr; // Not used by the unit tests } @@ -698,9 +698,9 @@ class MockProfilingServiceStatus : public IProfilingServiceStatus { public: void NotifyProfilingServiceActive() override {} - void WaitForProfilingServiceActivation(unsigned int timeout) override { IgnoreUnused(timeout); } + void WaitForProfilingServiceActivation(unsigned int timeout) override { armnn::IgnoreUnused(timeout); } }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/test/ProfilingTestUtils.cpp b/src/profiling/test/ProfilingTestUtils.cpp index a03a3ba28a..154234667e 100644 --- a/src/profiling/test/ProfilingTestUtils.cpp +++ b/src/profiling/test/ProfilingTestUtils.cpp @@ -125,7 +125,7 @@ ProfilingGuid VerifyTimelineLabelBinaryPacketData(Optional<ProfilingGuid> guid, } else { - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; CHECK(readProfilingGuid == profilingService.GetStaticId(label)); } @@ -373,7 +373,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) GetProfilingService(&runtime).ResetExternalProfilingOptions( ConvertExternalProfilingOptions(options.m_ProfilingOptions), false); - profiling::ProfilingServiceRuntimeHelper profilingServiceHelper(GetProfilingService(&runtime)); + ProfilingServiceRuntimeHelper profilingServiceHelper(GetProfilingService(&runtime)); profilingServiceHelper.ForceTransitionToState(ProfilingState::NotConnected); profilingServiceHelper.ForceTransitionToState(ProfilingState::WaitingForAck); profilingServiceHelper.ForceTransitionToState(ProfilingState::Active); @@ -442,7 +442,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) armnn::NetworkId netId; CHECK(runtime.LoadNetwork(netId, std::move(optNet)) == Status::Success); - profiling::BufferManager& bufferManager = profilingServiceHelper.GetProfilingBufferManager(); + BufferManager& bufferManager = profilingServiceHelper.GetProfilingBufferManager(); auto readableBuffer = bufferManager.GetReadableBuffer(); // Profiling is enabled, the post-optimisation structure should be created diff --git a/src/profiling/test/ProfilingTestUtils.hpp b/src/profiling/test/ProfilingTestUtils.hpp index 6be35a96be..810a34c3e2 100644 --- a/src/profiling/test/ProfilingTestUtils.hpp +++ b/src/profiling/test/ProfilingTestUtils.hpp @@ -16,7 +16,7 @@ #include <common/include/ProfilingGuid.hpp> using namespace armnn; -using namespace armnn::profiling; +using namespace arm::pipe; const static uint32_t bodyHeaderSize = 6; @@ -63,10 +63,10 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId); bool CompareOutput(std::vector<std::string> output, std::vector<std::string> expectedOutput); -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class ProfilingServiceRuntimeHelper : public ProfilingService @@ -80,7 +80,7 @@ public: { return GetBufferManager(m_ProfilingService); } - armnn::profiling::ProfilingService& m_ProfilingService; + ProfilingService& m_ProfilingService; void ForceTransitionToState(ProfilingState newState) { @@ -88,7 +88,7 @@ public: } }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/test/ProfilingTests.cpp b/src/profiling/test/ProfilingTests.cpp index 12a0105563..cba6ebd475 100644 --- a/src/profiling/test/ProfilingTests.cpp +++ b/src/profiling/test/ProfilingTests.cpp @@ -51,7 +51,7 @@ #include <random> -using namespace armnn::profiling; +using namespace arm::pipe; using PacketType = MockProfilingConnection::PacketType; TEST_SUITE("ExternalProfiling") @@ -530,7 +530,7 @@ TEST_CASE("CheckProfilingStateMachine") ProfilingStateMachine profilingState15(ProfilingState::Active); CHECK_THROWS_AS(profilingState15.TransitionToState(ProfilingState::Uninitialised), armnn::Exception); - ProfilingStateMachine profilingState16(armnn::profiling::ProfilingState::Active); + ProfilingStateMachine profilingState16(ProfilingState::Active); CHECK_THROWS_AS(profilingState16.TransitionToState(ProfilingState::WaitingForAck), armnn::Exception); ProfilingStateMachine profilingState17(ProfilingState::Uninitialised); @@ -657,7 +657,7 @@ TEST_CASE("CaptureDataMethods") TEST_CASE("CheckProfilingServiceDisabled") { ProfilingOptions options; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised); profilingService.Update(); @@ -667,7 +667,7 @@ TEST_CASE("CheckProfilingServiceDisabled") TEST_CASE("CheckProfilingServiceCounterDirectory") { ProfilingOptions options; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); const ICounterDirectory& counterDirectory0 = profilingService.GetCounterDirectory(); @@ -691,7 +691,7 @@ TEST_CASE("CheckProfilingServiceCounterValues") { ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); profilingService.Update(); @@ -702,7 +702,7 @@ TEST_CASE("CheckProfilingServiceCounterValues") std::vector<std::thread> writers; CHECK(!counters.empty()); - uint16_t inferencesRun = armnn::profiling::INFERENCES_RUN; + uint16_t inferencesRun = INFERENCES_RUN; // Test GetAbsoluteCounterValue for (int i = 0; i < 4; ++i) @@ -838,13 +838,13 @@ TEST_CASE("CheckCounterDirectoryRegisterCategory") // Register a category with an invalid name const Category* noCategory = nullptr; - CHECK_THROWS_AS(noCategory = counterDirectory.RegisterCategory(""), armnn::InvalidArgumentException); + CHECK_THROWS_AS(noCategory = counterDirectory.RegisterCategory(""), arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCategoryCount() == 0); CHECK(!noCategory); // Register a category with an invalid name CHECK_THROWS_AS(noCategory = counterDirectory.RegisterCategory("invalid category"), - armnn::InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCategoryCount() == 0); CHECK(!noCategory); @@ -871,7 +871,7 @@ TEST_CASE("CheckCounterDirectoryRegisterCategory") // Register a category already registered const Category* anotherCategory = nullptr; CHECK_THROWS_AS(anotherCategory = counterDirectory.RegisterCategory(categoryName), - armnn::InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCategoryCount() == 1); CHECK(!anotherCategory); @@ -898,7 +898,7 @@ TEST_CASE("CheckCounterDirectoryRegisterCategory") const Category* categoryInvalidDeviceName = nullptr; CHECK_THROWS_AS(categoryInvalidDeviceName = counterDirectory.RegisterCategory(categoryWoDeviceName), - armnn::InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCategoryCount() == 2); CHECK(!categoryInvalidDeviceName); @@ -961,12 +961,12 @@ TEST_CASE("CheckCounterDirectoryRegisterDevice") // Register a device with an invalid name const Device* noDevice = nullptr; - CHECK_THROWS_AS(noDevice = counterDirectory.RegisterDevice(""), armnn::InvalidArgumentException); + CHECK_THROWS_AS(noDevice = counterDirectory.RegisterDevice(""), arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetDeviceCount() == 0); CHECK(!noDevice); // Register a device with an invalid name - CHECK_THROWS_AS(noDevice = counterDirectory.RegisterDevice("inv@lid nam€"), armnn::InvalidArgumentException); + CHECK_THROWS_AS(noDevice = counterDirectory.RegisterDevice("inv@lid nam€"), arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetDeviceCount() == 0); CHECK(!noDevice); @@ -992,7 +992,7 @@ TEST_CASE("CheckCounterDirectoryRegisterDevice") // Register a device with the name of a device already registered const Device* deviceSameName = nullptr; - CHECK_THROWS_AS(deviceSameName = counterDirectory.RegisterDevice(deviceName), armnn::InvalidArgumentException); + CHECK_THROWS_AS(deviceSameName = counterDirectory.RegisterDevice(deviceName), arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetDeviceCount() == 1); CHECK(!deviceSameName); @@ -1019,7 +1019,7 @@ TEST_CASE("CheckCounterDirectoryRegisterDevice") const Device* deviceWCoresWInvalidParentCategory = nullptr; CHECK_THROWS_AS(deviceWCoresWInvalidParentCategory = counterDirectory.RegisterDevice(deviceWCoresWInvalidParentCategoryName, 3, std::string("")), - armnn::InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetDeviceCount() == 2); CHECK(!deviceWCoresWInvalidParentCategory); @@ -1028,7 +1028,7 @@ TEST_CASE("CheckCounterDirectoryRegisterDevice") const Device* deviceWCoresWInvalidParentCategory2 = nullptr; CHECK_THROWS_AS(deviceWCoresWInvalidParentCategory2 = counterDirectory.RegisterDevice( deviceWCoresWInvalidParentCategoryName2, 3, std::string("invalid_parent_category")), - armnn::InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetDeviceCount() == 2); CHECK(!deviceWCoresWInvalidParentCategory2); @@ -1065,13 +1065,13 @@ TEST_CASE("CheckCounterDirectoryRegisterCounterSet") // Register a counter set with an invalid name const CounterSet* noCounterSet = nullptr; - CHECK_THROWS_AS(noCounterSet = counterDirectory.RegisterCounterSet(""), armnn::InvalidArgumentException); + CHECK_THROWS_AS(noCounterSet = counterDirectory.RegisterCounterSet(""), arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterSetCount() == 0); CHECK(!noCounterSet); // Register a counter set with an invalid name CHECK_THROWS_AS(noCounterSet = counterDirectory.RegisterCounterSet("invalid name"), - armnn::InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterSetCount() == 0); CHECK(!noCounterSet); @@ -1098,7 +1098,7 @@ TEST_CASE("CheckCounterDirectoryRegisterCounterSet") // Register a counter set with the name of a counter set already registered const CounterSet* counterSetSameName = nullptr; CHECK_THROWS_AS(counterSetSameName = counterDirectory.RegisterCounterSet(counterSetName), - armnn::InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterSetCount() == 1); CHECK(!counterSetSameName); @@ -1126,7 +1126,7 @@ TEST_CASE("CheckCounterDirectoryRegisterCounterSet") const CounterSet* counterSetWCountWInvalidParentCategory = nullptr; CHECK_THROWS_AS(counterSetWCountWInvalidParentCategory = counterDirectory.RegisterCounterSet( counterSetWCountWInvalidParentCategoryName, 42, std::string("")), - armnn::InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterSetCount() == 2); CHECK(!counterSetWCountWInvalidParentCategory); @@ -1136,7 +1136,7 @@ TEST_CASE("CheckCounterDirectoryRegisterCounterSet") const CounterSet* counterSetWCountWInvalidParentCategory2 = nullptr; CHECK_THROWS_AS(counterSetWCountWInvalidParentCategory2 = counterDirectory.RegisterCounterSet( counterSetWCountWInvalidParentCategoryName2, 42, std::string("invalid_parent_category")), - armnn::InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterSetCount() == 2); CHECK(!counterSetWCountWInvalidParentCategory2); @@ -1169,7 +1169,7 @@ TEST_CASE("CheckCounterDirectoryRegisterCounterSet") const CounterSet* counterSetSameCategory = nullptr; CHECK_THROWS_AS(counterSetSameCategory = counterDirectory.RegisterCounterSet(counterSetSameCategoryName, 0, invalidCategoryName), - armnn::InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterSetCount() == 3); CHECK(!counterSetSameCategory); } @@ -1193,62 +1193,62 @@ TEST_CASE("CheckCounterDirectoryRegisterCounter") 123.45f, "valid ", "name"), - armnn::InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterCount() == 0); CHECK(!noCounter); // Register a counter with an invalid parent category name CHECK_THROWS_AS(noCounter = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 1, - "invalid parent category", - 0, - 1, - 123.45f, - "valid name", - "valid description"), - armnn::InvalidArgumentException); + 1, + "invalid parent category", + 0, + 1, + 123.45f, + "valid name", + "valid description"), + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterCount() == 0); CHECK(!noCounter); // Register a counter with an invalid class CHECK_THROWS_AS(noCounter = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 2, - "valid_parent_category", - 2, - 1, - 123.45f, - "valid " - "name", - "valid description"), - armnn::InvalidArgumentException); + 2, + "valid_parent_category", + 2, + 1, + 123.45f, + "valid " + "name", + "valid description"), + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterCount() == 0); CHECK(!noCounter); // Register a counter with an invalid interpolation CHECK_THROWS_AS(noCounter = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 4, - "valid_parent_category", - 0, - 3, - 123.45f, - "valid " - "name", - "valid description"), - armnn::InvalidArgumentException); + 4, + "valid_parent_category", + 0, + 3, + 123.45f, + "valid " + "name", + "valid description"), + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterCount() == 0); CHECK(!noCounter); // Register a counter with an invalid multiplier CHECK_THROWS_AS(noCounter = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 5, - "valid_parent_category", - 0, - 1, - .0f, - "valid " - "name", - "valid description"), - armnn::InvalidArgumentException); + 5, + "valid_parent_category", + 0, + 1, + .0f, + "valid " + "name", + "valid description"), + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterCount() == 0); CHECK(!noCounter); @@ -1262,20 +1262,20 @@ TEST_CASE("CheckCounterDirectoryRegisterCounter") 123.45f, "", "valid description"), - armnn::InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterCount() == 0); CHECK(!noCounter); // Register a counter with an invalid name CHECK_THROWS_AS(noCounter = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 7, - "valid_parent_category", - 0, - 1, - 123.45f, - "invalid nam€", - "valid description"), - armnn::InvalidArgumentException); + 7, + "valid_parent_category", + 0, + 1, + 123.45f, + "invalid nam€", + "valid description"), + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterCount() == 0); CHECK(!noCounter); @@ -1289,48 +1289,48 @@ TEST_CASE("CheckCounterDirectoryRegisterCounter") 123.45f, "valid name", ""), - armnn::InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterCount() == 0); CHECK(!noCounter); // Register a counter with an invalid description CHECK_THROWS_AS(noCounter = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 9, - "valid_parent_category", - 0, - 1, - 123.45f, - "valid " - "name", - "inv@lid description"), - armnn::InvalidArgumentException); + 9, + "valid_parent_category", + 0, + 1, + 123.45f, + "valid " + "name", + "inv@lid description"), + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterCount() == 0); CHECK(!noCounter); // Register a counter with an invalid unit2 CHECK_THROWS_AS(noCounter = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 10, - "valid_parent_category", - 0, - 1, - 123.45f, - "valid name", - "valid description", - std::string("Mb/s2")), - armnn::InvalidArgumentException); + 10, + "valid_parent_category", + 0, + 1, + 123.45f, + "valid name", + "valid description", + std::string("Mb/s2")), + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterCount() == 0); CHECK(!noCounter); // Register a counter with a non-existing parent category name CHECK_THROWS_AS(noCounter = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 11, - "invalid_parent_category", - 0, - 1, - 123.45f, - "valid name", - "valid description"), - armnn::InvalidArgumentException); + 11, + "invalid_parent_category", + 0, + 1, + 123.45f, + "valid name", + "valid description"), + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterCount() == 0); CHECK(!noCounter); @@ -1384,21 +1384,21 @@ TEST_CASE("CheckCounterDirectoryRegisterCounter") "valid name", "valid description", std::string("description")), - armnn::InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterCount() == 1); CHECK(!counterSameName); // Register a counter with a valid parent category name and units const Counter* counterWUnits = nullptr; CHECK_NOTHROW(counterWUnits = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 14, - categoryName, - 0, - 1, - 123.45f, - "valid name 2", - "valid description", - std::string("Mnnsq2"))); // Units + 14, + categoryName, + 0, + 1, + 123.45f, + "valid name 2", + "valid description", + std::string("Mnnsq2"))); // Units CHECK(counterDirectory.GetCounterCount() == 2); CHECK(counterWUnits); CHECK(counterWUnits->m_Uid > counter->m_Uid); @@ -1417,16 +1417,16 @@ TEST_CASE("CheckCounterDirectoryRegisterCounter") // Register a counter with a valid parent category name and not associated with a device const Counter* counterWoDevice = nullptr; CHECK_NOTHROW(counterWoDevice = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 26, - categoryName, - 0, - 1, - 123.45f, - "valid name 3", - "valid description", - armnn::EmptyOptional(),// Units - armnn::EmptyOptional(),// Number of cores - 0)); // Device UID + 26, + categoryName, + 0, + 1, + 123.45f, + "valid name 3", + "valid description", + armnn::EmptyOptional(),// Units + armnn::EmptyOptional(),// Number of cores + 0)); // Device UID CHECK(counterDirectory.GetCounterCount() == 3); CHECK(counterWoDevice); CHECK(counterWoDevice->m_Uid > counter->m_Uid); @@ -1444,17 +1444,17 @@ TEST_CASE("CheckCounterDirectoryRegisterCounter") // Register a counter with a valid parent category name and associated to an invalid device CHECK_THROWS_AS(noCounter = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 15, - categoryName, - 0, - 1, - 123.45f, - "valid name 4", - "valid description", - armnn::EmptyOptional(), // Units - armnn::EmptyOptional(), // Number of cores - 100), // Device UID - armnn::InvalidArgumentException); + 15, + categoryName, + 0, + 1, + 123.45f, + "valid name 4", + "valid description", + armnn::EmptyOptional(), // Units + armnn::EmptyOptional(), // Number of cores + 100), // Device UID + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterCount() == 3); CHECK(!noCounter); @@ -1471,16 +1471,16 @@ TEST_CASE("CheckCounterDirectoryRegisterCounter") // Register a counter with a valid parent category name and associated to a device const Counter* counterWDevice = nullptr; CHECK_NOTHROW(counterWDevice = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 16, - categoryName, - 0, - 1, - 123.45f, - "valid name 5", - std::string("valid description"), - armnn::EmptyOptional(), // Units - armnn::EmptyOptional(), // Number of cores - device->m_Uid)); // Device UID + 16, + categoryName, + 0, + 1, + 123.45f, + "valid name 5", + std::string("valid description"), + armnn::EmptyOptional(), // Units + armnn::EmptyOptional(), // Number of cores + device->m_Uid)); // Device UID CHECK(counterDirectory.GetCounterCount() == 4); CHECK(counterWDevice); CHECK(counterWDevice->m_Uid > counter->m_Uid); @@ -1499,17 +1499,17 @@ TEST_CASE("CheckCounterDirectoryRegisterCounter") // Register a counter with a valid parent category name and not associated with a counter set const Counter* counterWoCounterSet = nullptr; CHECK_NOTHROW(counterWoCounterSet = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 17, - categoryName, - 0, - 1, - 123.45f, - "valid name 6", - "valid description", - armnn::EmptyOptional(),// Units - armnn::EmptyOptional(),// No of cores - armnn::EmptyOptional(),// Device UID - 0)); // CounterSet UID + 17, + categoryName, + 0, + 1, + 123.45f, + "valid name 6", + "valid description", + armnn::EmptyOptional(),// Units + armnn::EmptyOptional(),// No of cores + armnn::EmptyOptional(),// Device UID + 0)); // CounterSet UID CHECK(counterDirectory.GetCounterCount() == 5); CHECK(counterWoCounterSet); CHECK(counterWoCounterSet->m_Uid > counter->m_Uid); @@ -1527,18 +1527,18 @@ TEST_CASE("CheckCounterDirectoryRegisterCounter") // Register a counter with a valid parent category name and associated to an invalid counter set CHECK_THROWS_AS(noCounter = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 18, - categoryName, - 0, - 1, - 123.45f, - "valid ", - "name 7", - std::string("valid description"), - armnn::EmptyOptional(), // Units - armnn::EmptyOptional(), // Number of cores - 100), // Counter set UID - armnn::InvalidArgumentException); + 18, + categoryName, + 0, + 1, + 123.45f, + "valid ", + "name 7", + std::string("valid description"), + armnn::EmptyOptional(), // Units + armnn::EmptyOptional(), // Number of cores + 100), // Counter set UID + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterCount() == 5); CHECK(!noCounter); @@ -1727,12 +1727,12 @@ TEST_CASE("CheckCounterDirectoryRegisterCounter") // Register a counter to the other category const Counter* anotherCounter = nullptr; 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 - device->m_Uid, // Device UID - counterSet->m_Uid)); // Counter set UID + anotherCategoryName, 1, 0, .00043f, + "valid name", "valid description", + armnn::EmptyOptional(), // Units + armnn::EmptyOptional(), // Number of cores + device->m_Uid, // Device UID + counterSet->m_Uid)); // Counter set UID CHECK(counterDirectory.GetCounterCount() == 29); CHECK(anotherCounter); CHECK(anotherCounter->m_MaxCounterUid == anotherCounter->m_Uid); @@ -1787,7 +1787,7 @@ TEST_CASE("CounterSelectionCommandHandlerParseData") uint32_t version = 1; const std::unordered_map<armnn::BackendId, - std::shared_ptr<armnn::profiling::IBackendProfilingContext>> backendProfilingContext; + std::shared_ptr<IBackendProfilingContext>> backendProfilingContext; CounterIdMap counterIdMap; Holder holder; TestCaptureThread captureThread; @@ -1928,7 +1928,7 @@ TEST_CASE("CheckTimelineActivationAndDeactivation") TestReportStructure testReportStructure; TestNotifyBackends testNotifyBackends; - profiling::ActivateTimelineReportingCommandHandler activateTimelineReportingCommandHandler(0, + ActivateTimelineReportingCommandHandler activateTimelineReportingCommandHandler(0, 6, packetVersionResolver.ResolvePacketVersion(0, 6) .GetEncodedValue(), @@ -2001,19 +2001,18 @@ TEST_CASE("CheckTimelineActivationAndDeactivation") TEST_CASE("CheckProfilingServiceNotActive") { using namespace armnn; - using namespace armnn::profiling; // Create runtime in which the test will run armnn::IRuntime::CreationOptions options; options.m_ProfilingOptions.m_EnableProfiling = true; armnn::RuntimeImpl runtime(options); - profiling::ProfilingServiceRuntimeHelper profilingServiceHelper(GetProfilingService(&runtime)); + ProfilingServiceRuntimeHelper profilingServiceHelper(GetProfilingService(&runtime)); profilingServiceHelper.ForceTransitionToState(ProfilingState::NotConnected); profilingServiceHelper.ForceTransitionToState(ProfilingState::WaitingForAck); profilingServiceHelper.ForceTransitionToState(ProfilingState::Active); - profiling::BufferManager& bufferManager = profilingServiceHelper.GetProfilingBufferManager(); + BufferManager& bufferManager = profilingServiceHelper.GetProfilingBufferManager(); auto readableBuffer = bufferManager.GetReadableBuffer(); // Profiling is enabled, the post-optimisation structure should be created @@ -2344,7 +2343,7 @@ TEST_CASE("CheckPeriodicCounterCaptureThread") ProfilingStateMachine profilingStateMachine; const std::unordered_map<armnn::BackendId, - std::shared_ptr<armnn::profiling::IBackendProfilingContext>> backendProfilingContext; + std::shared_ptr<IBackendProfilingContext>> backendProfilingContext; CounterIdMap counterIdMap; Holder data; std::vector<uint16_t> captureIds1 = { 0, 1 }; @@ -2551,7 +2550,7 @@ TEST_CASE("CheckProfilingServiceGoodConnectionAcknowledgedPacket") // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one @@ -2611,7 +2610,7 @@ TEST_CASE("CheckProfilingServiceGoodRequestCounterDirectoryPacket") // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one @@ -2669,7 +2668,7 @@ TEST_CASE("CheckProfilingServiceBadPeriodicCounterSelectionPacketInvalidCounterU // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one @@ -2748,7 +2747,7 @@ TEST_CASE("CheckProfilingServiceGoodPeriodicCounterSelectionPacketNoCounters") // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one @@ -2813,7 +2812,7 @@ TEST_CASE("CheckProfilingServiceGoodPeriodicCounterSelectionPacketSingleCounter" // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one @@ -2890,7 +2889,7 @@ TEST_CASE("CheckProfilingServiceGoodPeriodicCounterSelectionPacketMultipleCounte // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one @@ -2969,7 +2968,7 @@ TEST_CASE("CheckProfilingServiceDisconnect") // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one @@ -3027,7 +3026,7 @@ TEST_CASE("CheckProfilingServiceGoodPerJobCounterSelectionPacket") // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one @@ -3094,7 +3093,7 @@ TEST_CASE("CheckConfigureProfilingServiceOn") { ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised); profilingService.ConfigureProfilingService(options); // should get as far as NOT_CONNECTED @@ -3107,7 +3106,7 @@ TEST_CASE("CheckConfigureProfilingServiceOn") TEST_CASE("CheckConfigureProfilingServiceOff") { ProfilingOptions options; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised); profilingService.ConfigureProfilingService(options); // should not move from Uninitialised @@ -3123,7 +3122,7 @@ TEST_CASE("CheckProfilingServiceEnabled") LogLevelSwapper logLevelSwapper(armnn::LogSeverity::Warning); ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised); profilingService.Update(); @@ -3153,7 +3152,7 @@ TEST_CASE("CheckProfilingServiceEnabledRuntime") // Locally reduce log level to "Warning", as this test needs to parse a warning message from the standard output LogLevelSwapper logLevelSwapper(armnn::LogSeverity::Warning); ProfilingOptions options; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised); profilingService.Update(); @@ -3196,7 +3195,7 @@ TEST_CASE("CheckProfilingServiceBadConnectionAcknowledgedPacket") // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one @@ -3258,7 +3257,7 @@ TEST_CASE("CheckProfilingServiceBadRequestCounterDirectoryPacket") // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one @@ -3322,7 +3321,7 @@ TEST_CASE("CheckProfilingServiceBadPeriodicCounterSelectionPacket") // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one @@ -3417,7 +3416,7 @@ TEST_CASE("CheckCounterIdMap") TEST_CASE("CheckRegisterBackendCounters") { - uint16_t globalCounterIds = armnn::profiling::INFERENCES_RUN; + uint16_t globalCounterIds = INFERENCES_RUN; armnn::BackendId cpuRefId(armnn::Compute::CpuRef); // Reset the profiling service to the uninitialized state @@ -3454,7 +3453,7 @@ TEST_CASE("CheckRegisterBackendCounters") 1.f, "CounterOne", "first test counter"); - CHECK((newGlobalCounterId = armnn::profiling::INFERENCES_RUN + 1)); + CHECK((newGlobalCounterId = INFERENCES_RUN + 1)); uint16_t mappedGlobalId = profilingService.GetCounterMappings().GetGlobalId(0, cpuRefId); CHECK(mappedGlobalId == newGlobalCounterId); auto backendMapping = profilingService.GetCounterMappings().GetBackendId(newGlobalCounterId); @@ -3482,7 +3481,7 @@ TEST_CASE("CheckCounterStatusQuery") BackendProfiling backendProfilingCpuRef(options, profilingService, cpuRefId); BackendProfiling backendProfilingCpuAcc(options, profilingService, cpuAccId); - uint16_t initialNumGlobalCounterIds = armnn::profiling::INFERENCES_RUN; + uint16_t initialNumGlobalCounterIds = INFERENCES_RUN; // Create RegisterBackendCounters for CpuRef RegisterBackendCounters registerBackendCountersCpuRef(initialNumGlobalCounterIds, cpuRefId, profilingService); @@ -3617,15 +3616,15 @@ TEST_CASE("CheckRegisterCounters") mockProfilingService.RegisterMapping(7, 1, cpuRefId); mockProfilingService.RegisterMapping(8, 2, cpuRefId); - armnn::profiling::BackendProfiling backendProfiling(options, + BackendProfiling backendProfiling(options, mockProfilingService, cpuRefId); - armnn::profiling::Timestamp timestamp; + Timestamp timestamp; timestamp.timestamp = 1000998; timestamp.counterValues.emplace_back(0, 700); timestamp.counterValues.emplace_back(2, 93); - std::vector<armnn::profiling::Timestamp> timestamps; + std::vector<Timestamp> timestamps; timestamps.push_back(timestamp); backendProfiling.ReportCounters(timestamps); @@ -3675,7 +3674,7 @@ TEST_CASE("CheckFileFormat") { // Change file format to an unsupported value options.m_FileFormat = "json"; // Enable the profiling service - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); // Start the command handler and the send thread profilingService.Update(); diff --git a/src/profiling/test/ProfilingTests.hpp b/src/profiling/test/ProfilingTests.hpp index a8ca1b9b18..fd8ad315f1 100644 --- a/src/profiling/test/ProfilingTests.hpp +++ b/src/profiling/test/ProfilingTests.hpp @@ -21,10 +21,10 @@ #include <chrono> #include <thread> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { struct LogLevelSwapper @@ -79,7 +79,7 @@ public: bool WritePacket(const unsigned char* buffer, uint32_t length) override { - IgnoreUnused(buffer, length); + armnn::IgnoreUnused(buffer, length); return false; } @@ -141,7 +141,7 @@ public: arm::pipe::Packet ReadPacket(uint32_t timeout) override { - IgnoreUnused(timeout); + armnn::IgnoreUnused(timeout); ++m_ReadRequests; throw armnn::Exception("Simulate a non-timeout error"); } @@ -160,7 +160,7 @@ class TestProfilingConnectionBadAckPacket : public TestProfilingConnectionBase public: arm::pipe::Packet ReadPacket(uint32_t timeout) override { - IgnoreUnused(timeout); + armnn::IgnoreUnused(timeout); // Connection Acknowledged Packet header (word 0, word 1 is always zero): // 26:31 [6] packet_family: Control Packet Family, value 0b000000 // 16:25 [10] packet_id: Packet identifier, value 0b0000000001 @@ -183,7 +183,7 @@ public: void operator()(const arm::pipe::Packet& packet) override { - IgnoreUnused(packet); + armnn::IgnoreUnused(packet); m_Count++; } @@ -206,7 +206,7 @@ class SwapProfilingConnectionFactoryHelper : public ProfilingService public: using MockProfilingConnectionFactoryPtr = std::unique_ptr<MockProfilingConnectionFactory>; - SwapProfilingConnectionFactoryHelper(armnn::profiling::ProfilingService& profilingService) + SwapProfilingConnectionFactoryHelper(ProfilingService& profilingService) : ProfilingService() , m_ProfilingService(profilingService) , m_MockProfilingConnectionFactory(new MockProfilingConnectionFactory()) @@ -231,7 +231,7 @@ public: MockProfilingConnection* GetMockProfilingConnection() { IProfilingConnection* profilingConnection = GetProfilingConnection(m_ProfilingService); - return PolymorphicDowncast<MockProfilingConnection*>(profilingConnection); + return armnn::PolymorphicDowncast<MockProfilingConnection*>(profilingConnection); } void ForceTransitionToState(ProfilingState newState) @@ -272,11 +272,11 @@ public: } private: - armnn::profiling::ProfilingService& m_ProfilingService; + ProfilingService& m_ProfilingService; MockProfilingConnectionFactoryPtr m_MockProfilingConnectionFactory; IProfilingConnectionFactory* m_BackupProfilingConnectionFactory; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/test/RequestCountersPacketHandler.cpp b/src/profiling/test/RequestCountersPacketHandler.cpp index 3ba50503a1..fb3eee8f20 100644 --- a/src/profiling/test/RequestCountersPacketHandler.cpp +++ b/src/profiling/test/RequestCountersPacketHandler.cpp @@ -12,10 +12,10 @@ #include <common/include/PacketVersionResolver.hpp> #include <common/include/ProfilingException.hpp> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { std::vector<uint32_t> RequestCountersPacketHandler::GetHeadersAccepted() @@ -75,6 +75,6 @@ void RequestCountersPacketHandler::SendCounterSelectionPacket() m_Connection->ReturnPacket(packet); } -} // namespace profiling +} // namespace pipe -} // namespace armnn
\ No newline at end of file +} // namespace arm
\ No newline at end of file diff --git a/src/profiling/test/RequestCountersPacketHandler.hpp b/src/profiling/test/RequestCountersPacketHandler.hpp index 82bd313b85..7068a4f253 100644 --- a/src/profiling/test/RequestCountersPacketHandler.hpp +++ b/src/profiling/test/RequestCountersPacketHandler.hpp @@ -11,10 +11,10 @@ #include <common/include/Packet.hpp> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class RequestCountersPacketHandler : public ILocalPacketHandler @@ -43,6 +43,6 @@ private: void SendCounterSelectionPacket(); }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/test/SendCounterPacketTests.cpp b/src/profiling/test/SendCounterPacketTests.cpp index 675d083644..1380b42d37 100644 --- a/src/profiling/test/SendCounterPacketTests.cpp +++ b/src/profiling/test/SendCounterPacketTests.cpp @@ -26,7 +26,7 @@ #include <chrono> -using namespace armnn::profiling; +using namespace arm::pipe; namespace { @@ -294,7 +294,7 @@ TEST_CASE("SendStreamMetaDataPacketTest") // Error no space left in buffer MockBufferManager mockBuffer1(10); SendCounterPacket sendPacket1(mockBuffer1); - CHECK_THROWS_AS(sendPacket1.SendStreamMetaDataPacket(), armnn::profiling::BufferExhaustion); + CHECK_THROWS_AS(sendPacket1.SendStreamMetaDataPacket(), BufferExhaustion); // Full metadata packet @@ -1180,7 +1180,7 @@ TEST_CASE("SendCounterDirectoryPacketTest1") MockBufferManager mockBuffer(10); SendCounterPacket sendCounterPacket(mockBuffer); CHECK_THROWS_AS(sendCounterPacket.SendCounterDirectoryPacket(counterDirectory), - armnn::profiling::BufferExhaustion); + BufferExhaustion); } TEST_CASE("SendCounterDirectoryPacketTest2") @@ -1228,49 +1228,49 @@ TEST_CASE("SendCounterDirectoryPacketTest2") // Register a counter associated to "category1" const Counter* counter1 = nullptr; CHECK_NOTHROW(counter1 = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 0, - category1Name, - 0, - 1, - 123.45f, - "counter1", - "counter1description", - std::string("counter1units"), - numberOfCores)); + 0, + category1Name, + 0, + 1, + 123.45f, + "counter1", + "counter1description", + std::string("counter1units"), + numberOfCores)); CHECK(counterDirectory.GetCounterCount() == 4); CHECK(counter1); // Register a counter associated to "category1" const Counter* counter2 = nullptr; CHECK_NOTHROW(counter2 = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 4, - category1Name, - 1, - 0, - 330.1245656765f, - "counter2", - "counter2description", - std::string("counter2units"), - armnn::EmptyOptional(), - device2->m_Uid, - 0)); + 4, + category1Name, + 1, + 0, + 330.1245656765f, + "counter2", + "counter2description", + std::string("counter2units"), + armnn::EmptyOptional(), + device2->m_Uid, + 0)); CHECK(counterDirectory.GetCounterCount() == 5); CHECK(counter2); // Register a counter associated to "category2" const Counter* counter3 = nullptr; CHECK_NOTHROW(counter3 = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 5, - category2Name, - 1, - 1, - 0.0000045399f, - "counter3", - "counter3description", - armnn::EmptyOptional(), - numberOfCores, - device2->m_Uid, - counterSet1->m_Uid)); + 5, + category2Name, + 1, + 1, + 0.0000045399f, + "counter3", + "counter3description", + armnn::EmptyOptional(), + numberOfCores, + device2->m_Uid, + counterSet1->m_Uid)); CHECK(counterDirectory.GetCounterCount() == 9); CHECK(counter3); @@ -1773,17 +1773,17 @@ TEST_CASE("SendCounterDirectoryPacketTest7") // Register an invalid counter associated to a valid category const Counter* counter = nullptr; CHECK_NOTHROW(counter = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 0, - categoryName, - 0, - 1, - 123.45f, - "counter", - "counter description", - std::string("invalid counter units"), - 5, - device->m_Uid, - counterSet->m_Uid)); + 0, + categoryName, + 0, + 1, + 123.45f, + "counter", + "counter description", + std::string("invalid counter units"), + 5, + device->m_Uid, + counterSet->m_Uid)); CHECK(counterDirectory.GetCounterCount() == 5); CHECK(counter); diff --git a/src/profiling/test/SendCounterPacketTests.hpp b/src/profiling/test/SendCounterPacketTests.hpp index 2eac395ecf..4dec67d335 100644 --- a/src/profiling/test/SendCounterPacketTests.hpp +++ b/src/profiling/test/SendCounterPacketTests.hpp @@ -22,10 +22,10 @@ #include <mutex> #include <thread> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class SendCounterPacketTest : public SendCounterPacket @@ -65,6 +65,6 @@ public: } }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/test/SendTimelinePacketTests.cpp b/src/profiling/test/SendTimelinePacketTests.cpp index a2076b87c5..4e32149e44 100644 --- a/src/profiling/test/SendTimelinePacketTests.cpp +++ b/src/profiling/test/SendTimelinePacketTests.cpp @@ -21,7 +21,7 @@ #include <functional> #include <Runtime.hpp> -using namespace armnn::profiling; +using namespace arm::pipe; TEST_SUITE("SendTimelinePacketTests") { @@ -421,7 +421,7 @@ TEST_CASE("SendTimelinePacketTests3") const uint64_t eventClassBinaryPacketNameGuid = 8845u; CHECK_THROWS_AS(sendTimelinePacket->SendTimelineEventClassBinaryPacket( eventClassBinaryPacketProfilingGuid, eventClassBinaryPacketNameGuid), - armnn::profiling::BufferExhaustion); + BufferExhaustion); } TEST_CASE("GetGuidsFromProfilingService") @@ -429,7 +429,7 @@ TEST_CASE("GetGuidsFromProfilingService") armnn::IRuntime::CreationOptions options; options.m_ProfilingOptions.m_EnableProfiling = true; armnn::RuntimeImpl runtime(options); - armnn::profiling::ProfilingService profilingService(runtime); + ProfilingService profilingService(runtime); profilingService.ResetExternalProfilingOptions( ConvertExternalProfilingOptions(options.m_ProfilingOptions), true); @@ -450,7 +450,7 @@ TEST_CASE("GetTimelinePackerWriterFromProfilingService") { ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); std::unique_ptr<ISendTimelinePacket> writer = profilingService.GetSendTimelinePacket(); diff --git a/src/profiling/test/TestTimelinePacketHandler.cpp b/src/profiling/test/TestTimelinePacketHandler.cpp index a2b5286728..d38c1751cb 100644 --- a/src/profiling/test/TestTimelinePacketHandler.cpp +++ b/src/profiling/test/TestTimelinePacketHandler.cpp @@ -11,10 +11,10 @@ #include <chrono> #include <iostream> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { std::vector<uint32_t> TestTimelinePacketHandler::GetHeadersAccepted() @@ -125,7 +125,7 @@ arm::pipe::ITimelineDecoder::TimelineStatus TimelineMessageDecoder::CreateRelati m_TimelineModel.IsInferenceGuid(relationship.m_HeadGuid)) { ProfilingStaticGuid attributeGuid(relationship.m_AttributeGuid); - if (attributeGuid == armnn::profiling::LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS) + if (attributeGuid == LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS) { if (m_PacketHandler != nullptr) { @@ -136,6 +136,6 @@ arm::pipe::ITimelineDecoder::TimelineStatus TimelineMessageDecoder::CreateRelati return arm::pipe::ITimelineDecoder::TimelineStatus::TimelineStatus_Success; } -} // namespace profiling +} // namespace pipe -} // namespace armnn
\ No newline at end of file +} // namespace arm
\ No newline at end of file diff --git a/src/profiling/test/TestTimelinePacketHandler.hpp b/src/profiling/test/TestTimelinePacketHandler.hpp index ab6eee5121..7166707e80 100644 --- a/src/profiling/test/TestTimelinePacketHandler.hpp +++ b/src/profiling/test/TestTimelinePacketHandler.hpp @@ -20,10 +20,10 @@ #include <mutex> #include <vector> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { // forward declaration of class @@ -87,6 +87,6 @@ private: arm::pipe::TimelineDirectoryCaptureCommandHandler m_DirectoryDecoder; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn
\ No newline at end of file +} // namespace arm
\ No newline at end of file diff --git a/src/profiling/test/TimelineModel.cpp b/src/profiling/test/TimelineModel.cpp index a80ad11e24..24ced44942 100644 --- a/src/profiling/test/TimelineModel.cpp +++ b/src/profiling/test/TimelineModel.cpp @@ -9,10 +9,10 @@ #include <algorithm> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { void TimelineModel::AddLabel(const arm::pipe::ITimelineDecoder::Label& label) @@ -58,20 +58,20 @@ void TimelineModel::AddRelationship(const arm::pipe::ITimelineDecoder::Relations { HandleLabelLink(relationship); } - else if (relationship.m_RelationshipType == arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink) + else if (relationship.m_RelationshipType == ITimelineDecoder::RelationshipType::RetentionLink) { // Take care of the special case of a connection between layers in ArmNN // modelled by a retention link between two layer entities with an attribute GUID // of connection - if (relationship.m_AttributeGuid == armnn::profiling::LabelsAndEventClasses::CONNECTION_GUID) + if (relationship.m_AttributeGuid == LabelsAndEventClasses::CONNECTION_GUID) { HandleConnection(relationship); } - else if (relationship.m_AttributeGuid == armnn::profiling::LabelsAndEventClasses::CHILD_GUID) + else if (relationship.m_AttributeGuid == LabelsAndEventClasses::CHILD_GUID) { HandleChild(relationship); } - else if (relationship.m_AttributeGuid == armnn::profiling::LabelsAndEventClasses::EXECUTION_OF_GUID) + else if (relationship.m_AttributeGuid == LabelsAndEventClasses::EXECUTION_OF_GUID) { HandleExecutionOf(relationship); } @@ -128,8 +128,8 @@ void TimelineModel::HandleLabelLink(const arm::pipe::ITimelineDecoder::Relations entity->AddAttribute(*attribute, *value); // if the attribute is 'type' and the value is 'inference' // we need to cache the entity guid as an inference - if (armnn::profiling::LabelsAndEventClasses::TYPE_LABEL.compare(*attribute) == 0 && - armnn::profiling::LabelsAndEventClasses::INFERENCE.compare(*value) == 0) + if (LabelsAndEventClasses::TYPE_LABEL.compare(*attribute) == 0 && + LabelsAndEventClasses::INFERENCE.compare(*value) == 0) { m_InferenceGuids.push_back(relationship.m_HeadGuid); } @@ -360,7 +360,7 @@ std::string GetEntityDescription(const Entity& entity) ss << "Entity [" << entity.GetGuid() << "]"; for (auto& attributeEntry : entity.GetAttributes()) { - if (profiling::LabelsAndEventClasses::PROCESS_ID_LABEL == attributeEntry.second.first) + if (LabelsAndEventClasses::PROCESS_ID_LABEL == attributeEntry.second.first) { ss << " " << attributeEntry.second.first << " = [processId]"; } @@ -400,6 +400,6 @@ std::string GetEventDescription(EventObj* event) return ss.str(); } -} // namespace profiling +} // namespace pipe -} // namespace armnn
\ No newline at end of file +} // namespace arm
\ No newline at end of file diff --git a/src/profiling/test/TimelineModel.hpp b/src/profiling/test/TimelineModel.hpp index ccbec7b01d..7628f8c042 100644 --- a/src/profiling/test/TimelineModel.hpp +++ b/src/profiling/test/TimelineModel.hpp @@ -12,10 +12,10 @@ #include <sstream> #include <vector> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { using LabelMap = std::map<uint64_t, arm::pipe::ITimelineDecoder::Label>; using Attribute = std::pair<std::string, std::string>; @@ -184,6 +184,6 @@ std::string GetConnectionDescription(const Connection& connection); std::string GetExecutionDescription(Entity* execution); std::string GetEventDescription(EventObj* event); -} // namespace profiling +} // namespace pipe -} // namespace armnn
\ No newline at end of file +} // namespace arm
\ No newline at end of file diff --git a/src/profiling/test/TimelinePacketTests.cpp b/src/profiling/test/TimelinePacketTests.cpp index 379988a9dc..de791c1da0 100644 --- a/src/profiling/test/TimelinePacketTests.cpp +++ b/src/profiling/test/TimelinePacketTests.cpp @@ -12,7 +12,7 @@ #include <doctest/doctest.h> -using namespace armnn::profiling; +using namespace arm::pipe; TEST_SUITE("TimelinePacketTests") { @@ -204,7 +204,7 @@ TEST_CASE("TimelineRelationshipPacketInvalidRelationTest") buffer.data(), armnn::numeric_cast<unsigned int>(buffer.size()), numberOfBytesWritten), - armnn::InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK(numberOfBytesWritten == 0); } @@ -527,7 +527,7 @@ TEST_CASE("TimelineMessageDirectoryPacketTestFullConstruction") // Check the ui_name std::vector<uint32_t> swTraceString; - arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>(label, swTraceString); + StringToSwTraceString<SwTraceCharPolicy>(label, swTraceString); offset += (armnn::numeric_cast<unsigned int>(swTraceString.size()) - 1) * uint32_t_size; uint32_t swTraceUINameLength = ReadUint32(buffer.data(), offset); CHECK(swTraceUINameLength == 14); // ui_name length including the null-terminator @@ -539,7 +539,7 @@ TEST_CASE("TimelineMessageDirectoryPacketTestFullConstruction") swTraceUINameLength - 1) == 0); // The length of the label // Check arg_types - arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>(label, swTraceString); + StringToSwTraceString<SwTraceCharPolicy>(label, swTraceString); offset += (armnn::numeric_cast<unsigned int>(swTraceString.size()) - 1) * uint32_t_size; uint32_t swTraceArgTypesLength = ReadUint32(buffer.data(), offset); CHECK(swTraceArgTypesLength == 3); // arg_types length including the null-terminator @@ -551,7 +551,7 @@ TEST_CASE("TimelineMessageDirectoryPacketTestFullConstruction") swTraceArgTypesLength - 1) == 0); // The length of the label // Check arg_names - arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>(label, swTraceString); + StringToSwTraceString<SwTraceCharPolicy>(label, swTraceString); offset += (armnn::numeric_cast<unsigned int>(swTraceString.size()) - 1) * uint32_t_size; uint32_t swTraceArgNamesLength = ReadUint32(buffer.data(), offset); CHECK(swTraceArgNamesLength == 11); // arg_names length including the null-terminator @@ -563,7 +563,7 @@ TEST_CASE("TimelineMessageDirectoryPacketTestFullConstruction") swTraceArgNamesLength - 1) == 0); // The length of the label // Check second message decl_id - arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>(label, swTraceString); + StringToSwTraceString<SwTraceCharPolicy>(label, swTraceString); offset += (armnn::numeric_cast<unsigned int>(swTraceString.size()) - 1) * uint32_t_size; readDeclId = ReadUint32(buffer.data(), offset); CHECK(readDeclId == 1); diff --git a/src/profiling/test/TimelineUtilityMethodsTests.cpp b/src/profiling/test/TimelineUtilityMethodsTests.cpp index 47e1182a3d..b0b7bff517 100644 --- a/src/profiling/test/TimelineUtilityMethodsTests.cpp +++ b/src/profiling/test/TimelineUtilityMethodsTests.cpp @@ -17,7 +17,7 @@ #include <doctest/doctest.h> using namespace armnn; -using namespace armnn::profiling; +using namespace arm::pipe; TEST_SUITE("TimelineUtilityMethodsTests") { @@ -214,20 +214,20 @@ TEST_CASE("CreateNamedTypedChildEntityTest") profilingService.NextGuid(); CHECK_THROWS_AS(timelineUtilityMethods.CreateNamedTypedChildEntity(parentEntityGuid, "", entityType), - InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK_THROWS_AS(timelineUtilityMethods.CreateNamedTypedChildEntity(parentEntityGuid, entityName, ""), - InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK_THROWS_AS(timelineUtilityMethods.CreateNamedTypedChildEntity( - childEntityGuid, parentEntityGuid, "", entityType), InvalidArgumentException); + childEntityGuid, parentEntityGuid, "", entityType), arm::pipe::InvalidArgumentException); CHECK_THROWS_AS(timelineUtilityMethods.CreateNamedTypedChildEntity( - childEntityGuid, parentEntityGuid, entityName, ""), InvalidArgumentException); + childEntityGuid, parentEntityGuid, entityName, ""), arm::pipe::InvalidArgumentException); CHECK_NOTHROW(childEntityGuid = timelineUtilityMethods.CreateNamedTypedChildEntity(parentEntityGuid, entityName, entityType)); CHECK(childEntityGuid != ProfilingGuid(0)); - // Commit all packets at once + // Commit all packets at onceTimelineUtilityMethodsTests.cpp timelineUtilityMethods.Commit(); // Get the readable buffer @@ -296,7 +296,7 @@ TEST_CASE("DeclareLabelTest") profilingService.NextGuid(); // Try declaring an invalid (empty) label - CHECK_THROWS_AS(timelineUtilityMethods.DeclareLabel(""), InvalidArgumentException); + CHECK_THROWS_AS(timelineUtilityMethods.DeclareLabel(""), arm::pipe::InvalidArgumentException); // Try declaring an invalid (wrong SWTrace format) label CHECK_THROWS_AS(timelineUtilityMethods.DeclareLabel("inv@lid lab€l"), RuntimeException); @@ -322,20 +322,20 @@ TEST_CASE("CreateNameTypeEntityInvalidTest") TimelineUtilityMethods timelineUtilityMethods(sendTimelinePacket); // Invalid name - CHECK_THROWS_AS(timelineUtilityMethods.CreateNamedTypedEntity("", "Type"), InvalidArgumentException); + CHECK_THROWS_AS(timelineUtilityMethods.CreateNamedTypedEntity("", "Type"), arm::pipe::InvalidArgumentException); // Invalid type - CHECK_THROWS_AS(timelineUtilityMethods.CreateNamedTypedEntity("Name", ""), InvalidArgumentException); + CHECK_THROWS_AS(timelineUtilityMethods.CreateNamedTypedEntity("Name", ""), arm::pipe::InvalidArgumentException); ProfilingDynamicGuid guid = profilingService.NextGuid(); // CreatedNamedTypedEntity with Guid - Invalid name CHECK_THROWS_AS(timelineUtilityMethods.CreateNamedTypedEntity(guid, "", "Type"), - InvalidArgumentException); + arm::pipe::InvalidArgumentException); // CreatedNamedTypedEntity with Guid - Invalid type CHECK_THROWS_AS(timelineUtilityMethods.CreateNamedTypedEntity(guid, "Name", ""), - InvalidArgumentException); + arm::pipe::InvalidArgumentException); } diff --git a/tests/ExecuteNetwork/ExecuteNetwork.cpp b/tests/ExecuteNetwork/ExecuteNetwork.cpp index 92a2946847..b5b8d8561c 100644 --- a/tests/ExecuteNetwork/ExecuteNetwork.cpp +++ b/tests/ExecuteNetwork/ExecuteNetwork.cpp @@ -92,7 +92,7 @@ int TfLiteDelegateMainImpl(const ExecuteNetworkParams& params, const armnn::IRun // Populate a DelegateOptions from the ExecuteNetworkParams. armnnDelegate::DelegateOptions delegateOptions = params.ToDelegateOptions(); delegateOptions.SetExternalProfilingParams( - ConvertExternalProfilingOptions(runtimeOptions.m_ProfilingOptions)); + arm::pipe::ConvertExternalProfilingOptions(runtimeOptions.m_ProfilingOptions)); std::unique_ptr<TfLiteDelegate, decltype(&armnnDelegate::TfLiteArmnnDelegateDelete)> theArmnnDelegate(armnnDelegate::TfLiteArmnnDelegateCreate(delegateOptions), diff --git a/tests/profiling/gatordmock/GatordMockService.hpp b/tests/profiling/gatordmock/GatordMockService.hpp index 30c5444f4e..d8623bba16 100644 --- a/tests/profiling/gatordmock/GatordMockService.hpp +++ b/tests/profiling/gatordmock/GatordMockService.hpp @@ -120,7 +120,7 @@ public: /// Execute the WAIT command from the comamnd file. void WaitCommand(uint32_t timeout); - profiling::DirectoryCaptureCommandHandler& GetDirectoryCaptureCommandHandler() + arm::pipe::DirectoryCaptureCommandHandler& GetDirectoryCaptureCommandHandler() { return m_DirectoryCaptureCommandHandler; } @@ -155,7 +155,7 @@ private: gatordmock::StreamMetadataCommandHandler m_StreamMetadataCommandHandler; gatordmock::StubCommandHandler m_StubCommandHandler; - profiling::DirectoryCaptureCommandHandler m_DirectoryCaptureCommandHandler; + arm::pipe::DirectoryCaptureCommandHandler m_DirectoryCaptureCommandHandler; arm::pipe::TimelineCaptureCommandHandler m_TimelineCaptureCommandHandler; arm::pipe::TimelineDirectoryCaptureCommandHandler m_TimelineDirectoryCaptureCommandHandler; diff --git a/tests/profiling/gatordmock/tests/GatordMockTests.cpp b/tests/profiling/gatordmock/tests/GatordMockTests.cpp index f76b2939cd..1556058ed3 100644 --- a/tests/profiling/gatordmock/tests/GatordMockTests.cpp +++ b/tests/profiling/gatordmock/tests/GatordMockTests.cpp @@ -64,25 +64,25 @@ TEST_CASE("CounterCaptureHandlingTest") // Offset index to point to mem address uint32_t offset = 0; - profiling::WriteUint64(data1, offset, time); + arm::pipe::WriteUint64(data1, offset, time); offset += sizeOfUint64; for (const auto& pair : indexValuePairs) { - profiling::WriteUint16(data1, offset, pair.first); + arm::pipe::WriteUint16(data1, offset, pair.first); offset += sizeOfUint16; - profiling::WriteUint32(data1, offset, pair.second); + arm::pipe::WriteUint32(data1, offset, pair.second); offset += sizeOfUint32; } offset = 0; - profiling::WriteUint64(data2, offset, time2); + arm::pipe::WriteUint64(data2, offset, time2); offset += sizeOfUint64; for (const auto& pair : indexValuePairs) { - profiling::WriteUint16(data2, offset, pair.first); + arm::pipe::WriteUint16(data2, offset, pair.first); offset += sizeOfUint16; - profiling::WriteUint32(data2, offset, pair.second); + arm::pipe::WriteUint32(data2, offset, pair.second); offset += sizeOfUint32; } @@ -126,10 +126,10 @@ void CheckTimelineDirectory(arm::pipe::TimelineDirectoryCaptureCommandHandler& c uint32_t uint64_t_size = sizeof(uint64_t); uint32_t threadId_size = sizeof(int); - profiling::BufferManager bufferManager(5); - profiling::TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager); + arm::pipe::BufferManager bufferManager(5); + arm::pipe::TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager); - std::unique_ptr<profiling::ISendTimelinePacket> sendTimelinePacket = + std::unique_ptr<arm::pipe::ISendTimelinePacket> sendTimelinePacket = timelinePacketWriterFactory.GetSendTimelinePacket(); sendTimelinePacket->SendTimelineMessageDirectoryPackage(); @@ -139,7 +139,7 @@ void CheckTimelineDirectory(arm::pipe::TimelineDirectoryCaptureCommandHandler& c unsigned int offset = uint32_t_size * 2; - std::unique_ptr<profiling::IPacketBuffer> packetBuffer = bufferManager.GetReadableBuffer(); + std::unique_ptr<arm::pipe::IPacketBuffer> packetBuffer = bufferManager.GetReadableBuffer(); uint8_t readStreamVersion = ReadUint8(packetBuffer, offset); CHECK(readStreamVersion == 4); @@ -151,7 +151,7 @@ void CheckTimelineDirectory(arm::pipe::TimelineDirectoryCaptureCommandHandler& c CHECK(readThreadIdBytes == threadId_size); offset += uint8_t_size; - uint32_t declarationSize = profiling::ReadUint32(packetBuffer, offset); + uint32_t declarationSize = arm::pipe::ReadUint32(packetBuffer, offset); offset += uint32_t_size; for(uint32_t i = 0; i < declarationSize; ++i) { @@ -187,53 +187,53 @@ void CheckTimelinePackets(arm::pipe::TimelineDecoder& timelineDecoder) { unsigned int i = 0; // Use a postfix increment to avoid changing indexes each time the packet gets updated. timelineDecoder.ApplyToModel([&](arm::pipe::TimelineDecoder::Model& m) { - CHECK(m.m_Labels[i].m_Guid == profiling::LabelsAndEventClasses::NAME_GUID); - CHECK(m.m_Labels[i++].m_Name == profiling::LabelsAndEventClasses::NAME_LABEL); + CHECK(m.m_Labels[i].m_Guid == arm::pipe::LabelsAndEventClasses::NAME_GUID); + CHECK(m.m_Labels[i++].m_Name == arm::pipe::LabelsAndEventClasses::NAME_LABEL); - CHECK(m.m_Labels[i].m_Guid == profiling::LabelsAndEventClasses::TYPE_GUID); - CHECK(m.m_Labels[i++].m_Name == profiling::LabelsAndEventClasses::TYPE_LABEL); + CHECK(m.m_Labels[i].m_Guid == arm::pipe::LabelsAndEventClasses::TYPE_GUID); + CHECK(m.m_Labels[i++].m_Name == arm::pipe::LabelsAndEventClasses::TYPE_LABEL); - CHECK(m.m_Labels[i].m_Guid == profiling::LabelsAndEventClasses::INDEX_GUID); - CHECK(m.m_Labels[i++].m_Name == profiling::LabelsAndEventClasses::INDEX_LABEL); + CHECK(m.m_Labels[i].m_Guid == arm::pipe::LabelsAndEventClasses::INDEX_GUID); + CHECK(m.m_Labels[i++].m_Name == arm::pipe::LabelsAndEventClasses::INDEX_LABEL); - CHECK(m.m_Labels[i].m_Guid == profiling::LabelsAndEventClasses::BACKENDID_GUID); - CHECK(m.m_Labels[i++].m_Name == profiling::LabelsAndEventClasses::BACKENDID_LABEL); + CHECK(m.m_Labels[i].m_Guid == arm::pipe::LabelsAndEventClasses::BACKENDID_GUID); + CHECK(m.m_Labels[i++].m_Name == arm::pipe::LabelsAndEventClasses::BACKENDID_LABEL); - CHECK(m.m_Labels[i].m_Guid == profiling::LabelsAndEventClasses::CHILD_GUID); - CHECK(m.m_Labels[i++].m_Name == profiling::LabelsAndEventClasses::CHILD_LABEL); + CHECK(m.m_Labels[i].m_Guid == arm::pipe::LabelsAndEventClasses::CHILD_GUID); + CHECK(m.m_Labels[i++].m_Name == arm::pipe::LabelsAndEventClasses::CHILD_LABEL); - CHECK(m.m_Labels[i].m_Guid == profiling::LabelsAndEventClasses::EXECUTION_OF_GUID); + CHECK(m.m_Labels[i].m_Guid == arm::pipe::LabelsAndEventClasses::EXECUTION_OF_GUID); CHECK(m.m_Labels[i++].m_Name == - profiling::LabelsAndEventClasses::EXECUTION_OF_LABEL); + arm::pipe::LabelsAndEventClasses::EXECUTION_OF_LABEL); - CHECK(m.m_Labels[i].m_Guid == profiling::LabelsAndEventClasses::PROCESS_ID_GUID); + CHECK(m.m_Labels[i].m_Guid == arm::pipe::LabelsAndEventClasses::PROCESS_ID_GUID); CHECK(m.m_Labels[i++].m_Name == - profiling::LabelsAndEventClasses::PROCESS_ID_LABEL); + arm::pipe::LabelsAndEventClasses::PROCESS_ID_LABEL); - CHECK(m.m_Labels[i].m_Guid == profiling::LabelsAndEventClasses::LAYER_GUID); - CHECK(m.m_Labels[i++].m_Name == profiling::LabelsAndEventClasses::LAYER); + CHECK(m.m_Labels[i].m_Guid == arm::pipe::LabelsAndEventClasses::LAYER_GUID); + CHECK(m.m_Labels[i++].m_Name == arm::pipe::LabelsAndEventClasses::LAYER); - CHECK(m.m_Labels[i].m_Guid == profiling::LabelsAndEventClasses::WORKLOAD_GUID); - CHECK(m.m_Labels[i++].m_Name == profiling::LabelsAndEventClasses::WORKLOAD); + CHECK(m.m_Labels[i].m_Guid == arm::pipe::LabelsAndEventClasses::WORKLOAD_GUID); + CHECK(m.m_Labels[i++].m_Name == arm::pipe::LabelsAndEventClasses::WORKLOAD); - CHECK(m.m_Labels[i].m_Guid == profiling::LabelsAndEventClasses::NETWORK_GUID); - CHECK(m.m_Labels[i++].m_Name == profiling::LabelsAndEventClasses::NETWORK); + CHECK(m.m_Labels[i].m_Guid == arm::pipe::LabelsAndEventClasses::NETWORK_GUID); + CHECK(m.m_Labels[i++].m_Name == arm::pipe::LabelsAndEventClasses::NETWORK); - CHECK(m.m_Labels[i].m_Guid == profiling::LabelsAndEventClasses::CONNECTION_GUID); - CHECK(m.m_Labels[i++].m_Name == profiling::LabelsAndEventClasses::CONNECTION); + CHECK(m.m_Labels[i].m_Guid == arm::pipe::LabelsAndEventClasses::CONNECTION_GUID); + CHECK(m.m_Labels[i++].m_Name == arm::pipe::LabelsAndEventClasses::CONNECTION); - CHECK(m.m_Labels[i].m_Guid == profiling::LabelsAndEventClasses::INFERENCE_GUID); - CHECK(m.m_Labels[i++].m_Name == profiling::LabelsAndEventClasses::INFERENCE); + CHECK(m.m_Labels[i].m_Guid == arm::pipe::LabelsAndEventClasses::INFERENCE_GUID); + CHECK(m.m_Labels[i++].m_Name == arm::pipe::LabelsAndEventClasses::INFERENCE); CHECK(m.m_Labels[i].m_Guid == - profiling::LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID); + arm::pipe::LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID); CHECK(m.m_Labels[i++].m_Name == - profiling::LabelsAndEventClasses::WORKLOAD_EXECUTION); + arm::pipe::LabelsAndEventClasses::WORKLOAD_EXECUTION); CHECK(m.m_EventClasses[0].m_Guid == - profiling::LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS); + arm::pipe::LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS); CHECK(m.m_EventClasses[1].m_Guid == - profiling::LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS); + arm::pipe::LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS); }); } @@ -250,17 +250,17 @@ TEST_CASE("GatorDMockEndToEnd") arm::pipe::ConnectionHandler connectionHandler(udsNamespace, false); // Enable the profiling service. - armnn::profiling::ProfilingOptions options; + arm::pipe::ProfilingOptions options; options.m_EnableProfiling = true; options.m_TimelineEnabled = true; - armnn::profiling::ProfilingService profilingService; + arm::pipe::ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); // Bring the profiling service to the "WaitingForAck" state - CHECK(profilingService.GetCurrentState() == profiling::ProfilingState::Uninitialised); + CHECK(profilingService.GetCurrentState() == arm::pipe::ProfilingState::Uninitialised); profilingService.Update(); - CHECK(profilingService.GetCurrentState() == profiling::ProfilingState::NotConnected); + CHECK(profilingService.GetCurrentState() == arm::pipe::ProfilingState::NotConnected); profilingService.Update(); // Connect the profiling service @@ -270,11 +270,11 @@ TEST_CASE("GatorDMockEndToEnd") gatordmock::GatordMockService mockService(std::move(basePipeServer), false); arm::pipe::TimelineDecoder& timelineDecoder = mockService.GetTimelineDecoder(); - profiling::DirectoryCaptureCommandHandler& directoryCaptureCommandHandler = + arm::pipe::DirectoryCaptureCommandHandler& directoryCaptureCommandHandler = mockService.GetDirectoryCaptureCommandHandler(); // Give the profiling service sending thread time start executing and send the stream metadata. - WaitFor([&](){return profilingService.GetCurrentState() == profiling::ProfilingState::WaitingForAck;}, + WaitFor([&](){return profilingService.GetCurrentState() == arm::pipe::ProfilingState::WaitingForAck;}, "Profiling service did not switch to WaitingForAck state"); profilingService.Update(); @@ -288,7 +288,7 @@ TEST_CASE("GatorDMockEndToEnd") // And start to listen for packets mockService.LaunchReceivingThread(); - WaitFor([&](){return profilingService.GetCurrentState() == profiling::ProfilingState::Active;}, + WaitFor([&](){return profilingService.GetCurrentState() == arm::pipe::ProfilingState::Active;}, "Profiling service did not switch to Active state"); // As part of the default startup of the profiling service a counter directory packet will be sent. @@ -304,8 +304,8 @@ TEST_CASE("GatorDMockEndToEnd") // Verify the commonly used timeline packets sent when the profiling service enters the active state CheckTimelinePackets(timelineDecoder); - const profiling::ICounterDirectory& serviceCounterDirectory = profilingService.GetCounterDirectory(); - const profiling::ICounterDirectory& receivedCounterDirectory = directoryCaptureCommandHandler.GetCounterDirectory(); + const arm::pipe::ICounterDirectory& serviceCounterDirectory = profilingService.GetCounterDirectory(); + const arm::pipe::ICounterDirectory& receivedCounterDirectory = directoryCaptureCommandHandler.GetCounterDirectory(); // Compare the basics of the counter directory from the service and the one we received over the wire. CHECK(serviceCounterDirectory.GetDeviceCount() == receivedCounterDirectory.GetDeviceCount()); @@ -316,7 +316,7 @@ TEST_CASE("GatorDMockEndToEnd") receivedCounterDirectory.GetDeviceCount(); serviceCounterDirectory.GetDeviceCount(); - const profiling::Devices& serviceDevices = serviceCounterDirectory.GetDevices(); + const arm::pipe::Devices& serviceDevices = serviceCounterDirectory.GetDevices(); for (auto& device : serviceDevices) { // Find the same device in the received counter directory. @@ -326,7 +326,7 @@ TEST_CASE("GatorDMockEndToEnd") CHECK(device.second->m_Cores == (*foundDevice).second->m_Cores); } - const profiling::CounterSets& serviceCounterSets = serviceCounterDirectory.GetCounterSets(); + const arm::pipe::CounterSets& serviceCounterSets = serviceCounterDirectory.GetCounterSets(); for (auto& counterSet : serviceCounterSets) { // Find the same counter set in the received counter directory. @@ -336,7 +336,7 @@ TEST_CASE("GatorDMockEndToEnd") CHECK(counterSet.second->m_Count == (*foundCounterSet).second->m_Count); } - const profiling::Categories& serviceCategories = serviceCounterDirectory.GetCategories(); + const arm::pipe::Categories& serviceCategories = serviceCounterDirectory.GetCategories(); for (auto& category : serviceCategories) { for (auto& receivedCategory : receivedCounterDirectory.GetCategories()) @@ -366,13 +366,13 @@ TEST_CASE("GatorDMockEndToEnd") } // Finally check the content of the counters. - const profiling::Counters& receivedCounters = receivedCounterDirectory.GetCounters(); + const arm::pipe::Counters& receivedCounters = receivedCounterDirectory.GetCounters(); for (auto& receivedCounter : receivedCounters) { // Translate the Uid and find the corresponding counter in the original counter directory. // Note we can't check m_MaxCounterUid here as it will likely differ between the two counter directories. uint16_t translated = directoryCaptureCommandHandler.TranslateUIDCopyToOriginal(receivedCounter.first); - const profiling::Counter* serviceCounter = serviceCounterDirectory.GetCounter(translated); + const arm::pipe::Counter* serviceCounter = serviceCounterDirectory.GetCounter(translated); CHECK(serviceCounter->m_DeviceUid == receivedCounter.second->m_DeviceUid); CHECK(serviceCounter->m_Name.compare(receivedCounter.second->m_Name) == 0); CHECK(serviceCounter->m_CounterSetUid == receivedCounter.second->m_CounterSetUid); |