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
7309f43a
Commit
7309f43a
authored
Nov 16, 2023
by
Paul
Browse files
Enable fast mode by default
parent
0039b11a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
+16
-10
src/targets/gpu/fuse_mlir.cpp
src/targets/gpu/fuse_mlir.cpp
+16
-10
No files found.
src/targets/gpu/fuse_mlir.cpp
View file @
7309f43a
...
@@ -164,15 +164,21 @@ auto is_mlir_dot(mlir_mode mode)
...
@@ -164,15 +164,21 @@ auto is_mlir_dot(mlir_mode mode)
return
false
;
return
false
;
if
(
mode
!=
mlir_mode
::
fast
)
if
(
mode
!=
mlir_mode
::
fast
)
return
true
;
return
true
;
auto
a
=
ins
->
inputs
().
front
()
->
get_shape
();
float
a
=
ins
->
inputs
().
front
()
->
get_shape
();
auto
b
=
ins
->
inputs
().
back
()
->
get_shape
();
float
b
=
ins
->
inputs
().
back
()
->
get_shape
();
// auto m = a.lens()[a.lens().size() - 2];
float
m
=
a
.
lens
()[
a
.
lens
().
size
()
-
2
];
// auto n = b.lens().back();
float
n
=
b
.
lens
().
back
();
auto
k
=
a
.
lens
().
back
();
float
k
=
a
.
lens
().
back
();
// Skipping GEMMs with a K dimension greater than 2048 is a course-grained strategy
if
(
k
>
1024
)
// to avoid poor-performing GEMM kernels from MLIR
return
false
;
// To-do: Investigate a more precise strategy
auto
ratio
=
m
*
n
/
k
;
return
k
<=
2048
;
if
(
ratio
<
16384
)
return
false
;
return
true
;
// // Skipping GEMMs with a K dimension greater than 2048 is a course-grained strategy
// // to avoid poor-performing GEMM kernels from MLIR
// // To-do: Investigate a more precise strategy
// return k <= 2048;
});
});
}
}
...
@@ -418,7 +424,7 @@ void fuse_mlir::apply(module_pass_manager& mpm) const
...
@@ -418,7 +424,7 @@ void fuse_mlir::apply(module_pass_manager& mpm) const
match
::
find_matches
(
mpm
,
match
::
find_matches
(
mpm
,
find_mlir_fused_ops
{.
conv_mode
=
get_mode
(
"fused"
,
mlir_mode
::
fast
),
find_mlir_fused_ops
{.
conv_mode
=
get_mode
(
"fused"
,
mlir_mode
::
fast
),
.
dot_mode
=
get_mode
(
"fused"
,
m
ode
)});
.
dot_mode
=
get_mode
(
"fused"
,
m
lir_mode
::
fast
)});
match
::
find_matches
(
match
::
find_matches
(
mpm
,
mpm
,
...
...
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