From 5aa9fd7ac6bf8dad576fa4a0a32aa3dae98d11ab Mon Sep 17 00:00:00 2001 From: Cathal Corbett Date: Fri, 25 Feb 2022 15:33:28 +0000 Subject: IVGCVSW-6704 Change the namespace from armnn::profiling to arm::pipe * Updated ABI version to 29 due to being the first ABI break in 22.05 !android-nn-driver:7226 Signed-off-by: Cathal Corbett Change-Id: I9c50007dcd5b5e792757e7bd1213606df5ffec36 --- .../common/include/IProfilingGuidGenerator.hpp | 8 ++-- profiling/common/include/LabelsAndEventClasses.hpp | 8 ++-- profiling/common/include/ProfilingGuid.hpp | 22 +++++---- .../common/include/ProfilingGuidGenerator.hpp | 8 ++-- profiling/common/include/TargetEndianess.hpp | 12 +++++ profiling/common/src/LabelsAndEventClasses.cpp | 8 ++-- .../include/basePipeServer/BasePipeServer.hpp | 7 +-- .../basePipeServer/tests/BasePipeServerTests.cpp | 8 ++-- .../src/timelineDecoder/tests/TimelineTests.cpp | 52 +++++++++++----------- 9 files changed, 69 insertions(+), 64 deletions(-) create mode 100644 profiling/common/include/TargetEndianess.hpp (limited to 'profiling') 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 -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 #include -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 +struct hash { - 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(guid)); } @@ -92,9 +90,9 @@ struct hash /// make ProfilingDynamicGuid hashable template <> -struct hash +struct hash { - 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(guid)); } @@ -102,9 +100,9 @@ struct hash /// make ProfilingStaticGuid hashable template <> -struct hash +struct hash { - 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(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 #include -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 #include #include +#include #include #include @@ -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 sendTimelinePacket = + std::unique_ptr sendTimelinePacket = timelinePacketWriterFactory.GetSendTimelinePacket(); arm::pipe::PacketVersionResolver packetVersionResolver; @@ -97,7 +97,7 @@ TEST_CASE("TimelineDirectoryTest") unsigned int offset = uint32_t_size * 2; - std::unique_ptr packetBuffer = bufferManager.GetReadableBuffer(); + std::unique_ptr 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 sendTimelinePacket = + std::unique_ptr 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 sendTimelinePacket = + std::unique_ptr 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, -- cgit v1.2.1