Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
33423f8c
Commit
33423f8c
authored
Jun 17, 2022
by
Paul
Browse files
Tidy fixes
parent
390586c5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
11 deletions
+11
-11
src/targets/gpu/fuse_mlir.cpp
src/targets/gpu/fuse_mlir.cpp
+3
-3
src/targets/gpu/mlir.cpp
src/targets/gpu/mlir.cpp
+5
-5
test/gpu/mlir.cpp
test/gpu/mlir.cpp
+3
-3
No files found.
src/targets/gpu/fuse_mlir.cpp
View file @
33423f8c
...
...
@@ -23,7 +23,7 @@ struct mlir_conv
}
std
::
string
name
()
const
{
return
"gpu::mlir_conv"
;
}
shape
compute_shape
(
std
::
vector
<
shape
>
inputs
,
std
::
vector
<
module_ref
>
mods
)
const
shape
compute_shape
(
std
::
vector
<
shape
>
inputs
,
const
std
::
vector
<
module_ref
>
&
mods
)
const
{
check_shapes
{
inputs
,
*
this
}.
standard
();
if
(
mods
.
size
()
!=
1
)
...
...
@@ -47,12 +47,12 @@ struct find_conv_pointwise
return
match
::
name
(
"pointwise"
)(
match
::
any_of
[
match
::
inputs
()](
convolution
.
bind
(
"x"
)));
}
void
apply
(
module_pass_manager
&
mpm
,
match
::
matcher_result
r
)
const
void
apply
(
module_pass_manager
&
mpm
,
const
match
::
matcher_result
&
r
)
const
{
auto
ins
=
r
.
result
;
auto
conv_ins
=
r
.
instructions
[
"convolution"
];
auto
x_ins
=
r
.
instructions
[
"x"
];
// input after contiguous
auto
pm
=
ins
->
module_inputs
().
front
();
auto
*
pm
=
ins
->
module_inputs
().
front
();
auto
names
=
pm
->
get_parameter_names
();
// Whitelist pointwise operators
if
(
std
::
any_of
(
pm
->
begin
(),
pm
->
end
(),
[](
const
auto
&
i
)
{
...
...
src/targets/gpu/mlir.cpp
View file @
33423f8c
...
...
@@ -129,8 +129,8 @@ struct mlir_program
location
(
mlirLocationUnknownGet
(
ctx
.
get
())),
mmodule
(
mlirModuleCreateEmpty
(
location
))
{
MlirDialectHandle
mixr
H
andle
=
mlirGetDialectHandle__migraphx__
();
mlirDialectHandleRegisterDialect
(
mixr
H
andle
,
ctx
.
get
());
MlirDialectHandle
mixr
_h
andle
=
mlirGetDialectHandle__migraphx__
();
mlirDialectHandleRegisterDialect
(
mixr
_h
andle
,
ctx
.
get
());
mlirRegisterAllDialects
(
ctx
.
get
());
mlirContextSetAllowUnregisteredDialects
(
ctx
.
get
(),
true
/*allow*/
);
}
...
...
@@ -487,7 +487,7 @@ struct mlir_program
// 2nd pipeline to call
std
::
string
tname
=
get_device_name
();
// HACK: Since MLIR can't handle the full target name
auto
hacked_tname
=
tname
.
substr
(
0
,
tname
.
find
(
":"
));
auto
hacked_tname
=
tname
.
substr
(
0
,
tname
.
find
(
':'
));
if
(
tname
.
size
()
!=
hacked_tname
.
size
())
std
::
cout
<<
"*************** WARNING: MLIR may not compile the correct target features for: "
...
...
@@ -502,7 +502,7 @@ struct mlir_program
return
op
;
}
std
::
pair
<
std
::
size_t
,
std
::
size_t
>
get_launch_params
()
std
::
pair
<
std
::
size_t
,
std
::
size_t
>
get_launch_params
()
const
{
uint32_t
attrs
[
2
];
// returns block and grid sizes
...
...
@@ -512,7 +512,7 @@ struct mlir_program
return
{
global
,
local
};
}
value
::
binary
get_binary
()
value
::
binary
get_binary
()
const
{
int
size
=
0
;
mlirGetBinary
(
mmodule
.
get
(),
&
size
,
nullptr
);
...
...
test/gpu/mlir.cpp
View file @
33423f8c
...
...
@@ -29,19 +29,19 @@ struct mlir_gpu_target : migraphx::gpu::target
}
};
std
::
string
encode
(
std
::
string
s
)
std
::
string
encode
(
const
std
::
string
&
s
)
{
std
::
stringstream
ss
;
bool
prespace
=
false
;
for
(
auto
c
:
s
)
{
if
(
std
::
isspace
(
c
))
if
(
std
::
isspace
(
c
)
!=
0
)
{
if
(
not
prespace
)
ss
<<
" "
;
prespace
=
true
;
}
else
if
(
std
::
isprint
(
c
))
else
if
(
std
::
isprint
(
c
)
!=
0
)
{
ss
<<
c
;
prespace
=
false
;
...
...
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