Commit 41e3b9f6 authored by Ted Themistokleous's avatar Ted Themistokleous
Browse files

fixup! Add support for division by zero errors

parent c2d4ceb0
...@@ -41,6 +41,8 @@ ...@@ -41,6 +41,8 @@
namespace migraphx { namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS { inline namespace MIGRAPHX_INLINE_NS {
MIGRAPHX_DECLARE_ENV_VAR(MIGRAPHX_TRACE_PASSES);
auto lit_broadcast() { return match::any_of(match::is_constant(), match::name("broadcast")); } auto lit_broadcast() { return match::any_of(match::is_constant(), match::name("broadcast")); }
auto not_lit_broadcast() { return match::none_of(match::is_constant(), match::name("broadcast")); } auto not_lit_broadcast() { return match::none_of(match::is_constant(), match::name("broadcast")); }
auto op_lit_broadcast(std::string op, std::string x, std::string y) auto op_lit_broadcast(std::string op, std::string x, std::string y)
...@@ -857,9 +859,12 @@ struct find_zero_div_const ...@@ -857,9 +859,12 @@ struct find_zero_div_const
void apply [[noreturn]] (const module& m, const match::matcher_result& r) const void apply [[noreturn]] (const module& m, const match::matcher_result& r) const
{ {
m.debug_print(); if(enabled(MIGRAPHX_TRACE_PASSES{}))
std::cout << "ERROR:DIV_BY_ZERO: "; {
m.debug_print(r.result); m.debug_print();
std::cout << "ERROR:DIV_BY_ZERO: ";
m.debug_print(r.result);
}
MIGRAPHX_THROW("ERROR: Matched division by zero in pass"); MIGRAPHX_THROW("ERROR: Matched division by zero in pass");
} }
}; };
......
...@@ -906,7 +906,7 @@ TEST_CASE(simplify_div_zero_const) ...@@ -906,7 +906,7 @@ TEST_CASE(simplify_div_zero_const)
} }
catch(const std::runtime_error& e) catch(const std::runtime_error& e)
{ {
std::cerr << e.what() << std::endl; (void)e;
result = true; result = true;
} }
EXPECT(result); EXPECT(result);
......
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