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
b3fb3a7e
Commit
b3fb3a7e
authored
Jan 04, 2023
by
jungpark-mlir
Browse files
Add support for the new rocmlir tuning
parent
3af83bae
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
5 deletions
+31
-5
src/targets/gpu/mlir.cpp
src/targets/gpu/mlir.cpp
+31
-5
No files found.
src/targets/gpu/mlir.cpp
View file @
b3fb3a7e
...
...
@@ -519,9 +519,6 @@ struct mlir_program
// check if HW supports xdlops
auto
target_chip
=
trim
(
split_string
(
target_arch
,
':'
).
front
());
bool
xdlops
=
contains
(
get_xdlops_archs
(),
target_chip
);
std
::
string
tuned
=
get_tune_params
(
xdlops
);
if
(
not
tuned
.
empty
())
ops
.
add_attributes
({{
"perf_config"
,
tuned
}});
if
(
xdlops
)
ops
.
add_attributes
({{
"xdlopsV2"
,
true
}});
}
...
...
@@ -580,12 +577,39 @@ struct mlir_program
std
::
string
get_tune_params
(
bool
xdlops
)
{
return
get_mlir_perf_for_conv
(
pp
,
xdlops
);
}
void
tuning_table_create
()
{
tuning_table
=
mlirRockTuningTableCreate
();
const
auto
file_path
=
fs
::
path
{
"/opt"
}
/
"rocm"
/
"share"
/
"miopen"
/
"db"
/
"rockgemm.tsv"
;
std
::
ifstream
table_in
(
file_path
);
std
::
string
arch
,
prob
,
perf
;
while
(
getline
(
table_in
,
arch
,
"
\t
"
))
{
getline
(
table_in
,
prob
,
"
\t
"
);
getline
(
table_in
,
perf
,
"
\t
"
);
mlirRockTuningUpdateTable
(
tuning_tTable
,
prob
.
c_str
(),
perf
.
c_str
(),
1.0
);
}
table_in
.
close
();
}
bool
get_module_tuned
()
{
if
(
!
mlirRockTuningSetFromTable
(
tuning_table
,
mmodule
.
get
()))
{
printf
(
"fails to set param
\n
"
);
return
false
;
}
return
true
;
}
mlir_context
ctx
;
MlirLocation
location
;
mlir_module
mmodule
;
problem_params
pp
;
std
::
deque
<
std
::
string
>
strings
{};
std
::
string
target_arch
;
MlirRockTuningTable
tuning_table
;
};
std
::
string
dump_mlir
(
const
module
&
m
)
...
...
@@ -654,6 +678,8 @@ code_object_op compile_mlir(const context&, module m, const std::vector<instruct
mlir_program
mp
;
mp
.
find_target
();
mp
.
parse
(
m
);
mp
.
tuning_table_create
();
mp
.
get_module_tuned
();
auto
mod_op
=
mlirModuleGetOperation
(
mp
.
mmodule
.
get
());
if
(
trace
)
std
::
cout
<<
mlir_print
(
&
mlirOperationPrint
,
mod_op
)
<<
std
::
endl
;
...
...
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