From d9eb27597eabe5b7c17520f4f9b3f8a282d72573 Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Tue, 3 Apr 2018 13:44:29 +0100 Subject: COMPMID-797: Switch to new graph. - Cleaned up build system Change-Id: If2faa27ee5b31fa8b972836960ab3ef671059c8d Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/126435 Tested-by: Jenkins Reviewed-by: Pablo Tello --- src/graph/GraphContext.cpp | 56 ++++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 24 deletions(-) (limited to 'src/graph/GraphContext.cpp') diff --git a/src/graph/GraphContext.cpp b/src/graph/GraphContext.cpp index bfc6fcdfca..6fc45c0aa7 100644 --- a/src/graph/GraphContext.cpp +++ b/src/graph/GraphContext.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -22,45 +22,53 @@ * SOFTWARE. */ #include "arm_compute/graph/GraphContext.h" +#include -using namespace arm_compute::graph; - -GraphHints::GraphHints(TargetHint target_hint, ConvolutionMethodHint conv_method_hint) - : _target_hint(target_hint), _convolution_method_hint(conv_method_hint) +namespace arm_compute { -} - -void GraphHints::set_target_hint(TargetHint target_hint) +namespace graph { - _target_hint = target_hint; -} - -void GraphHints::set_convolution_method_hint(ConvolutionMethodHint convolution_method) +GraphContext::GraphContext() + : _config(), _memory_managers() { - _convolution_method_hint = convolution_method; } -TargetHint GraphHints::target_hint() const +const GraphConfig &GraphContext::config() const { - return _target_hint; + return _config; } -ConvolutionMethodHint GraphHints::convolution_method_hint() const +void GraphContext::set_config(const GraphConfig &config) { - return _convolution_method_hint; + _config = config; } -GraphContext::GraphContext() - : _hints() +bool GraphContext::insert_memory_management_ctx(MemoryManagerContext &&memory_ctx) { + Target target = memory_ctx.target; + if(target == Target::UNSPECIFIED || _memory_managers.find(target) != std::end(_memory_managers)) + { + return false; + } + + _memory_managers[target] = std::move(memory_ctx); + return true; } -GraphHints &GraphContext::hints() +MemoryManagerContext *GraphContext::memory_management_ctx(Target target) { - return _hints; + return (_memory_managers.find(target) != std::end(_memory_managers)) ? &_memory_managers[target] : nullptr; } -const GraphHints &GraphContext::hints() const +void GraphContext::finalize() { - return _hints; -} \ No newline at end of file + for(auto &mm_obj : _memory_managers) + { + if(mm_obj.second.mm != nullptr) + { + mm_obj.second.mm->finalize(); + } + } +} +} // namespace graph +} // namespace arm_compute \ No newline at end of file -- cgit v1.2.1