aboutsummaryrefslogtreecommitdiff
path: root/include/armnn/BackendId.hpp
diff options
context:
space:
mode:
authorMatteo Martincigh <matteo.martincigh@arm.com>2019-01-10 17:34:20 +0000
committerMatteo Martincigh <matteo.martincigh@arm.com>2019-01-11 12:20:47 +0000
commit992d6dc57d8463729910b688f0fb5825d0d3ccf2 (patch)
tree87b504d174848169550240f300f359dd57aaa1fd /include/armnn/BackendId.hpp
parent1f0ff35236c1dd05954735f7fed9c2807770479e (diff)
downloadarmnn-992d6dc57d8463729910b688f0fb5825d0d3ccf2.tar.gz
IVGCVSW-2454 Refactor ArmNN to support pluggable backends from a separate
code base * Made the virtual functions in ILayerSupport.hpp pure * Created a LayerSupportBase class with the default implementation of the interface * Made the backend layer support classes inherit from the base class, instead of directly from the interface * Refactored the profiler and the profiling event classes to use the BackendId instead of the Compute * Implemented a proper MemCopy support method * Changed Compute to BackendId in the profiling API and objects * Removed static references to pluggable backends !android-nn-driver:492 Change-Id: Id6332b5f48c980819e0a09adc818d1effd057296
Diffstat (limited to 'include/armnn/BackendId.hpp')
-rw-r--r--include/armnn/BackendId.hpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/include/armnn/BackendId.hpp b/include/armnn/BackendId.hpp
index 8de985ec2f..87206073be 100644
--- a/include/armnn/BackendId.hpp
+++ b/include/armnn/BackendId.hpp
@@ -20,13 +20,13 @@ namespace armnn
//
enum class Compute
{
+ Undefined = 0,
/// CPU Execution: Reference C++ kernels
- CpuRef = 0,
+ CpuRef = 1,
/// CPU Execution: NEON: ArmCompute
- CpuAcc = 1,
+ CpuAcc = 2,
/// GPU Execution: OpenCL: ArmCompute
- GpuAcc = 2,
- Undefined = 5
+ GpuAcc = 3
};
/// Deprecated function that will be removed together with
@@ -46,7 +46,8 @@ constexpr char const* GetComputeDeviceAsCString(Compute compute)
/// the Compute enum
inline std::ostream& operator<<(std::ostream& os, const std::vector<Compute>& compute)
{
- for (const Compute& comp : compute) {
+ for (const Compute& comp : compute)
+ {
os << GetComputeDeviceAsCString(comp) << " ";
}
return os;
@@ -56,7 +57,8 @@ inline std::ostream& operator<<(std::ostream& os, const std::vector<Compute>& co
/// the Compute enum
inline std::ostream& operator<<(std::ostream& os, const std::set<Compute>& compute)
{
- for (const Compute& comp : compute) {
+ for (const Compute& comp : compute)
+ {
os << GetComputeDeviceAsCString(comp) << " ";
}
return os;
@@ -70,13 +72,10 @@ inline std::ostream& operator<<(std::ostream& os, const Compute& compute)
return os;
}
-struct UninitializedBackendId {};
-
class BackendId final
{
public:
- BackendId() { GetComputeDeviceAsCString(Compute::Undefined); }
- BackendId(UninitializedBackendId) { GetComputeDeviceAsCString(Compute::Undefined); }
+ BackendId() : m_Id(GetComputeDeviceAsCString(Compute::Undefined)) {}
BackendId(const std::string& id) : m_Id{id} {}
BackendId(const char* id) : m_Id{id} {}
@@ -132,7 +131,7 @@ private:
std::string m_Id;
};
-}
+} // namespace armnn
namespace std
{
@@ -163,7 +162,7 @@ inline std::ostream& operator<<(std::ostream& os, const BackendId& id)
template <template <typename...> class TContainer, typename... TContainerTemplateArgs>
std::ostream& operator<<(std::ostream& os,
- const TContainer<BackendId, TContainerTemplateArgs...>& ids)
+ const TContainer<BackendId, TContainerTemplateArgs...>& ids)
{
os << '[';
for (const auto& id : ids) { os << id << " "; }