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
9d2f66e7
Commit
9d2f66e7
authored
Dec 11, 2023
by
Paul
Browse files
Fix int8 issue in test
parent
8c196652
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
2 deletions
+15
-2
src/include/migraphx/shape.hpp
src/include/migraphx/shape.hpp
+2
-0
src/shape.cpp
src/shape.cpp
+8
-0
src/simplify_algebra.cpp
src/simplify_algebra.cpp
+3
-0
test/verify/test_block_reduce_small.cpp
test/verify/test_block_reduce_small.cpp
+2
-2
No files found.
src/include/migraphx/shape.hpp
View file @
9d2f66e7
...
@@ -131,6 +131,8 @@ struct MIGRAPHX_EXPORT shape
...
@@ -131,6 +131,8 @@ struct MIGRAPHX_EXPORT shape
static
std
::
string
name
(
type_t
t
);
static
std
::
string
name
(
type_t
t
);
static
std
::
string
cpp_type
(
type_t
t
);
static
std
::
string
cpp_type
(
type_t
t
);
static
bool
is_integral
(
type_t
t
);
shape
();
shape
();
shape
(
type_t
t
);
shape
(
type_t
t
);
shape
(
type_t
t
,
std
::
vector
<
std
::
size_t
>
l
);
shape
(
type_t
t
,
std
::
vector
<
std
::
size_t
>
l
);
...
...
src/shape.cpp
View file @
9d2f66e7
...
@@ -243,6 +243,14 @@ std::string shape::cpp_type(shape::type_t t)
...
@@ -243,6 +243,14 @@ std::string shape::cpp_type(shape::type_t t)
}
}
MIGRAPHX_THROW
(
"Invalid type"
);
MIGRAPHX_THROW
(
"Invalid type"
);
}
}
bool
shape
::
is_integral
(
shape
::
type_t
t
)
{
bool
result
=
false
;
visit
(
t
,
[
&
](
auto
as
)
{
result
=
as
.
is_integral
();
});
return
result
;
}
shape
::
shape
()
:
impl
(
shape_impl
::
default_shape
())
{}
shape
::
shape
()
:
impl
(
shape_impl
::
default_shape
())
{}
...
...
src/simplify_algebra.cpp
View file @
9d2f66e7
...
@@ -1200,6 +1200,9 @@ struct find_div_const
...
@@ -1200,6 +1200,9 @@ struct find_div_const
auto
ins
=
r
.
result
;
auto
ins
=
r
.
result
;
auto
c_ins
=
r
.
instructions
[
"c"
];
auto
c_ins
=
r
.
instructions
[
"c"
];
if
(
shape
::
is_integral
(
ins
->
get_shape
().
type
()))
return
;
auto
recip
=
m
.
insert_instruction
(
std
::
next
(
c_ins
),
make_op
(
"recip"
),
c_ins
);
auto
recip
=
m
.
insert_instruction
(
std
::
next
(
c_ins
),
make_op
(
"recip"
),
c_ins
);
auto
args
=
ins
->
inputs
();
auto
args
=
ins
->
inputs
();
...
...
test/verify/test_block_reduce_small.cpp
View file @
9d2f66e7
...
@@ -36,9 +36,9 @@ struct test_block_reduce_small : verify_program<test_block_reduce_small<N, T>>
...
@@ -36,9 +36,9 @@ struct test_block_reduce_small : verify_program<test_block_reduce_small<N, T>>
auto
*
mm
=
p
.
get_main_module
();
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
T
,
{
2
,
N
}};
migraphx
::
shape
s
{
T
,
{
2
,
N
}};
auto
x
=
mm
->
add_parameter
(
"x"
,
s
);
auto
x
=
mm
->
add_parameter
(
"x"
,
s
);
auto
y
=
mm
->
add_parameter
(
"
x
"
,
s
);
auto
y
=
mm
->
add_parameter
(
"
y
"
,
s
);
auto
two
=
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
s
.
type
(),
{
1
}},
{
2
}});
auto
two
=
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
s
.
type
(),
{
1
}},
{
2
}});
auto
mul
=
migraphx
::
add_common_op
(
*
mm
,
migraphx
::
make_op
(
"
mul
"
),
{
x
,
two
});
auto
mul
=
migraphx
::
add_common_op
(
*
mm
,
migraphx
::
make_op
(
"
div
"
),
{
x
,
two
});
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"reduce_sum"
,
{{
"axes"
,
{
1
}}}),
mul
);
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"reduce_sum"
,
{{
"axes"
,
{
1
}}}),
mul
);
auto
rb
=
auto
rb
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
s
.
lens
()}}),
r
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
s
.
lens
()}}),
r
);
...
...
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