Commit c8bc3edc authored by Nick Korovaiko's avatar Nick Korovaiko Committed by Scott Cyphers

Matcher skip (#2169)

* Update cpu_external_function.cpp

* fix test case failures

* env var to abort matching

* Update matcher.cpp

* Update matcher.cpp

* add a comment

* give an env var a better name
parent f46e56ec
......@@ -16,6 +16,7 @@
#include "matcher.hpp"
#include <algorithm>
#include <regex>
#include <typeindex>
#include <typeinfo>
......@@ -189,6 +190,21 @@ namespace ngraph
add_node(graph_node);
size_t watermark = m_matched_list.size() - 1;
// This env var allows one to specify node name patterns to abort pattern matching
// at particular nodes. The upshot is that one can quickly zero in on an offending fusion by
// disabling individual fusions or optimizations that use Matcher.
static const char* node_skip_cregex = std::getenv("NGRAPH_FAIL_MATCH_AT");
if (node_skip_cregex)
{
static const std::regex node_skip_regex(node_skip_cregex);
if (std::regex_match(graph_node->get_name(), node_skip_regex))
{
NGRAPH_DEBUG << "[MATCHER] Aborting at " << graph_node->get_name()
<< " due to NGRAPH_MATCHER_SKIP set to " << node_skip_cregex;
return abort_match(watermark, false);
}
}
NGRAPH_DEBUG << pad(2 * m_depth) << "[MATCHER] in match_node : "
<< "pattern = " << pattern_node->get_name() << " matched "
<< graph_node->get_name();
......
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