44 return IsLayerSupported(&layer);
52 const std::string layerName(layer->
GetName());
53 bool optimizable = layerName.find(
"unoptimizable") == std::string::npos;
60 return IsLayerOptimizable(&layer);
85 std::cerr <<
"could not deregister mock backend" << std::endl;
98 return IWorkloadFactoryPtr{};
110 std::shared_ptr<armnn::MockBackendProfilingContext> context =
111 std::make_shared<MockBackendProfilingContext>(backendProfiling);
139 std::for_each(subgraphLayers.begin(),
140 subgraphLayers.end(),
143 bool supported = IsLayerSupported(PolymorphicDowncast<Layer*>(layer));
147 bool optimizable = IsLayerOptimizable(PolymorphicDowncast<Layer*>(layer));
151 supportedLayers.push_back(layer);
156 untouchedLayers.push_back(layer);
162 unsupportedLayers.push_back(layer);
167 if (!supportedLayers.empty())
170 auto supportedSubgraphSelector = [](
const Layer& layer)
174 IsLayerSupported(layer) &&
175 IsLayerOptimizable(layer);
184 std::for_each(supportedSubgraphs.begin(),
185 supportedSubgraphs.end(),
194 optimizationViews.
GetINetwork()->AddPrecompiledLayer(
196 supportedSubgraph->GetNumOutputSlots()),
204 optimizationViews.
AddSubstitution({ substitutionSubgraph, replacementSubgraph });
209 if (!unsupportedLayers.empty())
212 auto unsupportedSubgraphSelector = [](
const Layer& layer)
216 !IsLayerSupported(layer);
225 std::for_each(unsupportedSubgraphs.begin(),
226 unsupportedSubgraphs.end(),
236 if (!untouchedLayers.empty())
239 auto untouchedSubgraphSelector = [](
const Layer& layer)
243 IsLayerSupported(layer) &&
244 !IsLayerOptimizable(layer);
253 std::for_each(untouchedSubgraphs.begin(),
254 untouchedSubgraphs.end(),
263 return optimizationViews;
268 return std::make_unique<DefaultAllocator>();
std::unique_ptr< IWorkloadFactory > IWorkloadFactoryPtr
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
void SetProfilingContextPtr(std::shared_ptr< MockBackendProfilingContext > shared)
constexpr const char * MockBackendId()
void Register(const BackendId &id, FactoryFunction factory)
const IConnectableLayers & GetIConnectableLayers() const
~MockBackendInitialiser()
IBackendInternal::IWorkloadFactoryPtr CreateWorkloadFactory(const IBackendInternal::IMemoryManagerSharedPtr &memoryManager=nullptr) const override
IBackendInternal::ILayerSupportSharedPtr GetLayerSupport() const override
void AddSubstitution(SubstitutionPair &&substitution)
IBackendInternal::IBackendContextPtr CreateBackendContext(const IRuntime::CreationOptions &) const override
Create the runtime context of the backend.
BackendRegistry & BackendRegistryInstance()
OptimizationViews OptimizeSubgraphView(const SubgraphView &subgraph) const override
Copyright (c) 2021 ARM Limited and Contributors.
std::unique_ptr< IMemoryManager > IMemoryManagerUniquePtr
void IgnoreUnused(Ts &&...)
std::unique_ptr< void, CompiledBlobDeleter > CompiledBlobPtr
The SubgraphView class represents a subgraph of a Graph.
std::unique_ptr< armnn::profiling::IBackendProfiling > IBackendProfilingPtr
std::unique_ptr< SubgraphView > SubgraphViewPtr
std::list< IConnectableLayer * > IConnectableLayers
std::unique_ptr< ICustomAllocator > GetDefaultAllocator() const override
Returns the default memory allocator for the backend.
std::shared_ptr< IMemoryManager > IMemoryManagerSharedPtr
static const BackendId & GetIdStatic()
void AddFailedSubgraph(SubgraphView &&subgraph)
LayerType GetType() const override
Returns the armnn::LayerType of this layer.
std::vector< SubgraphViewPtr > Subgraphs
INetworkPtr & GetINetwork()
#define ARMNN_ASSERT(COND)
static MockBackendProfilingService & Instance()
void AddUntouchedSubgraph(SubgraphView &&subgraph)
IBackendInternal::IBackendProfilingContextPtr CreateBackendProfilingContext(const IRuntime::CreationOptions &creationOptions, IBackendProfilingPtr &backendProfiling) override
Create context specifically used for profiling interaction from backends.
std::shared_ptr< ILayerSupport > ILayerSupportSharedPtr
static Subgraphs SelectSubgraphs(Graph &graph, const LayerSelectorFunction &selector)
Selects subgraphs from a graph based on the selector function and the algorithm.
void Deregister(const BackendId &id)
const char * GetName() const override
Returns the name of the layer.
std::unique_ptr< IBackendInternal > IBackendInternalUniquePtr
A PreCompiledDescriptor for the PreCompiledLayer.
std::shared_ptr< armnn::profiling::IBackendProfilingContext > IBackendProfilingContextPtr
This is the bridge between backend and backend profiling we'll keep it in the backend namespace...
IBackendInternal::IMemoryManagerUniquePtr CreateMemoryManager() const override
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below...
std::unique_ptr< IBackendContext > IBackendContextPtr