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
859138fb
"git@developer.sourcefind.cn:gaoqiong/migraphx.git" did not exist on "ac031de5374e895fd9ce064cdf01a4d8927c8ca2"
Commit
859138fb
authored
Aug 03, 2023
by
Alan Turner
Browse files
Formatting
parent
f4947cb3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
7 deletions
+19
-7
test/onnx/gen_onnx.py
test/onnx/gen_onnx.py
+2
-0
tools/gemm_perf.py
tools/gemm_perf.py
+17
-7
No files found.
test/onnx/gen_onnx.py
View file @
859138fb
...
...
@@ -32,7 +32,9 @@ from onnx.numpy_helper import from_array
def
onnx_test
(
external_data
=
False
):
def
create_onnx_test
(
op_test
):
def
run_test
():
op_info
=
op_test
()
if
len
(
op_info
)
>
3
:
...
...
tools/gemm_perf.py
View file @
859138fb
...
...
@@ -6,14 +6,16 @@ import matplotlib.pyplot as plt
from
pylab
import
*
import
random
def
parse_args
():
parser
=
argparse
.
ArgumentParser
(
description
=
"GEMM performance tools"
)
parser
.
add_argument
(
'--bert'
,
action
=
'store_true'
,
help
=
'Run GEMM performance comparisons on BERT model'
)
parser
.
add_argument
(
'--gemm'
,
action
=
'store_true'
,
help
=
'Run performance comparison on a range of GEMM problem sizes'
)
parser
.
add_argument
(
'--gemm'
,
action
=
'store_true'
,
help
=
'Run performance comparison on a range of GEMM problem sizes'
)
args
=
parser
.
parse_args
()
return
args
...
...
@@ -171,6 +173,7 @@ def run_bert_perf():
cf
.
write_row
([
"rocBLAS"
]
+
run_perf
(
model
,
batch_size
,
quantize
))
cf
.
write_row
()
def
gemm_perf
(
b
,
m
,
n
,
k
,
fp16
):
print
(
f
"
{
b
}
,
{
m
}
,
{
n
}
,
{
k
}
:"
,
end
=
" "
)
model
=
"../test/onnx/matmul_half.onnx"
if
fp16
else
"../test/onnx/matmul_int8.onnx"
...
...
@@ -185,7 +188,11 @@ def gemm_perf(b, m, n, k, fp16):
cmd
=
f
"../build/bin/driver perf
{
model
}
--input-dim @1
{
b
}
{
m
}
{
k
}
@2
{
b
}
{
k
}
{
n
}
--exhaustive-tune"
try
:
out
=
subprocess
.
run
(
cmd
.
split
(),
capture_output
=
True
,
check
=
True
,
timeout
=
300
,
env
=
dict
(
os
.
environ
,
MIGRAPHX_ENABLE_CK
=
"1"
))
out
=
subprocess
.
run
(
cmd
.
split
(),
capture_output
=
True
,
check
=
True
,
timeout
=
300
,
env
=
dict
(
os
.
environ
,
MIGRAPHX_ENABLE_CK
=
"1"
))
except
:
print
(
"-69.0"
)
return
-
69.0
...
...
@@ -196,22 +203,25 @@ def gemm_perf(b, m, n, k, fp16):
total_time
=
total_time
.
replace
(
"Total time: "
,
""
)
ck_time
=
total_time
diff
=
float
(
ck_time
)
-
float
(
rb_time
)
diff
=
float
(
ck_time
)
-
float
(
rb_time
)
print
(
f
"
{
diff
}
"
)
return
diff
def
run_gemm_perf
():
batches
=
[
1
]
sizes
=
[
64
,
256
,
384
,
768
,
1024
,
2048
,
2304
,
3072
]
results
=
[(
b
,
m
,
n
,
k
,
gemm_perf
(
b
,
m
,
n
,
k
,
False
))
for
b
in
batches
for
m
in
sizes
for
n
in
sizes
for
k
in
sizes
]
results
=
[(
b
,
m
,
n
,
k
,
gemm_perf
(
b
,
m
,
n
,
k
,
False
))
for
b
in
batches
for
m
in
sizes
for
n
in
sizes
for
k
in
sizes
]
print
(
results
)
with
open
(
"gemm_results.txt"
,
"w+"
)
as
f
:
for
r
in
results
:
f
.
write
(
f
"
{
r
[
0
]
}
,
{
r
[
1
]
}
,
{
r
[
2
]
}
,
{
r
[
3
]
}
,
{
r
[
4
]
}
\n
"
)
if
__name__
==
"__main__"
:
args
=
parse_args
()
if
args
.
bert
:
run_bert_perf
()
if
args
.
gemm
:
run_gemm_perf
()
\ No newline at end of file
run_gemm_perf
()
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