Commit bbe4735e authored by Nagy Mostafa's avatar Nagy Mostafa Committed by omarkanawi

[MLIR] Clear SubGraph construction info (#3559)

* Don't hold to shared pointers after sub-graph extraction pass is done

* style
parent 0a6f5bca
...@@ -132,6 +132,7 @@ bool MLIRSubgraphExtractionPass::run_on_function(std::shared_ptr<Function> func) ...@@ -132,6 +132,7 @@ bool MLIRSubgraphExtractionPass::run_on_function(std::shared_ptr<Function> func)
sanity_check(func, ck_nodes); sanity_check(func, ck_nodes);
#endif #endif
clean_up();
return true; return true;
} }
...@@ -506,6 +507,12 @@ bool MLIRSubgraphExtractionPass::check_cycles(std::shared_ptr<Node> node, ...@@ -506,6 +507,12 @@ bool MLIRSubgraphExtractionPass::check_cycles(std::shared_ptr<Node> node,
return false; return false;
} }
void MLIRSubgraphExtractionPass::clean_up()
{
m_id_to_graph.clear();
m_node_to_graph.clear();
}
const std::set<std::type_index> MLIRSubgraphExtractionPass::m_supported_ops{ const std::set<std::type_index> MLIRSubgraphExtractionPass::m_supported_ops{
#define MLIR_OP(OP) TI(ngraph::op::OP), #define MLIR_OP(OP) TI(ngraph::op::OP),
#include "contrib/mlir/compiler/ops_supported.inc" #include "contrib/mlir/compiler/ops_supported.inc"
......
...@@ -127,6 +127,7 @@ namespace ngraph ...@@ -127,6 +127,7 @@ namespace ngraph
NodeVector build_ck_nodes(std::shared_ptr<Function> func); NodeVector build_ck_nodes(std::shared_ptr<Function> func);
void sanity_check(std::shared_ptr<Function> func, NodeVector& ck_nodes); void sanity_check(std::shared_ptr<Function> func, NodeVector& ck_nodes);
void clean_up();
private: private:
using IDGraphMap = std::unordered_map<int, MLIRSubgraph>; using IDGraphMap = std::unordered_map<int, MLIRSubgraph>;
......
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