18 #include <boost/cast.hpp> 27 BOOST_ASSERT(layer !=
nullptr);
46 return IsLayerSupported(&layer);
51 BOOST_ASSERT(layer !=
nullptr);
54 const std::string layerName(layer->
GetName());
55 bool optimizable = layerName.find(
"unoptimizable") == std::string::npos;
62 return IsLayerOptimizable(&layer);
87 std::cerr <<
"could not deregister mock backend" << std::endl;
111 boost::ignore_unused(options);
112 std::shared_ptr<armnn::MockBackendProfilingContext> context =
113 std::make_shared<MockBackendProfilingContext>(backendProfiling);
146 std::for_each(subgraphLayers.begin(),
147 subgraphLayers.end(),
150 bool supported = IsLayerSupported(layer);
154 bool optimizable = IsLayerOptimizable(layer);
158 supportedLayers.push_back(layer);
163 untouchedLayers.push_back(layer);
169 unsupportedLayers.push_back(layer);
174 if (!supportedLayers.empty())
177 auto supportedSubgraphSelector = [](
const Layer& layer)
181 IsLayerSupported(layer) &&
182 IsLayerOptimizable(layer);
191 std::for_each(supportedSubgraphs.begin(),
192 supportedSubgraphs.end(),
195 BOOST_ASSERT(supportedSubgraph !=
nullptr);
200 supportedSubgraph->GetNumOutputSlots()),
207 optimizationViews.
AddSubstitution({ substitutionSubgraph, replacementSubgraph });
212 if (!unsupportedLayers.empty())
215 auto unsupportedSubgraphSelector = [](
const Layer& layer)
219 !IsLayerSupported(layer);
228 std::for_each(unsupportedSubgraphs.begin(),
229 unsupportedSubgraphs.end(),
232 BOOST_ASSERT(unsupportedSubgraph !=
nullptr);
239 if (!untouchedLayers.empty())
242 auto untouchedSubgraphSelector = [](
const Layer& layer)
246 IsLayerSupported(layer) &&
247 !IsLayerOptimizable(layer);
256 std::for_each(untouchedSubgraphs.begin(),
257 untouchedSubgraphs.end(),
260 BOOST_ASSERT(untouchedSubgraph !=
nullptr);
266 return optimizationViews;
void AddFailedSubgraph(SubgraphView &&subgraph)
std::unique_ptr< IBackendInternal > IBackendInternalUniquePtr
std::unique_ptr< IWorkloadFactory > IWorkloadFactoryPtr
LayerType GetType() const
std::vector< OptimizationPtr > Optimizations
const char * GetName() const override
void AddUntouchedSubgraph(SubgraphView &&subgraph)
static MockBackendProfilingService & Instance()
const Layers & GetLayers() const
std::unique_ptr< IBackendContext > IBackendContextPtr
std::list< Layer * > Layers
LayerT * AddLayer(Args &&... args)
Adds a new layer, of type LayerType, to the graph constructed with the arguments passed.
std::shared_ptr< IMemoryManager > IMemoryManagerSharedPtr
static Subgraphs SelectSubgraphs(Graph &graph, const LayerSelectorFunction &selector)
void AddSubstitution(SubstitutionPair &&substitution)
std::unique_ptr< ISubGraphConverter > supported
std::vector< SubgraphViewPtr > Subgraphs
static const BackendId & GetIdStatic()
void SetBackendId(const BackendId &id)
BackendRegistry & BackendRegistryInstance()
OptimizationViews OptimizeSubgraphView(const SubgraphView &subgraph) const override
IBackendInternal::IWorkloadFactoryPtr CreateWorkloadFactory(const IBackendInternal::IMemoryManagerSharedPtr &memoryManager=nullptr) const override
IBackendInternal::Optimizations GetOptimizations() const override
IBackendInternal::IBackendContextPtr CreateBackendContext(const IRuntime::CreationOptions &) const override
constexpr const char * MockBackendId()
std::shared_ptr< armnn::profiling::IBackendProfilingContext > IBackendProfilingContextPtr
std::unique_ptr< IMemoryManager > IMemoryManagerUniquePtr
std::unique_ptr< SubgraphView > SubgraphViewPtr
void SetProfilingContextPtr(std::shared_ptr< MockBackendProfilingContext > shared)
IBackendInternal::IBackendProfilingContextPtr CreateBackendProfilingContext(const IRuntime::CreationOptions &creationOptions, IBackendProfilingPtr &backendProfiling) override
Create context specifically used for profiling interaction from backends.
IBackendInternal::ILayerSupportSharedPtr GetLayerSupport() const override
std::shared_ptr< ILayerSupport > ILayerSupportSharedPtr
IBackendInternal::IMemoryManagerUniquePtr CreateMemoryManager() const override
void Deregister(const BackendId &id)
armnn::Runtime::CreationOptions::ExternalProfilingOptions options
~MockBackendInitialiser()
A PreCompiledDescriptor for the PreCompiledLayer.
std::unique_ptr< armnn::profiling::IBackendProfiling > IBackendProfilingPtr
void Register(const BackendId &id, FactoryFunction factory)