From e043767d068da389308507011d944e6db9e4d676 Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Wed, 2 May 2018 14:07:55 +0100 Subject: COMPMID-920: Introduce prepare() stage Change-Id: I08ddb7f6e061178e7566518b48e4e18f8f078596 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/129825 Tested-by: Jenkins Reviewed-by: Anthony Barbier --- src/graph/GraphManager.cpp | 48 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 12 deletions(-) (limited to 'src/graph/GraphManager.cpp') diff --git a/src/graph/GraphManager.cpp b/src/graph/GraphManager.cpp index c0720ac685..fa7dfdf8f8 100644 --- a/src/graph/GraphManager.cpp +++ b/src/graph/GraphManager.cpp @@ -74,23 +74,47 @@ void GraphManager::finalize_graph(Graph &graph, GraphContext &ctx, PassManager & auto workload = detail::configure_all_nodes(graph, ctx); ARM_COMPUTE_ERROR_ON_MSG(workload.tasks.empty(), "Could not configure all nodes!"); - // Allocate all tensors - detail::allocate_all_tensors(graph); + // TODO (COMPMID-920) : Update prepare for NEON/GC + if(forced_target == Target::CL) + { + // Allocate const tensors and call accessors + detail::allocate_const_tensors(graph); + detail::call_all_const_node_accessors(graph); + + // Prepare graph + detail::prepare_all_tasks(workload); + + // Allocate all tensors + detail::allocate_all_tensors(graph); + + // Finalize Graph context + ctx.finalize(); - // Call accessors on all Const nodes - detail::call_all_const_node_accessors(graph); + // Register graph + _workloads.insert(std::make_pair(graph.id(), std::move(workload))); + ARM_COMPUTE_LOG_GRAPH_VERBOSE("Created workload for graph with ID : " << graph.id().get() << std::endl); + } + else + { + // Allocate all tensors + detail::allocate_all_tensors(graph); - _workloads.insert(std::make_pair(graph.id(), std::move(workload))); - ARM_COMPUTE_LOG_GRAPH_VERBOSE("Created workload for graph with ID : " << graph.id().get() << std::endl); + // Call accessors on all Const nodes + detail::call_all_const_node_accessors(graph); - // Finalize Graph context - ctx.finalize(); + // Finalize Graph context + ctx.finalize(); - // Make first run - execute_graph(graph); + // Register graph + _workloads.insert(std::make_pair(graph.id(), std::move(workload))); + ARM_COMPUTE_LOG_GRAPH_VERBOSE("Created workload for graph with ID : " << graph.id().get() << std::endl); - // Release all unused const nodes - detail::release_unused_tensors(graph); + // Make first run + execute_graph(graph); + + // Release all unused const tensors + detail::release_unused_tensors(graph); + } } void GraphManager::execute_graph(Graph &graph) -- cgit v1.2.1