Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
41e3b9f6
"src/targets/vscode:/vscode.git/clone" did not exist on "b72f2b9ec2a0ce61bbbb577e92ae68c35dc56eaf"
Commit
41e3b9f6
authored
Jun 30, 2022
by
Ted Themistokleous
Browse files
fixup! Add support for division by zero errors
parent
c2d4ceb0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
src/simplify_algebra.cpp
src/simplify_algebra.cpp
+8
-3
test/simplify_algebra_test.cpp
test/simplify_algebra_test.cpp
+1
-1
No files found.
src/simplify_algebra.cpp
View file @
41e3b9f6
...
...
@@ -41,6 +41,8 @@
namespace
migraphx
{
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
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
)
...
...
@@ -857,9 +859,12 @@ struct find_zero_div_const
void
apply
[[
noreturn
]]
(
const
module
&
m
,
const
match
::
matcher_result
&
r
)
const
{
m
.
debug_print
();
std
::
cout
<<
"ERROR:DIV_BY_ZERO: "
;
m
.
debug_print
(
r
.
result
);
if
(
enabled
(
MIGRAPHX_TRACE_PASSES
{}))
{
m
.
debug_print
();
std
::
cout
<<
"ERROR:DIV_BY_ZERO: "
;
m
.
debug_print
(
r
.
result
);
}
MIGRAPHX_THROW
(
"ERROR: Matched division by zero in pass"
);
}
};
...
...
test/simplify_algebra_test.cpp
View file @
41e3b9f6
...
...
@@ -906,7 +906,7 @@ TEST_CASE(simplify_div_zero_const)
}
catch
(
const
std
::
runtime_error
&
e
)
{
std
::
cerr
<<
e
.
what
()
<<
std
::
endl
;
(
void
)
e
;
result
=
true
;
}
EXPECT
(
result
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment