diff options
author | Derek Lamberti <derek.lamberti@arm.com> | 2019-05-08 10:23:08 +0100 |
---|---|---|
committer | Derek Lamberti <derek.lamberti@arm.com> | 2019-05-08 11:52:29 +0100 |
commit | c2fe5fb3a070ce2c7daebf63d0def3d57cec09d3 (patch) | |
tree | e21332cfe689c08f9939d251a2d8fa56a9f81e1e /src/backends/backendsCommon/IBackendInternal.hpp | |
parent | 59f32f96c0fc5c451e0fdbbfc24b072b07dc226b (diff) | |
download | armnn-c2fe5fb3a070ce2c7daebf63d0def3d57cec09d3.tar.gz |
IVGCVSW-3031 Finer grained backend optimization API
Change-Id: I9b93bc81b97f3d89fa046ba001854f732040e63a
Signed-off-by: Derek Lamberti <derek.lamberti@arm.com>
Diffstat (limited to 'src/backends/backendsCommon/IBackendInternal.hpp')
-rw-r--r-- | src/backends/backendsCommon/IBackendInternal.hpp | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/src/backends/backendsCommon/IBackendInternal.hpp b/src/backends/backendsCommon/IBackendInternal.hpp index b3ddb55676..f49a210988 100644 --- a/src/backends/backendsCommon/IBackendInternal.hpp +++ b/src/backends/backendsCommon/IBackendInternal.hpp @@ -10,6 +10,8 @@ #include <ISubgraphViewConverter.hpp> #include <SubgraphView.hpp> +#include "OptimizationViews.hpp" + #include <vector> namespace armnn @@ -54,8 +56,38 @@ public: virtual Optimizations GetOptimizations() const = 0; virtual ILayerSupportSharedPtr GetLayerSupport() const = 0; - virtual SubgraphViewUniquePtr OptimizeSubgraphView(const SubgraphView& subgraph, bool& optimizationAttempted) - const = 0; + // @deprecated Use "OptimizationViews OptimizeSubgraphView(const SubgraphView&);" instead. + virtual SubgraphViewUniquePtr OptimizeSubgraphView(const SubgraphView& subgraph, bool& optimizationAttempted) const + { + optimizationAttempted=false; + return nullptr; + } + + // Default implementation of OptimizeSubgraphView for backward compatibility with old API. + // Override this method with a custom optimization implementation. + virtual OptimizationViews OptimizeSubgraphView(const SubgraphView& subgraph) + { + bool attempted=false; + SubgraphViewUniquePtr optSubgraph = OptimizeSubgraphView(subgraph, attempted); + + OptimizationViews result; + if (!attempted) + { + result.AddUntouchedSubgraph(SubgraphView(subgraph)); + } + else + { + if (optSubgraph) + { + result.AddSubstituion({*optSubgraph.get(), subgraph}); + } + else + { + result.AddFailedSubgraph(SubgraphView(subgraph)); + } + } + return result; + } }; using IBackendInternalUniquePtr = std::unique_ptr<IBackendInternal>; |