| // |
| // Copyright © 2017 Arm Ltd. All rights reserved. |
| // SPDX-License-Identifier: MIT |
| // |
| #pragma once |
| |
| #include <armnn/Types.hpp> |
| #include <armnn/IRuntime.hpp> |
| |
| #include <ISubGraphConverter.hpp> |
| #include <SubGraph.hpp> |
| |
| #include <vector> |
| |
| namespace armnn |
| { |
| class IWorkloadFactory; |
| class IBackendContext; |
| class IMemoryManager; |
| class Optimization; |
| class ILayerSupport; |
| |
| class IBackendInternal : public IBackend |
| { |
| protected: |
| // Creation must be done through a specific |
| // backend interface. |
| IBackendInternal() = default; |
| |
| public: |
| // Allow backends created by the factory function |
| // to be destroyed through IBackendInternal. |
| ~IBackendInternal() override = default; |
| |
| using IWorkloadFactoryPtr = std::unique_ptr<IWorkloadFactory>; |
| using IBackendContextPtr = std::unique_ptr<IBackendContext>; |
| using OptimizationPtr = std::unique_ptr<Optimization>; |
| using Optimizations = std::vector<OptimizationPtr>; |
| using ILayerSupportSharedPtr = std::shared_ptr<ILayerSupport>; |
| |
| using IMemoryManagerUniquePtr = std::unique_ptr<IMemoryManager>; |
| using IMemoryManagerSharedPtr = std::shared_ptr<IMemoryManager>; |
| |
| using ISubGraphConverterPtr = std::unique_ptr<ISubGraphConverter>; |
| |
| using SubGraphUniquePtr = std::unique_ptr<SubGraph>; |
| |
| virtual IMemoryManagerUniquePtr CreateMemoryManager() const = 0; |
| |
| virtual IWorkloadFactoryPtr CreateWorkloadFactory( |
| const IMemoryManagerSharedPtr& memoryManager = nullptr) const = 0; |
| |
| virtual IBackendContextPtr CreateBackendContext(const IRuntime::CreationOptions&) const = 0; |
| |
| virtual ISubGraphConverterPtr CreateSubGraphConverter(const std::shared_ptr<SubGraph>& subGraph) const = 0; |
| |
| virtual Optimizations GetOptimizations() const = 0; |
| virtual ILayerSupportSharedPtr GetLayerSupport() const = 0; |
| |
| virtual SubGraphUniquePtr OptimizeSubGraph(const SubGraph& subGraph, bool& optimizationAttempted) const = 0; |
| }; |
| |
| using IBackendInternalUniquePtr = std::unique_ptr<IBackendInternal>; |
| |
| } // namespace armnn |