aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCathal Corbett <cathal.corbett@arm.com>2022-03-04 12:11:09 +0000
committerCathal Corbett <cathal.corbett@arm.com>2022-03-04 12:11:09 +0000
commit6f073727ad98d94f43a3938ddeac3f5a231ad959 (patch)
treed691d5f28846d66729cd0b4c52761d4d9a90305f
parentae91a5e058da31e912c0768f516b2ef013c3b39e (diff)
downloadarmnn-6f073727ad98d94f43a3938ddeac3f5a231ad959.tar.gz
IVGCVSW-6814 Remove references to armnn:BackendId in the profiling code
Signed-off-by: Cathal Corbett <cathal.corbett@arm.com> Change-Id: Ib399a5eee9e52882800ec3e02e4173424a7c19b1
-rw-r--r--src/backends/backendsCommon/test/BackendProfilingTests.cpp14
-rw-r--r--src/profiling/ConnectionAcknowledgedCommandHandler.cpp2
-rw-r--r--src/profiling/ConnectionAcknowledgedCommandHandler.hpp2
-rw-r--r--src/profiling/CounterDirectory.cpp7
-rw-r--r--src/profiling/CounterDirectory.hpp2
-rw-r--r--src/profiling/CounterIdMap.cpp11
-rw-r--r--src/profiling/CounterIdMap.hpp17
-rw-r--r--src/profiling/Holder.cpp7
-rw-r--r--src/profiling/Holder.hpp10
-rw-r--r--src/profiling/ICounterDirectory.hpp5
-rw-r--r--src/profiling/ICounterRegistry.hpp3
-rw-r--r--src/profiling/IProfilingService.hpp2
-rw-r--r--src/profiling/PeriodicCounterCapture.cpp4
-rw-r--r--src/profiling/PeriodicCounterCapture.hpp8
-rw-r--r--src/profiling/PeriodicCounterSelectionCommandHandler.cpp14
-rw-r--r--src/profiling/PeriodicCounterSelectionCommandHandler.hpp14
-rw-r--r--src/profiling/ProfilingService.cpp5
-rw-r--r--src/profiling/ProfilingService.hpp6
-rw-r--r--src/profiling/RegisterBackendCounters.hpp4
-rw-r--r--src/profiling/backends/BackendProfiling.cpp2
-rw-r--r--src/profiling/backends/BackendProfiling.hpp4
-rw-r--r--src/profiling/test/ProfilingMocks.hpp4
-rw-r--r--src/profiling/test/ProfilingTestUtils.hpp1
-rw-r--r--src/profiling/test/ProfilingTests.cpp28
24 files changed, 83 insertions, 93 deletions
diff --git a/src/backends/backendsCommon/test/BackendProfilingTests.cpp b/src/backends/backendsCommon/test/BackendProfilingTests.cpp
index 3651696fd3..d262abca1b 100644
--- a/src/backends/backendsCommon/test/BackendProfilingTests.cpp
+++ b/src/backends/backendsCommon/test/BackendProfilingTests.cpp
@@ -155,8 +155,8 @@ TEST_CASE("TestBackendCounters")
CounterIdMap counterIdMap;
MockBackendSendCounterPacket sendCounterPacket;
- const armnn::BackendId cpuAccId(armnn::Compute::CpuAcc);
- const armnn::BackendId gpuAccId(armnn::Compute::GpuAcc);
+ const std::string cpuAccId(GetComputeDeviceAsCString(armnn::Compute::CpuAcc));
+ const std::string gpuAccId(GetComputeDeviceAsCString(armnn::Compute::GpuAcc));
ProfilingOptions options;
options.m_EnableProfiling = true;
@@ -173,7 +173,7 @@ TEST_CASE("TestBackendCounters")
std::shared_ptr<IBackendProfilingContext> gpuProfilingContextPtr =
std::make_shared<armnn::MockBackendProfilingContext>(gpuBackendProfilingPtr);
- std::unordered_map<armnn::BackendId,
+ std::unordered_map<std::string,
std::shared_ptr<IBackendProfilingContext>> backendProfilingContexts;
backendProfilingContexts[cpuAccId] = cpuProfilingContextPtr;
@@ -222,7 +222,7 @@ TEST_CASE("TestBackendCounters")
periodicCounterSelectionCommandHandler(PacketWriter(period, gpuCounters));
periodicCounterCapture.Stop();
- std::set<armnn::BackendId> activeIds = holder.GetCaptureData().GetActiveBackends();
+ std::set<std::string> activeIds = holder.GetCaptureData().GetActiveBackends();
CHECK(activeIds.size() == 1);
CHECK((activeIds.find(gpuAccId) != activeIds.end()));
@@ -403,8 +403,8 @@ TEST_CASE("TestBackendCounterLogging")
CounterIdMap counterIdMap;
MockBackendSendCounterPacket sendCounterPacket;
- const armnn::BackendId cpuAccId(armnn::Compute::CpuAcc);
- const armnn::BackendId gpuAccId(armnn::Compute::GpuAcc);
+ const std::string cpuAccId(GetComputeDeviceAsCString(armnn::Compute::CpuAcc));
+ const std::string gpuAccId(GetComputeDeviceAsCString(armnn::Compute::GpuAcc));
ProfilingOptions options;
options.m_EnableProfiling = true;
@@ -417,7 +417,7 @@ TEST_CASE("TestBackendCounterLogging")
std::shared_ptr<IBackendProfilingContext> cpuProfilingContextPtr =
std::make_shared<armnn::MockBackendProfilingContext>(cpuBackendProfilingPtr);
- std::unordered_map<armnn::BackendId,
+ std::unordered_map<std::string,
std::shared_ptr<IBackendProfilingContext>> backendProfilingContexts;
uint16_t globalId = 5;
diff --git a/src/profiling/ConnectionAcknowledgedCommandHandler.cpp b/src/profiling/ConnectionAcknowledgedCommandHandler.cpp
index 63ca741374..a3dabd53f5 100644
--- a/src/profiling/ConnectionAcknowledgedCommandHandler.cpp
+++ b/src/profiling/ConnectionAcknowledgedCommandHandler.cpp
@@ -55,7 +55,7 @@ void ConnectionAcknowledgedCommandHandler::operator()(const arm::pipe::Packet& p
if(!backendContext.second->EnableProfiling(true))
{
throw armnn::BackendProfilingException(
- "Unable to enable profiling on Backend Id: " + backendContext.first.Get());
+ "Unable to enable profiling on Backend Id: " + backendContext.first);
}
}
}
diff --git a/src/profiling/ConnectionAcknowledgedCommandHandler.hpp b/src/profiling/ConnectionAcknowledgedCommandHandler.hpp
index 5bb3c95cf5..9ea3bd4059 100644
--- a/src/profiling/ConnectionAcknowledgedCommandHandler.hpp
+++ b/src/profiling/ConnectionAcknowledgedCommandHandler.hpp
@@ -23,7 +23,7 @@ namespace pipe
class ConnectionAcknowledgedCommandHandler final : public arm::pipe::CommandHandlerFunctor
{
-typedef const std::unordered_map<armnn::BackendId, std::shared_ptr<IBackendProfilingContext>>&
+typedef const std::unordered_map<std::string, std::shared_ptr<IBackendProfilingContext>>&
BackendProfilingContexts;
public:
diff --git a/src/profiling/CounterDirectory.cpp b/src/profiling/CounterDirectory.cpp
index 5a7d8c6165..ba4ca1cc35 100644
--- a/src/profiling/CounterDirectory.cpp
+++ b/src/profiling/CounterDirectory.cpp
@@ -6,9 +6,8 @@
#include "CounterDirectory.hpp"
#include "ProfilingUtils.hpp"
-#include <armnn/Exceptions.hpp>
+#include <armnn/BackendId.hpp>
#include <armnn/utility/Assert.hpp>
-#include <armnn/utility/IgnoreUnused.hpp>
#include <common/include/SwTrace.hpp>
@@ -178,7 +177,7 @@ const CounterSet* CounterDirectory::RegisterCounterSet(const std::string& counte
return counterSetPtr;
}
-const Counter* CounterDirectory::RegisterCounter(const armnn::BackendId& backendId,
+const Counter* CounterDirectory::RegisterCounter(const std::string& /*backendId*/,
const uint16_t uid,
const std::string& parentCategoryName,
uint16_t counterClass,
@@ -191,8 +190,6 @@ const Counter* CounterDirectory::RegisterCounter(const armnn::BackendId& backend
const armnn::Optional<uint16_t>& deviceUid,
const armnn::Optional<uint16_t>& counterSetUid)
{
- IgnoreUnused(backendId);
-
// Check that the given parent category name is valid
if (parentCategoryName.empty() ||
!arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>(parentCategoryName))
diff --git a/src/profiling/CounterDirectory.hpp b/src/profiling/CounterDirectory.hpp
index ee9b52e8cd..4438042caf 100644
--- a/src/profiling/CounterDirectory.hpp
+++ b/src/profiling/CounterDirectory.hpp
@@ -36,7 +36,7 @@ public:
uint16_t count = 0,
const armnn::Optional<std::string>& parentCategoryName
= armnn::EmptyOptional()) override;
- const Counter* RegisterCounter(const armnn::BackendId& backendId,
+ const Counter* RegisterCounter(const std::string& backendId,
const uint16_t uid,
const std::string& parentCategoryName,
uint16_t counterClass,
diff --git a/src/profiling/CounterIdMap.cpp b/src/profiling/CounterIdMap.cpp
index bb575705ed..bff8e0660e 100644
--- a/src/profiling/CounterIdMap.cpp
+++ b/src/profiling/CounterIdMap.cpp
@@ -3,7 +3,6 @@
// SPDX-License-Identifier: MIT
//
#include "CounterIdMap.hpp"
-#include "armnn/BackendId.hpp"
#include <armnn/Exceptions.hpp>
#include <map>
@@ -14,9 +13,9 @@ namespace pipe
void CounterIdMap::RegisterMapping(uint16_t globalCounterId,
uint16_t backendCounterId,
- const armnn::BackendId& backendId)
+ const std::string& backendId)
{
- std::pair<uint16_t, armnn::BackendId> backendIdPair(backendCounterId, backendId);
+ std::pair<uint16_t, std::string> backendIdPair(backendCounterId, backendId);
m_GlobalCounterIdMap[globalCounterId] = backendIdPair;
m_BackendCounterIdMap[backendIdPair] = globalCounterId;
}
@@ -27,9 +26,9 @@ void CounterIdMap::Reset()
m_BackendCounterIdMap.clear();
}
-uint16_t CounterIdMap::GetGlobalId(uint16_t backendCounterId, const armnn::BackendId& backendId) const
+uint16_t CounterIdMap::GetGlobalId(uint16_t backendCounterId, const std::string& backendId) const
{
- std::pair<uint16_t, armnn::BackendId> backendIdPair(backendCounterId, backendId);
+ std::pair<uint16_t, std::string> backendIdPair(backendCounterId, backendId);
auto it = m_BackendCounterIdMap.find(backendIdPair);
if (it == m_BackendCounterIdMap.end())
{
@@ -40,7 +39,7 @@ uint16_t CounterIdMap::GetGlobalId(uint16_t backendCounterId, const armnn::Backe
return it->second;
}
-const std::pair<uint16_t, armnn::BackendId>& CounterIdMap::GetBackendId(uint16_t globalCounterId) const
+const std::pair<uint16_t, std::string>& CounterIdMap::GetBackendId(uint16_t globalCounterId) const
{
auto it = m_GlobalCounterIdMap.find(globalCounterId);
if (it == m_GlobalCounterIdMap.end())
diff --git a/src/profiling/CounterIdMap.hpp b/src/profiling/CounterIdMap.hpp
index 7a3c3614ee..38955943aa 100644
--- a/src/profiling/CounterIdMap.hpp
+++ b/src/profiling/CounterIdMap.hpp
@@ -4,7 +4,6 @@
//
#pragma once
-#include "armnn/BackendId.hpp"
#include <map>
namespace arm
@@ -15,8 +14,8 @@ namespace pipe
class ICounterMappings
{
public:
- virtual uint16_t GetGlobalId(uint16_t backendCounterId, const armnn::BackendId& backendId) const = 0;
- virtual const std::pair<uint16_t, armnn::BackendId>& GetBackendId(uint16_t globalCounterId) const = 0;
+ virtual uint16_t GetGlobalId(uint16_t backendCounterId, const std::string& backendId) const = 0;
+ virtual const std::pair<uint16_t, std::string>& GetBackendId(uint16_t globalCounterId) const = 0;
virtual ~ICounterMappings() {}
};
@@ -25,7 +24,7 @@ class IRegisterCounterMapping
public:
virtual void RegisterMapping(uint16_t globalCounterId,
uint16_t backendCounterId,
- const armnn::BackendId& backendId) = 0;
+ const std::string& backendId) = 0;
virtual void Reset() = 0;
virtual ~IRegisterCounterMapping() {}
};
@@ -38,13 +37,13 @@ public:
virtual ~CounterIdMap() {}
void RegisterMapping(uint16_t globalCounterId,
uint16_t backendCounterId,
- const armnn::BackendId& backendId) override;
+ const std::string& backendId) override;
void Reset() override;
- uint16_t GetGlobalId(uint16_t backendCounterId, const armnn::BackendId& backendId) const override;
- const std::pair<uint16_t, armnn::BackendId>& GetBackendId(uint16_t globalCounterId) const override;
+ uint16_t GetGlobalId(uint16_t backendCounterId, const std::string& backendId) const override;
+ const std::pair<uint16_t, std::string>& GetBackendId(uint16_t globalCounterId) const override;
private:
- std::map<uint16_t, std::pair<uint16_t, armnn::BackendId>> m_GlobalCounterIdMap;
- std::map<std::pair<uint16_t, armnn::BackendId>, uint16_t> m_BackendCounterIdMap;
+ std::map<uint16_t, std::pair<uint16_t, std::string>> m_GlobalCounterIdMap;
+ std::map<std::pair<uint16_t, std::string>, uint16_t> m_BackendCounterIdMap;
};
} // namespace pipe
diff --git a/src/profiling/Holder.cpp b/src/profiling/Holder.cpp
index 06600807f0..6517a24900 100644
--- a/src/profiling/Holder.cpp
+++ b/src/profiling/Holder.cpp
@@ -3,7 +3,6 @@
// SPDX-License-Identifier: MIT
//
-#include <armnn/BackendId.hpp>
#include "Holder.hpp"
namespace arm
@@ -21,7 +20,7 @@ CaptureData& CaptureData::operator=(const CaptureData& other)
return *this;
}
-void CaptureData::SetActiveBackends(const std::set<armnn::BackendId>& activeBackends)
+void CaptureData::SetActiveBackends(const std::set<std::string>& activeBackends)
{
m_ActiveBackends = activeBackends;
}
@@ -36,7 +35,7 @@ void CaptureData::SetCounterIds(const std::vector<uint16_t>& counterIds)
m_CounterIds = counterIds;
}
-const std::set<armnn::BackendId>& CaptureData::GetActiveBackends() const
+const std::set<std::string>& CaptureData::GetActiveBackends() const
{
return m_ActiveBackends;
}
@@ -73,7 +72,7 @@ bool CaptureData::IsCounterIdInCaptureData(uint16_t counterId)
void Holder::SetCaptureData(uint32_t capturePeriod,
const std::vector<uint16_t>& counterIds,
- const std::set<armnn::BackendId>& activeBackends)
+ const std::set<std::string>& activeBackends)
{
std::lock_guard<std::mutex> lockGuard(m_CaptureThreadMutex);
diff --git a/src/profiling/Holder.hpp b/src/profiling/Holder.hpp
index 612f8dc02e..10d393ff9b 100644
--- a/src/profiling/Holder.hpp
+++ b/src/profiling/Holder.hpp
@@ -23,7 +23,7 @@ public:
: m_CapturePeriod(0)
, m_CounterIds()
, m_ActiveBackends(){}
- CaptureData(uint32_t capturePeriod, std::vector<uint16_t>& counterIds, std::set<armnn::BackendId> activeBackends)
+ CaptureData(uint32_t capturePeriod, std::vector<uint16_t>& counterIds, std::set<std::string> activeBackends)
: m_CapturePeriod(capturePeriod)
, m_CounterIds(counterIds)
, m_ActiveBackends(activeBackends){}
@@ -34,18 +34,18 @@ public:
CaptureData& operator=(const CaptureData& other);
- void SetActiveBackends(const std::set<armnn::BackendId>& activeBackends);
+ void SetActiveBackends(const std::set<std::string>& activeBackends);
void SetCapturePeriod(uint32_t capturePeriod);
void SetCounterIds(const std::vector<uint16_t>& counterIds);
uint32_t GetCapturePeriod() const;
const std::vector<uint16_t>& GetCounterIds() const;
- const std::set<armnn::BackendId>& GetActiveBackends() const;
+ const std::set<std::string>& GetActiveBackends() const;
bool IsCounterIdInCaptureData(uint16_t counterId);
private:
uint32_t m_CapturePeriod;
std::vector<uint16_t> m_CounterIds;
- std::set<armnn::BackendId> m_ActiveBackends;
+ std::set<std::string> m_ActiveBackends;
};
class Holder
@@ -56,7 +56,7 @@ public:
CaptureData GetCaptureData() const;
void SetCaptureData(uint32_t capturePeriod,
const std::vector<uint16_t>& counterIds,
- const std::set<armnn::BackendId>& activeBackends);
+ const std::set<std::string>& activeBackends);
private:
mutable std::mutex m_CaptureThreadMutex;
diff --git a/src/profiling/ICounterDirectory.hpp b/src/profiling/ICounterDirectory.hpp
index f902f9160b..b6b513a51f 100644
--- a/src/profiling/ICounterDirectory.hpp
+++ b/src/profiling/ICounterDirectory.hpp
@@ -5,7 +5,6 @@
#pragma once
-#include <armnn/BackendId.hpp>
#include <string>
#include <vector>
@@ -94,7 +93,7 @@ class Counter final
{
public:
// Constructors
- Counter(armnn::BackendId backendId,
+ Counter(const std::string& backendId,
uint16_t counterUid,
uint16_t maxCounterUid,
uint16_t counterClass,
@@ -119,7 +118,7 @@ public:
{}
// Fields
- armnn::BackendId m_BackendId;
+ std::string m_BackendId;
uint16_t m_Uid;
uint16_t m_MaxCounterUid;
uint16_t m_Class;
diff --git a/src/profiling/ICounterRegistry.hpp b/src/profiling/ICounterRegistry.hpp
index 1d257b82db..9e04f605a1 100644
--- a/src/profiling/ICounterRegistry.hpp
+++ b/src/profiling/ICounterRegistry.hpp
@@ -6,7 +6,6 @@
#pragma once
#include <armnn/Optional.hpp>
-#include <armnn/BackendId.hpp>
namespace arm
{
@@ -30,7 +29,7 @@ public:
uint16_t count,
const armnn::Optional<std::string>& parentCategoryName) = 0;
- virtual const Counter* RegisterCounter(const armnn::BackendId& backendId,
+ virtual const Counter* RegisterCounter(const std::string& backendId,
const uint16_t uid,
const std::string& parentCategoryName,
uint16_t counterClass,
diff --git a/src/profiling/IProfilingService.hpp b/src/profiling/IProfilingService.hpp
index 31d9b8d1e3..b91952249b 100644
--- a/src/profiling/IProfilingService.hpp
+++ b/src/profiling/IProfilingService.hpp
@@ -46,7 +46,7 @@ public:
virtual ProfilingState ConfigureProfilingService(const ProfilingOptions& options,
bool resetProfilingService = false) = 0;
// Store a profiling context returned from a backend that support profiling.
- virtual void AddBackendProfilingContext(const armnn::BackendId backendId,
+ virtual void AddBackendProfilingContext(const std::string& backendId,
std::shared_ptr<IBackendProfilingContext> profilingContext) = 0;
virtual ICounterRegistry& GetCounterRegistry() = 0;
virtual IRegisterCounterMapping& GetCounterMappingRegistry() = 0;
diff --git a/src/profiling/PeriodicCounterCapture.cpp b/src/profiling/PeriodicCounterCapture.cpp
index 11ad6511fe..dd6d394d62 100644
--- a/src/profiling/PeriodicCounterCapture.cpp
+++ b/src/profiling/PeriodicCounterCapture.cpp
@@ -56,7 +56,7 @@ CaptureData PeriodicCounterCapture::ReadCaptureData()
}
void PeriodicCounterCapture::DispatchPeriodicCounterCapturePacket(
- const armnn::BackendId& backendId, const std::vector<Timestamp>& timestampValues)
+ const std::string& backendId, const std::vector<Timestamp>& timestampValues)
{
// Report counter values
for (const auto& timestampInfo : timestampValues)
@@ -122,7 +122,7 @@ void PeriodicCounterCapture::Capture(IReadCounterValues& readCounterValues)
// Report counter values for each active backend
auto activeBackends = currentCaptureData.GetActiveBackends();
- for_each(activeBackends.begin(), activeBackends.end(), [&](const armnn::BackendId& backendId)
+ for_each(activeBackends.begin(), activeBackends.end(), [&](const std::string& backendId)
{
DispatchPeriodicCounterCapturePacket(
backendId, m_BackendProfilingContexts.at(backendId)->ReportCounterValues());
diff --git a/src/profiling/PeriodicCounterCapture.hpp b/src/profiling/PeriodicCounterCapture.hpp
index c442f425d4..9a678a85ab 100644
--- a/src/profiling/PeriodicCounterCapture.hpp
+++ b/src/profiling/PeriodicCounterCapture.hpp
@@ -32,8 +32,8 @@ public:
ISendCounterPacket& packet,
IReadCounterValues& readCounterValue,
const ICounterMappings& counterIdMap,
- const std::unordered_map<armnn::BackendId,
- std::shared_ptr<IBackendProfilingContext>>& backendProfilingContexts)
+ const std::unordered_map<std::string,
+ std::shared_ptr<IBackendProfilingContext>>& backendProfilingContexts)
: m_CaptureDataHolder(data)
, m_IsRunning(false)
, m_KeepRunning(false)
@@ -52,7 +52,7 @@ private:
CaptureData ReadCaptureData();
void Capture(IReadCounterValues& readCounterValues);
void DispatchPeriodicCounterCapturePacket(
- const armnn::BackendId& backendId, const std::vector<Timestamp>& timestampValues);
+ const std::string& backendId, const std::vector<Timestamp>& timestampValues);
const Holder& m_CaptureDataHolder;
bool m_IsRunning;
@@ -61,7 +61,7 @@ private:
IReadCounterValues& m_ReadCounterValues;
ISendCounterPacket& m_SendCounterPacket;
const ICounterMappings& m_CounterIdMap;
- const std::unordered_map<armnn::BackendId,
+ const std::unordered_map<std::string,
std::shared_ptr<IBackendProfilingContext>>& m_BackendProfilingContexts;
};
diff --git a/src/profiling/PeriodicCounterSelectionCommandHandler.cpp b/src/profiling/PeriodicCounterSelectionCommandHandler.cpp
index ae2aa0b94c..49928bf222 100644
--- a/src/profiling/PeriodicCounterSelectionCommandHandler.cpp
+++ b/src/profiling/PeriodicCounterSelectionCommandHandler.cpp
@@ -113,7 +113,7 @@ void PeriodicCounterSelectionCommandHandler::operator()(const arm::pipe::Packet&
return counterId > m_MaxArmCounterId;
});
- std::set<armnn::BackendId> activeBackends;
+ std::set<std::string> activeBackends;
std::set<uint16_t> backendCounterIds = std::set<uint16_t>(backendIdStart, validCounterIds.end());
if (m_BackendCounterMap.size() != 0)
@@ -166,13 +166,13 @@ void PeriodicCounterSelectionCommandHandler::operator()(const arm::pipe::Packet&
}
}
-std::set<armnn::BackendId> PeriodicCounterSelectionCommandHandler::ProcessBackendCounterIds(
+std::set<std::string> PeriodicCounterSelectionCommandHandler::ProcessBackendCounterIds(
const uint32_t capturePeriod,
const std::set<uint16_t> newCounterIds,
const std::set<uint16_t> unusedCounterIds)
{
- std::set<armnn::BackendId> changedBackends;
- std::set<armnn::BackendId> activeBackends = m_CaptureDataHolder.GetCaptureData().GetActiveBackends();
+ std::set<std::string> changedBackends;
+ std::set<std::string> activeBackends = m_CaptureDataHolder.GetCaptureData().GetActiveBackends();
for (uint16_t counterId : newCounterIds)
{
@@ -195,7 +195,7 @@ std::set<armnn::BackendId> PeriodicCounterSelectionCommandHandler::ProcessBacken
// If a backend has no counters associated with it we remove it from active backends and
// send a capture period of zero with an empty vector, this will deactivate all the backends counters
activeBackends.erase(backendId.second);
- ActivateBackedCounters(backendId.second, 0, {});
+ ActivateBackendCounters(backendId.second, 0, {});
}
else
{
@@ -208,7 +208,7 @@ std::set<armnn::BackendId> PeriodicCounterSelectionCommandHandler::ProcessBacken
{
for (auto backend : changedBackends)
{
- ActivateBackedCounters(backend, capturePeriod, m_BackendCounterMap[backend]);
+ ActivateBackendCounters(backend, capturePeriod, m_BackendCounterMap[backend]);
}
}
// Otherwise update all the backends with the new capture period and any new/unused counters
@@ -216,7 +216,7 @@ std::set<armnn::BackendId> PeriodicCounterSelectionCommandHandler::ProcessBacken
{
for (auto backend : m_BackendCounterMap)
{
- ActivateBackedCounters(backend.first, capturePeriod, backend.second);
+ ActivateBackendCounters(backend.first, capturePeriod, backend.second);
}
if(capturePeriod == 0)
{
diff --git a/src/profiling/PeriodicCounterSelectionCommandHandler.hpp b/src/profiling/PeriodicCounterSelectionCommandHandler.hpp
index e8cdf0e5aa..4d94ba1010 100644
--- a/src/profiling/PeriodicCounterSelectionCommandHandler.hpp
+++ b/src/profiling/PeriodicCounterSelectionCommandHandler.hpp
@@ -35,7 +35,7 @@ public:
PeriodicCounterSelectionCommandHandler(uint32_t familyId,
uint32_t packetId,
uint32_t version,
- const std::unordered_map<armnn::BackendId,
+ const std::unordered_map<std::string,
std::shared_ptr<IBackendProfilingContext>>&
backendProfilingContexts,
const ICounterMappings& counterIdMap,
@@ -64,8 +64,8 @@ public:
private:
- std::unordered_map<armnn::BackendId, std::vector<uint16_t>> m_BackendCounterMap;
- const std::unordered_map<armnn::BackendId,
+ std::unordered_map<std::string, std::vector<uint16_t>> m_BackendCounterMap;
+ const std::unordered_map<std::string,
std::shared_ptr<IBackendProfilingContext>>& m_BackendProfilingContexts;
const ICounterMappings& m_CounterIdMap;
Holder& m_CaptureDataHolder;
@@ -77,9 +77,9 @@ private:
ISendCounterPacket& m_SendCounterPacket;
const ProfilingStateMachine& m_StateMachine;
- void ActivateBackedCounters(const armnn::BackendId backendId,
- const uint32_t capturePeriod,
- const std::vector<uint16_t> counterIds)
+ void ActivateBackendCounters(const std::string backendId,
+ const uint32_t capturePeriod,
+ const std::vector<uint16_t> counterIds)
{
armnn::Optional<std::string> errorMsg =
m_BackendProfilingContexts.at(backendId)->ActivateCounters(capturePeriod, counterIds);
@@ -91,7 +91,7 @@ private:
}
}
void ParseData(const arm::pipe::Packet& packet, CaptureData& captureData);
- std::set<armnn::BackendId> ProcessBackendCounterIds(const uint32_t capturePeriod,
+ std::set<std::string> ProcessBackendCounterIds(const uint32_t capturePeriod,
const std::set<uint16_t> newCounterIds,
const std::set<uint16_t> unusedCounterIds);
diff --git a/src/profiling/ProfilingService.cpp b/src/profiling/ProfilingService.cpp
index 2e67dc870d..eba70e1c96 100644
--- a/src/profiling/ProfilingService.cpp
+++ b/src/profiling/ProfilingService.cpp
@@ -5,7 +5,6 @@
#include "ProfilingService.hpp"
-#include <armnn/BackendId.hpp>
#include <armnn/Logging.hpp>
#include <armnn/utility/NumericCast.hpp>
@@ -194,7 +193,7 @@ void ProfilingService::Disconnect()
}
// Store a profiling context returned from a backend that support profiling, and register its counters
-void ProfilingService::AddBackendProfilingContext(const armnn::BackendId backendId,
+void ProfilingService::AddBackendProfilingContext(const std::string& backendId,
std::shared_ptr<IBackendProfilingContext> profilingContext)
{
ARMNN_ASSERT(profilingContext != nullptr);
@@ -262,7 +261,7 @@ CaptureData ProfilingService::GetCaptureData()
void ProfilingService::SetCaptureData(uint32_t capturePeriod,
const std::vector<uint16_t>& counterIds,
- const std::set<armnn::BackendId>& activeBackends)
+ const std::set<std::string>& activeBackends)
{
m_Holder.SetCaptureData(capturePeriod, counterIds, activeBackends);
}
diff --git a/src/profiling/ProfilingService.hpp b/src/profiling/ProfilingService.hpp
index a4b02c10ad..7919c3019a 100644
--- a/src/profiling/ProfilingService.hpp
+++ b/src/profiling/ProfilingService.hpp
@@ -47,7 +47,7 @@ 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<armnn::BackendId,
+ using BackendProfilingContext = std::unordered_map<std::string,
std::shared_ptr<IBackendProfilingContext>>;
ProfilingService(armnn::Optional<IReportStructure&> reportStructure = armnn::EmptyOptional())
@@ -154,7 +154,7 @@ public:
void Disconnect();
// Store a profiling context returned from a backend that support profiling.
- void AddBackendProfilingContext(const armnn::BackendId backendId,
+ void AddBackendProfilingContext(const std::string& backendId,
std::shared_ptr<IBackendProfilingContext> profilingContext) override;
// Enable the recording of timeline events and entities
@@ -177,7 +177,7 @@ public:
CaptureData GetCaptureData() override;
void SetCaptureData(uint32_t capturePeriod,
const std::vector<uint16_t>& counterIds,
- const std::set<armnn::BackendId>& activeBackends);
+ const std::set<std::string>& activeBackends);
// Setters for the profiling service state
void SetCounterValue(uint16_t counterUid, uint32_t value) override;
diff --git a/src/profiling/RegisterBackendCounters.hpp b/src/profiling/RegisterBackendCounters.hpp
index 34f9f3a3eb..88234df273 100644
--- a/src/profiling/RegisterBackendCounters.hpp
+++ b/src/profiling/RegisterBackendCounters.hpp
@@ -21,7 +21,7 @@ class RegisterBackendCounters : public IRegisterBackendCounters
public:
RegisterBackendCounters(
- uint16_t currentMaxGlobalCounterID, const armnn::BackendId& backendId, IProfilingService& profilingService)
+ uint16_t currentMaxGlobalCounterID, const std::string& backendId, IProfilingService& profilingService)
: m_CurrentMaxGlobalCounterID(currentMaxGlobalCounterID),
m_BackendId(backendId),
m_ProfilingService(profilingService),
@@ -54,7 +54,7 @@ public:
private:
uint16_t m_CurrentMaxGlobalCounterID;
- const armnn::BackendId& m_BackendId;
+ const std::string& m_BackendId;
IProfilingService& m_ProfilingService;
ICounterRegistry& m_CounterDirectory;
};
diff --git a/src/profiling/backends/BackendProfiling.cpp b/src/profiling/backends/BackendProfiling.cpp
index 6c0f9b1b5c..e29316ee3b 100644
--- a/src/profiling/backends/BackendProfiling.cpp
+++ b/src/profiling/backends/BackendProfiling.cpp
@@ -73,7 +73,7 @@ std::vector<CounterStatus> BackendProfiling::GetActiveCounters()
for (auto globalCounterId : globalCounterIds) {
// Get pair of local counterId and backendId using globalCounterId
- const std::pair<uint16_t, armnn::BackendId>& backendCounterIdPair =
+ const std::pair<uint16_t, std::string>& backendCounterIdPair =
m_ProfilingService.GetCounterMappings().GetBackendId(globalCounterId);
if (backendCounterIdPair.second == m_BackendId)
{
diff --git a/src/profiling/backends/BackendProfiling.hpp b/src/profiling/backends/BackendProfiling.hpp
index 545234db56..bedda5d763 100644
--- a/src/profiling/backends/BackendProfiling.hpp
+++ b/src/profiling/backends/BackendProfiling.hpp
@@ -19,7 +19,7 @@ class BackendProfiling : public IBackendProfiling
public:
BackendProfiling(const ProfilingOptions& options,
IProfilingService& profilingService,
- const armnn::BackendId& backendId)
+ const std::string& backendId)
: m_Options(options),
m_ProfilingService(profilingService),
m_BackendId(backendId) {}
@@ -45,7 +45,7 @@ public:
private:
ProfilingOptions m_Options;
IProfilingService& m_ProfilingService;
- armnn::BackendId m_BackendId;
+ std::string m_BackendId;
};
} // namespace pipe
diff --git a/src/profiling/test/ProfilingMocks.hpp b/src/profiling/test/ProfilingMocks.hpp
index 5e7d31a914..93145031ea 100644
--- a/src/profiling/test/ProfilingMocks.hpp
+++ b/src/profiling/test/ProfilingMocks.hpp
@@ -505,7 +505,7 @@ public:
return counterSetPtr;
}
- const Counter* RegisterCounter(const armnn::BackendId& backendId,
+ const Counter* RegisterCounter(const std::string& backendId,
const uint16_t uid,
const std::string& parentCategoryName,
uint16_t counterClass,
@@ -676,7 +676,7 @@ public:
void RegisterMapping(uint16_t globalCounterId,
uint16_t backendCounterId,
- const armnn::BackendId& backendId)
+ const std::string& backendId)
{
m_CounterMapping.RegisterMapping(globalCounterId, backendCounterId, backendId);
}
diff --git a/src/profiling/test/ProfilingTestUtils.hpp b/src/profiling/test/ProfilingTestUtils.hpp
index 16c6dde4ea..32a156ee42 100644
--- a/src/profiling/test/ProfilingTestUtils.hpp
+++ b/src/profiling/test/ProfilingTestUtils.hpp
@@ -8,7 +8,6 @@
#include "ProfilingUtils.hpp"
#include "Runtime.hpp"
-#include <armnn/BackendId.hpp>
#include <armnn/Optional.hpp>
#include <BufferManager.hpp>
#include <ProfilingService.hpp>
diff --git a/src/profiling/test/ProfilingTests.cpp b/src/profiling/test/ProfilingTests.cpp
index cba6ebd475..0a98af2817 100644
--- a/src/profiling/test/ProfilingTests.cpp
+++ b/src/profiling/test/ProfilingTests.cpp
@@ -1786,7 +1786,7 @@ TEST_CASE("CounterSelectionCommandHandlerParseData")
const uint32_t packetId = 0x40000;
uint32_t version = 1;
- const std::unordered_map<armnn::BackendId,
+ const std::unordered_map<std::string,
std::shared_ptr<IBackendProfilingContext>> backendProfilingContext;
CounterIdMap counterIdMap;
Holder holder;
@@ -2342,7 +2342,7 @@ TEST_CASE("CheckPeriodicCounterCaptureThread")
ProfilingStateMachine profilingStateMachine;
- const std::unordered_map<armnn::BackendId,
+ const std::unordered_map<std::string,
std::shared_ptr<IBackendProfilingContext>> backendProfilingContext;
CounterIdMap counterIdMap;
Holder data;
@@ -3382,8 +3382,8 @@ TEST_CASE("CheckCounterIdMap")
uint16_t globalCounterIds = 0;
- armnn::BackendId cpuRefId(armnn::Compute::CpuRef);
- armnn::BackendId cpuAccId(armnn::Compute::CpuAcc);
+ std::string cpuRefId(GetComputeDeviceAsCString(armnn::Compute::CpuRef));
+ std::string cpuAccId(GetComputeDeviceAsCString(armnn::Compute::CpuAcc));
std::vector<uint16_t> cpuRefCounters = {0, 1, 2, 3};
std::vector<uint16_t> cpuAccCounters = {0, 1};
@@ -3399,12 +3399,12 @@ TEST_CASE("CheckCounterIdMap")
++globalCounterIds;
}
- CHECK(counterIdMap.GetBackendId(0) == (std::pair<uint16_t, armnn::BackendId>(0, cpuRefId)));
- CHECK(counterIdMap.GetBackendId(1) == (std::pair<uint16_t, armnn::BackendId>(1, cpuRefId)));
- CHECK(counterIdMap.GetBackendId(2) == (std::pair<uint16_t, armnn::BackendId>(2, cpuRefId)));
- CHECK(counterIdMap.GetBackendId(3) == (std::pair<uint16_t, armnn::BackendId>(3, cpuRefId)));
- CHECK(counterIdMap.GetBackendId(4) == (std::pair<uint16_t, armnn::BackendId>(0, cpuAccId)));
- CHECK(counterIdMap.GetBackendId(5) == (std::pair<uint16_t, armnn::BackendId>(1, cpuAccId)));
+ CHECK(counterIdMap.GetBackendId(0) == (std::pair<uint16_t, std::string>(0, cpuRefId)));
+ CHECK(counterIdMap.GetBackendId(1) == (std::pair<uint16_t, std::string>(1, cpuRefId)));
+ CHECK(counterIdMap.GetBackendId(2) == (std::pair<uint16_t, std::string>(2, cpuRefId)));
+ CHECK(counterIdMap.GetBackendId(3) == (std::pair<uint16_t, std::string>(3, cpuRefId)));
+ CHECK(counterIdMap.GetBackendId(4) == (std::pair<uint16_t, std::string>(0, cpuAccId)));
+ CHECK(counterIdMap.GetBackendId(5) == (std::pair<uint16_t, std::string>(1, cpuAccId)));
CHECK(counterIdMap.GetGlobalId(0, cpuRefId) == 0);
CHECK(counterIdMap.GetGlobalId(1, cpuRefId) == 1);
@@ -3417,7 +3417,7 @@ TEST_CASE("CheckCounterIdMap")
TEST_CASE("CheckRegisterBackendCounters")
{
uint16_t globalCounterIds = INFERENCES_RUN;
- armnn::BackendId cpuRefId(armnn::Compute::CpuRef);
+ std::string cpuRefId(GetComputeDeviceAsCString(armnn::Compute::CpuRef));
// Reset the profiling service to the uninitialized state
ProfilingOptions options;
@@ -3474,8 +3474,8 @@ TEST_CASE("CheckCounterStatusQuery")
ProfilingService profilingService;
profilingService.ResetExternalProfilingOptions(options, true);
- const armnn::BackendId cpuRefId(armnn::Compute::CpuRef);
- const armnn::BackendId cpuAccId(armnn::Compute::CpuAcc);
+ const std::string cpuRefId(GetComputeDeviceAsCString(armnn::Compute::CpuRef));
+ const std::string cpuAccId(GetComputeDeviceAsCString(armnn::Compute::CpuAcc));
// Create BackendProfiling for each backend
BackendProfiling backendProfilingCpuRef(options, profilingService, cpuRefId);
@@ -3610,7 +3610,7 @@ TEST_CASE("CheckRegisterCounters")
CaptureData captureData;
MockProfilingService mockProfilingService(mockBuffer, options.m_EnableProfiling, captureData);
- armnn::BackendId cpuRefId(armnn::Compute::CpuRef);
+ std::string cpuRefId(GetComputeDeviceAsCString(armnn::Compute::CpuRef));
mockProfilingService.RegisterMapping(6, 0, cpuRefId);
mockProfilingService.RegisterMapping(7, 1, cpuRefId);