Commit 47abb1cb authored by Nagy Mostafa's avatar Nagy Mostafa Committed by Robert Kimball

Remove unused code in sub-graph extraction (#4117)

Co-authored-by: 's avatarSang Ik Lee <sang.ik.lee@intel.com>
Co-authored-by: 's avatarScott Cyphers <diyessi@users.noreply.github.com>
Co-authored-by: 's avatarRobert Kimball <robert.kimball@intel.com>
parent 4487d60e
......@@ -77,38 +77,6 @@ void MLIRSubgraphExtractionPass::MLIRSubgraph::add_node(std::shared_ptr<Node> no
m_pass.m_node_to_graph[node] = get_id();
}
void MLIRSubgraphExtractionPass::MLIRSubgraph::merge(MLIRSubgraph& sg2)
{
NGRAPH_CHECK(&sg2 != this, "Cannot merge a sub-graph into itself");
// Associate nodes of second sub-graph to first one
auto sg_nodes = sg2.get_nodes();
for (auto node : sg_nodes)
{
NGRAPH_DEBUG << *node;
NGRAPH_CHECK(m_pass.get_subgraph_id(node) == sg2.get_id(),
"Node does not belong to sub-graph");
m_pass.m_node_to_graph[node] = get_id();
}
// nodes of sub-graphs are exclusive
m_nodes.insert(m_nodes.end(), sg2.get_nodes().begin(), sg2.get_nodes().end());
// merge inputs
add_inputs(sg2.get_inputs());
// Remove sub-graph from map
m_pass.m_id_to_graph.erase(sg2.get_id());
}
MLIRSubgraphExtractionPass::MLIRSubgraphExtractionPass()
: m_max_cycle_depth(20)
{
if (char* max_cycle_depth = std::getenv("NGRAPH_MLIR_MAX_CYCLE_DEPTH"))
{
m_max_cycle_depth = std::stoi(max_cycle_depth);
}
}
// The sub-graph construction algorithm is as follows
// Construct a map of node to number of its input not being processes
// Put the node with value 0 into a ready list
......
......@@ -62,8 +62,6 @@ namespace ngraph
void add_inputs(NodeVector& inputs);
/// Add a list of output nodes to the sub-graph.
void add_outputs(NodeVector& outputs);
/// Merges sub-graph (other) into this sub-graph. other will be destroyed.
void merge(MLIRSubgraph& other);
/// Add one node to the sub-graph.
void add_node(std::shared_ptr<Node> node);
......@@ -84,7 +82,6 @@ namespace ngraph
friend class MLIRSubgraph;
public:
MLIRSubgraphExtractionPass();
bool run_on_function(std::shared_ptr<Function> func) override;
/// Checks if an ngraph node is supported by MLIR backend
bool is_supported_mlir_op(std::shared_ptr<Node> node);
......@@ -119,9 +116,6 @@ namespace ngraph
// Mutex over sub-graph IDs
std::mutex m_subgraph_mutex;
static const std::set<std::type_index> m_supported_ops;
// Maximum depth to check for cycles during merging of sub-graphs.
// If exceeded, we conservatively assume a cycle.
int m_max_cycle_depth;
};
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment