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
fcc84214
Commit
fcc84214
authored
Jul 08, 2022
by
Ted Themistokleous
Browse files
Remove check for div zero, push this to be detected in a seperate pass
parent
728fe848
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
37 deletions
+0
-37
src/simplify_algebra.cpp
src/simplify_algebra.cpp
+0
-15
test/simplify_algebra_test.cpp
test/simplify_algebra_test.cpp
+0
-22
No files found.
src/simplify_algebra.cpp
View file @
fcc84214
...
@@ -851,20 +851,6 @@ struct find_div_const
...
@@ -851,20 +851,6 @@ struct find_div_const
}
}
};
};
struct
find_zero_div_const
{
auto
matcher
()
const
{
return
match
::
name
(
"div"
)(
match
::
arg
(
1
)(
match
::
skip_broadcasts_converts
(
match
::
has_value
(
0.0
f
))));
}
[[
noreturn
]]
void
apply
(
module
&
,
const
match
::
matcher_result
&
)
const
{
MIGRAPHX_THROW
(
"ERROR: Matched division by zero in pass"
);
}
};
struct
find_unit_ops
struct
find_unit_ops
{
{
auto
matcher
()
const
auto
matcher
()
const
...
@@ -1132,7 +1118,6 @@ void simplify_algebra::apply(module& m) const
...
@@ -1132,7 +1118,6 @@ void simplify_algebra::apply(module& m) const
find_unit_ops
{},
find_unit_ops
{},
find_neg_unit_ops
{},
find_neg_unit_ops
{},
find_zero_ops
{},
find_zero_ops
{},
find_zero_div_const
{},
find_div_const
{},
find_div_const
{},
find_sub_const
{},
find_sub_const
{},
find_rsqrt
{},
find_rsqrt
{},
...
...
test/simplify_algebra_test.cpp
View file @
fcc84214
...
@@ -1096,28 +1096,6 @@ TEST_CASE(simplify_sub_neg_zero_const_vec)
...
@@ -1096,28 +1096,6 @@ TEST_CASE(simplify_sub_neg_zero_const_vec)
EXPECT
(
m1
==
m2
);
EXPECT
(
m1
==
m2
);
}
}
TEST_CASE
(
simplify_div_zero_const
)
{
migraphx
::
module
m1
;
{
auto
x
=
m1
.
add_parameter
(
"x"
,
{
migraphx
::
shape
::
int32_type
,
{
1
}});
auto
unit
=
m1
.
add_literal
(
0
);
m1
.
add_instruction
(
migraphx
::
make_op
(
"div"
),
x
,
unit
);
}
bool
result
=
false
;
try
{
run_pass
(
m1
);
}
catch
(
const
std
::
runtime_error
&
e
)
{
(
void
)
e
;
result
=
true
;
}
EXPECT
(
result
);
}
TEST_CASE
(
simplify_sub_const
)
TEST_CASE
(
simplify_sub_const
)
{
{
migraphx
::
module
m1
;
migraphx
::
module
m1
;
...
...
gaoqiong
@gaoqiong
mentioned in commit
c3edd50e
·
Dec 14, 2023
mentioned in commit
c3edd50e
mentioned in commit c3edd50e12855b44d34b7bd6fd52d146f49b3014
Toggle commit list
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