From 1a569a30a2f456ff1a3e0a665201e1c3ab92df80 Mon Sep 17 00:00:00 2001 From: Michalis Spyrou Date: Tue, 10 Sep 2019 17:20:34 +0100 Subject: COMPMID-2161 [NEON] Create IWeightManager class Change-Id: I1a9a46da2f98e896b825099151b56d1d8271dd31 Signed-off-by: Michalis Spyrou Reviewed-on: https://review.mlplatform.org/c/1915 Comments-Addressed: Arm Jenkins Reviewed-by: Georgios Pinitas Tested-by: Arm Jenkins --- src/graph/GraphContext.cpp | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'src/graph/GraphContext.cpp') diff --git a/src/graph/GraphContext.cpp b/src/graph/GraphContext.cpp index 037b40b68b..c959d5e35c 100644 --- a/src/graph/GraphContext.cpp +++ b/src/graph/GraphContext.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -32,13 +32,14 @@ namespace arm_compute namespace graph { GraphContext::GraphContext() - : _config(), _memory_managers() + : _config(), _memory_managers(), _weights_managers() { } GraphContext::~GraphContext() { _memory_managers.clear(); + _weights_managers.clear(); release_default_graph_context(*this); } @@ -74,6 +75,30 @@ std::map &GraphContext::memory_managers() return _memory_managers; } +bool GraphContext::insert_weights_management_ctx(WeightsManagerContext &&weights_managers) +{ + Target target = weights_managers.target; + + if(target != Target::NEON || _weights_managers.find(target) != std::end(_weights_managers)) + { + return false; + } + + _weights_managers[target] = std::move(weights_managers); + + return true; +} + +WeightsManagerContext *GraphContext::weights_management_ctx(Target target) +{ + return (_weights_managers.find(target) != std::end(_weights_managers)) ? &_weights_managers[target] : nullptr; +} + +std::map &GraphContext::weights_managers() +{ + return _weights_managers; +} + void GraphContext::finalize() { const size_t num_pools = 1; -- cgit v1.2.1