aboutsummaryrefslogtreecommitdiff
path: root/src/graph/algorithms/TopologicalSort.cpp
diff options
context:
space:
mode:
authorFelix Thomasmathibalan <felixjohnny.thomasmathibalan@arm.com>2023-09-27 17:46:17 +0100
committerfelixjohnny.thomasmathibalan <felixjohnny.thomasmathibalan@arm.com>2023-09-28 12:08:05 +0000
commitafd38f0c617d6f89b2b4532c6c44f116617e2b6f (patch)
tree03bc7d5a762099989b16a656fa8d397b490ed70e /src/graph/algorithms/TopologicalSort.cpp
parentbdcb4c148ee2fdeaaddf4cf1e57bbb0de02bb894 (diff)
downloadComputeLibrary-afd38f0c617d6f89b2b4532c6c44f116617e2b6f.tar.gz
Apply clang-format on repository
Code is formatted as per a revised clang format configuration file(not part of this delivery). Version 14.0.6 is used. Exclusion List: - files with .cl extension - files that are not strictly C/C++ (e.g. Android.bp, Sconscript ...) And the following directories - compute_kernel_writer/validation/ - tests/ - include/ - src/core/NEON/kernels/convolution/ - src/core/NEON/kernels/arm_gemm/ - src/core/NEON/kernels/arm_conv/ - data/ There will be a follow up for formatting of .cl files and the files under tests/ and compute_kernel_writer/validation/. Signed-off-by: Felix Thomasmathibalan <felixjohnny.thomasmathibalan@arm.com> Change-Id: Ib7eb1fcf4e7537b9feaefcfc15098a804a3fde0a Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/10391 Benchmark: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Gunes Bayir <gunes.bayir@arm.com>
Diffstat (limited to 'src/graph/algorithms/TopologicalSort.cpp')
-rw-r--r--src/graph/algorithms/TopologicalSort.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/graph/algorithms/TopologicalSort.cpp b/src/graph/algorithms/TopologicalSort.cpp
index 3a69352471..08e14e1657 100644
--- a/src/graph/algorithms/TopologicalSort.cpp
+++ b/src/graph/algorithms/TopologicalSort.cpp
@@ -50,14 +50,14 @@ inline bool all_inputs_are_visited(const INode *node, const std::vector<bool> &v
ARM_COMPUTE_ERROR_ON(graph == nullptr);
bool are_all_visited = true;
- for(const auto &input_edge_id : node->input_edges())
+ for (const auto &input_edge_id : node->input_edges())
{
- if(input_edge_id != EmptyNodeID)
+ if (input_edge_id != EmptyNodeID)
{
const Edge *input_edge = graph->edge(input_edge_id);
ARM_COMPUTE_ERROR_ON(input_edge == nullptr);
ARM_COMPUTE_ERROR_ON(input_edge->producer() == nullptr);
- if(!visited[input_edge->producer_id()])
+ if (!visited[input_edge->producer_id()])
{
are_all_visited = false;
break;
@@ -80,9 +80,9 @@ std::vector<NodeID> bfs(Graph &g)
std::list<NodeID> queue;
// Push inputs and mark as visited
- for(auto &input : g.nodes(NodeType::Input))
+ for (auto &input : g.nodes(NodeType::Input))
{
- if(input != EmptyNodeID)
+ if (input != EmptyNodeID)
{
visited[input] = true;
queue.push_back(input);
@@ -90,9 +90,9 @@ std::vector<NodeID> bfs(Graph &g)
}
// Push const nodes and mark as visited
- for(auto &const_node : g.nodes(NodeType::Const))
+ for (auto &const_node : g.nodes(NodeType::Const))
{
- if(const_node != EmptyNodeID)
+ if (const_node != EmptyNodeID)
{
visited[const_node] = true;
queue.push_back(const_node);
@@ -100,7 +100,7 @@ std::vector<NodeID> bfs(Graph &g)
}
// Iterate over vector and edges
- while(!queue.empty())
+ while (!queue.empty())
{
// Dequeue a node from queue and process
NodeID n = queue.front();
@@ -109,11 +109,11 @@ std::vector<NodeID> bfs(Graph &g)
const INode *node = g.node(n);
ARM_COMPUTE_ERROR_ON(node == nullptr);
- for(const auto &eid : node->output_edges())
+ for (const auto &eid : node->output_edges())
{
const Edge *e = g.edge(eid);
ARM_COMPUTE_ERROR_ON(e == nullptr);
- if(!visited[e->consumer_id()] && detail::all_inputs_are_visited(e->consumer(), visited))
+ if (!visited[e->consumer_id()] && detail::all_inputs_are_visited(e->consumer(), visited))
{
visited[e->consumer_id()] = true;
queue.push_back(e->consumer_id());
@@ -135,9 +135,9 @@ std::vector<NodeID> dfs(Graph &g)
std::stack<NodeID> stack;
// Push inputs and mark as visited
- for(auto &input : g.nodes(NodeType::Input))
+ for (auto &input : g.nodes(NodeType::Input))
{
- if(input != EmptyNodeID)
+ if (input != EmptyNodeID)
{
visited[input] = true;
stack.push(input);
@@ -145,9 +145,9 @@ std::vector<NodeID> dfs(Graph &g)
}
// Push const nodes and mark as visited
- for(auto &const_node : g.nodes(NodeType::Const))
+ for (auto &const_node : g.nodes(NodeType::Const))
{
- if(const_node != EmptyNodeID)
+ if (const_node != EmptyNodeID)
{
visited[const_node] = true;
stack.push(const_node);
@@ -155,7 +155,7 @@ std::vector<NodeID> dfs(Graph &g)
}
// Iterate over vector and edges
- while(!stack.empty())
+ while (!stack.empty())
{
// Pop a node from stack and process
NodeID n = stack.top();
@@ -163,7 +163,7 @@ std::vector<NodeID> dfs(Graph &g)
stack.pop();
// Mark node as visited
- if(!visited[n])
+ if (!visited[n])
{
visited[n] = true;
}
@@ -171,11 +171,11 @@ std::vector<NodeID> dfs(Graph &g)
const INode *node = g.node(n);
ARM_COMPUTE_ERROR_ON(node == nullptr);
// Reverse iterate to push branches from right to left and pop on the opposite order
- for(const auto &eid : arm_compute::utils::iterable::reverse_iterate(node->output_edges()))
+ for (const auto &eid : arm_compute::utils::iterable::reverse_iterate(node->output_edges()))
{
const Edge *e = g.edge(eid);
ARM_COMPUTE_ERROR_ON(e == nullptr);
- if(!visited[e->consumer_id()] && detail::all_inputs_are_visited(e->consumer(), visited))
+ if (!visited[e->consumer_id()] && detail::all_inputs_are_visited(e->consumer(), visited))
{
stack.push(e->consumer_id());
}