class IBackendInternal : public IBackend
{
protected:
- IBackendInternal() {}
- virtual ~IBackendInternal() {}
+ IBackendInternal() = default;
+ ~IBackendInternal() override = default;
public:
virtual std::unique_ptr<IWorkloadFactory> CreateWorkloadFactory() const = 0;
//
#include "ClBackend.hpp"
+#include <backends/BackendRegistry.hpp>
+#include <boost/cast.hpp>
namespace armnn
{
-const std::string ClBackend::s_Id = "arm_compute_cl";
+namespace
+{
+static const std::string s_Id = "GpuAcc";
+
+static BackendRegistry::Helper g_RegisterHelper{
+ s_Id,
+ []()
+ {
+ return IBackendUniquePtr(new ClBackend, &ClBackend::Destroy);
+ }
+};
+
+}
const std::string& ClBackend::GetId() const
{
std::unique_ptr<IWorkloadFactory> ClBackend::CreateWorkloadFactory() const
{
- // TODO implement
return nullptr;
}
+void ClBackend::Destroy(IBackend* backend)
+{
+ delete boost::polymorphic_downcast<ClBackend*>(backend);
+}
+
} // namespace armnn
\ No newline at end of file
//
#pragma once
-#include "backends/IBackendInternal.hpp"
-
+#include <backends/IBackendInternal.hpp>
#include "ClLayerSupport.hpp"
namespace armnn
std::unique_ptr<IWorkloadFactory> CreateWorkloadFactory() const override;
-private:
- static const std::string s_Id;
+ static void Destroy(IBackend* backend);
- // TODO initialize
+private:
ClLayerSupport m_LayerSupport;
};
//
#include "NeonBackend.hpp"
+#include <backends/BackendRegistry.hpp>
+#include <boost/cast.hpp>
namespace armnn
{
-const std::string NeonBackend::s_Id = "arm_compute_neon";
+namespace
+{
+
+static const std::string s_Id = "CpuAcc";
+
+static BackendRegistry::Helper g_RegisterHelper{
+ s_Id,
+ []()
+ {
+ return IBackendUniquePtr(new NeonBackend, &NeonBackend::Destroy);
+ }
+};
+
+}
const std::string& NeonBackend::GetId() const
{
std::unique_ptr<IWorkloadFactory> NeonBackend::CreateWorkloadFactory() const
{
- // TODO implement
return nullptr;
}
+void NeonBackend::Destroy(IBackend* backend)
+{
+ delete boost::polymorphic_downcast<NeonBackend*>(backend);
+}
+
} // namespace armnn
\ No newline at end of file
//
#pragma once
-#include "backends/IBackendInternal.hpp"
-
+#include <backends/IBackendInternal.hpp>
#include "NeonLayerSupport.hpp"
namespace armnn
std::unique_ptr<IWorkloadFactory> CreateWorkloadFactory() const override;
-private:
- static const std::string s_Id;
+ static void Destroy(IBackend* backend);
- // TODO initialize
+private:
NeonLayerSupport m_LayerSupport;
};
//
#include "RefBackend.hpp"
+#include <backends/BackendRegistry.hpp>
+#include <boost/cast.hpp>
namespace armnn
{
-const std::string RefBackend::s_Id = "arm_reference";
+namespace
+{
+const std::string s_Id = "CpuRef";
+
+static BackendRegistry::Helper s_RegisterHelper{
+ s_Id,
+ []()
+ {
+ return IBackendUniquePtr(new RefBackend, &RefBackend::Destroy);
+ }
+};
+
+}
const std::string& RefBackend::GetId() const
{
std::unique_ptr<IWorkloadFactory> RefBackend::CreateWorkloadFactory() const
{
- // TODO implement
return nullptr;
}
+void RefBackend::Destroy(IBackend* backend)
+{
+ delete boost::polymorphic_downcast<RefBackend*>(backend);
+}
+
} // namespace armnn
\ No newline at end of file
//
#pragma once
-#include "backends/IBackendInternal.hpp"
-
+#include <backends/IBackendInternal.hpp>
#include "RefLayerSupport.hpp"
namespace armnn
std::unique_ptr<IWorkloadFactory> CreateWorkloadFactory() const override;
-private:
- static const std::string s_Id;
+ static void Destroy(IBackend* backend);
- // TODO initialize
+private:
RefLayerSupport m_LayerSupport;
};