From 2a2db590fd179dcb8e1a575293cd2b887e2dc246 Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Wed, 15 Aug 2018 12:14:46 +0100 Subject: COMPMID-1505: Add native grouping support at graph level Change-Id: Iedc91b0aee743b59af5140c8acb8124548da3163 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/144362 Tested-by: Jenkins Reviewed-by: Giorgio Arena Reviewed-by: Michele DiGiorgio --- src/graph/Utils.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'src/graph/Utils.cpp') diff --git a/src/graph/Utils.cpp b/src/graph/Utils.cpp index 4715694f15..75644a8933 100644 --- a/src/graph/Utils.cpp +++ b/src/graph/Utils.cpp @@ -78,13 +78,21 @@ PassManager create_default_pass_manager(Target target) { PassManager pm; + // Passes that mutate graph IR + pm.append(support::cpp14::make_unique()); if(target != Target::GC) { pm.append(support::cpp14::make_unique()); pm.append(support::cpp14::make_unique()); + } + + // Passes that mutate backend information + if(target != Target::GC) + { pm.append(support::cpp14::make_unique()); pm.append(support::cpp14::make_unique()); } + pm.append(support::cpp14::make_unique()); return pm; } @@ -139,5 +147,38 @@ size_t get_dimension_idx(const TensorDescriptor &descriptor, const DataLayoutDim break; } } + +std::vector get_driving_nodes(const INode &node) +{ + std::vector driving_nodes; + + const Graph *g = node.graph(); + ARM_COMPUTE_ERROR_ON(g == nullptr); + + for(auto &output_edge_id : node.output_edges()) + { + auto output_edge = g->edge(output_edge_id); + if(output_edge != nullptr) + { + ARM_COMPUTE_ERROR_ON(output_edge->consumer() == nullptr); + driving_nodes.push_back({ output_edge->consumer_id(), output_edge->consumer_idx() }); + } + } + + return driving_nodes; +} + +void configure_tensor(Tensor *tensor) +{ + if(tensor != nullptr && tensor->handle() == nullptr) + { + Target target = tensor->desc().target; + auto backend = backends::BackendRegistry::get().find_backend(target); + ARM_COMPUTE_ERROR_ON_MSG(!backend, "Requested backend doesn't exist!"); + auto handle = backend->create_tensor(*tensor); + ARM_COMPUTE_ERROR_ON_MSG(!backend, "Couldn't create backend handle!"); + tensor->set_handle(std::move(handle)); + } +} } // namespace graph } // namespace arm_compute -- cgit v1.2.1