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
c3e62f5f
Unverified
Commit
c3e62f5f
authored
Nov 21, 2022
by
Charlie Lin
Committed by
GitHub
Nov 21, 2022
Browse files
Merge branch 'develop' into dyn_unsqueeze
parents
cdf1d239
9f50b860
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
3 deletions
+44
-3
src/fuse_pointwise.cpp
src/fuse_pointwise.cpp
+10
-1
src/targets/gpu/CMakeLists.txt
src/targets/gpu/CMakeLists.txt
+5
-2
test/fuse_pointwise.cpp
test/fuse_pointwise.cpp
+29
-0
No files found.
src/fuse_pointwise.cpp
View file @
c3e62f5f
...
@@ -45,7 +45,16 @@ static literal get_scalar(instruction_ref ins)
...
@@ -45,7 +45,16 @@ static literal get_scalar(instruction_ref ins)
return
{};
return
{};
auto
e
=
ins
->
eval
();
auto
e
=
ins
->
eval
();
literal
r
{};
literal
r
{};
e
.
visit_at
([
&
](
auto
x
)
{
r
=
literal
{
x
};
});
// needed for bool as visit_at invokes as() which promotes bool to int8
// Without this we'll break type checks for logical ops that are fused.
if
(
e
.
get_shape
().
type
()
==
shape
::
bool_type
)
{
r
=
literal
{
e
.
at
<
bool
>
()};
}
else
{
e
.
visit_at
([
&
](
auto
x
)
{
r
=
literal
{
x
};
});
}
return
r
;
return
r
;
}
}
...
...
src/targets/gpu/CMakeLists.txt
View file @
c3e62f5f
...
@@ -233,11 +233,14 @@ get_target_property(MIOPEN_LOCATION MIOpen LOCATION)
...
@@ -233,11 +233,14 @@ get_target_property(MIOPEN_LOCATION MIOpen LOCATION)
check_library_exists
(
MIOpen
"miopenHiddenSetConvolutionFindMode"
"
${
MIOPEN_LOCATION
}
"
HAS_FIND_MODE_API
)
check_library_exists
(
MIOpen
"miopenHiddenSetConvolutionFindMode"
"
${
MIOPEN_LOCATION
}
"
HAS_FIND_MODE_API
)
check_library_exists
(
MIOpen
"miopenFindSolutions"
"
${
MIOPEN_LOCATION
}
"
HAS_FIND_2_API
)
check_library_exists
(
MIOpen
"miopenFindSolutions"
"
${
MIOPEN_LOCATION
}
"
HAS_FIND_2_API
)
if
(
HAS_FIND_2_API
)
# TODO: Set default to HAS_FIND_2_API
set
(
MIGRAPHX_USE_FIND_2_API OFF CACHE BOOL
""
)
if
(
MIGRAPHX_USE_FIND_2_API
)
target_compile_definitions
(
migraphx_gpu PUBLIC -DMIGRAPHX_HAS_FIND_2_API
)
target_compile_definitions
(
migraphx_gpu PUBLIC -DMIGRAPHX_HAS_FIND_2_API
)
message
(
STATUS
"MIGraphx is using Find-2.0 API of MIOpen"
)
message
(
STATUS
"MIGraphx is using Find-2.0 API of MIOpen"
)
else
()
else
()
message
(
STATUS
"MI
Open does not have Find-2.0 API
"
)
message
(
STATUS
"MI
Graphx is using legacy Find API in MIOpen
"
)
endif
()
endif
()
if
(
HAS_FIND_MODE_API
)
if
(
HAS_FIND_MODE_API
)
...
...
test/fuse_pointwise.cpp
View file @
c3e62f5f
...
@@ -272,6 +272,35 @@ TEST_CASE(contiguous_input)
...
@@ -272,6 +272,35 @@ TEST_CASE(contiguous_input)
EXPECT
(
p1
==
p2
);
EXPECT
(
p1
==
p2
);
}
}
TEST_CASE
(
contiguous_boolean_input
)
{
migraphx
::
shape
s
{
migraphx
::
shape
::
bool_type
,
{
2
,
3
}};
migraphx
::
shape
s_lit
{
migraphx
::
shape
::
bool_type
,
{
1
},
{
0
}};
migraphx
::
program
p1
;
{
auto
*
mm
=
p1
.
get_main_module
();
auto
x
=
mm
->
add_parameter
(
"x"
,
s
);
auto
one
=
mm
->
add_literal
(
migraphx
::
literal
(
s_lit
,
{
1.0
}));
auto
yb
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
s
.
lens
()}}),
one
);
auto
y
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"contiguous"
),
yb
);
auto
xor1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"logical_xor"
),
x
,
y
);
mm
->
add_return
({
xor1
});
}
run_pass
(
p1
);
migraphx
::
program
p2
;
{
auto
*
mm
=
p2
.
get_main_module
();
auto
x
=
mm
->
add_parameter
(
"x"
,
s
);
auto
xor1
=
add_pointwise
(
p2
,
"main:pointwise0"
,
{
x
},
[
=
](
auto
*
pm
,
const
auto
&
inputs
)
{
auto
y
=
pm
->
add_literal
(
migraphx
::
literal
(
s_lit
,
{
1
}));
return
pm
->
add_instruction
(
migraphx
::
make_op
(
"logical_xor"
),
inputs
[
0
],
y
);
});
mm
->
add_return
({
xor1
});
}
}
TEST_CASE
(
all_scalar_input
)
TEST_CASE
(
all_scalar_input
)
{
{
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
};
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
};
...
...
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