Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyuanbo
tic
Commits
9a620c69
Commit
9a620c69
authored
Oct 02, 2018
by
Lianmin Zheng
Committed by
Tianqi Chen
Oct 02, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TOPI] Update TopHub and benchmark (#1796)
parent
72cab4ee
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
36 additions
and
31 deletions
+36
-31
apps/benchmark/arm_cpu_imagenet_bench.py
+5
-3
apps/benchmark/gpu_imagenet_bench.py
+4
-2
apps/benchmark/mobile_gpu_imagenet_bench.py
+5
-3
python/tvm/autotvm/tophub.py
+6
-4
topi/python/topi/arm_cpu/conv2d.py
+2
-2
topi/python/topi/mali/conv2d.py
+8
-2
topi/tests/python/test_topi_conv2d_nchw.py
+2
-7
topi/tests/python/test_topi_depthwise_conv2d.py
+4
-8
No files found.
apps/benchmark/arm_cpu_imagenet_bench.py
View file @
9a620c69
...
...
@@ -58,8 +58,10 @@ def evaluate_network(network, target, target_host, number):
if
__name__
==
"__main__"
:
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"--network"
,
type
=
str
,
choices
=
[
'resnet-18'
,
'resnet-34'
,
'vgg-16'
,
'mobilenet'
,
'mobilenet_v2'
,
'squeezenet v1.0'
,
'squeezenet v1.1'
])
[
'resnet-18'
,
'resnet-34'
,
'resnet-50'
,
'vgg-16'
,
'vgg-19'
,
'densenet-121'
,
'inception_v3'
,
'mobilenet'
,
'mobilenet_v2'
,
'squeezenet_v1.0'
,
'squeezenet_v1.1'
],
help
=
'The name of neural network'
)
parser
.
add_argument
(
"--model"
,
type
=
str
,
choices
=
[
'rk3399'
,
'mate10'
,
'mate10pro'
,
'p20'
,
'p20pro'
,
'pixel2'
,
'rasp3b'
,
'pynq'
],
default
=
'rk3399'
,
...
...
@@ -68,7 +70,7 @@ if __name__ == "__main__":
parser
.
add_argument
(
"--host"
,
type
=
str
,
default
=
'localhost'
)
parser
.
add_argument
(
"--port"
,
type
=
int
,
default
=
9190
)
parser
.
add_argument
(
"--rpc-key"
,
type
=
str
,
required
=
True
)
parser
.
add_argument
(
"--number"
,
type
=
int
,
default
=
6
)
parser
.
add_argument
(
"--number"
,
type
=
int
,
default
=
3
)
args
=
parser
.
parse_args
()
dtype
=
'float32'
...
...
apps/benchmark/gpu_imagenet_bench.py
View file @
9a620c69
...
...
@@ -17,8 +17,10 @@ from util import get_network
if
__name__
==
"__main__"
:
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"--network"
,
type
=
str
,
choices
=
[
'resnet-18'
,
'resnet-34'
,
'resnet-50'
,
'vgg-16'
,
'vgg-19'
,
'inception_v3'
,
'mobilenet'
,
'mobilenet_v2'
,
'densenet-121'
])
[
'resnet-18'
,
'resnet-34'
,
'resnet-50'
,
'vgg-16'
,
'vgg-19'
,
'densenet-121'
,
'inception_v3'
,
'mobilenet'
,
'mobilenet_v2'
,
'squeezenet_v1.0'
,
'squeezenet_v1.1'
],
help
=
'The name of neural network'
)
parser
.
add_argument
(
"--model"
,
type
=
str
,
choices
=
[
'1080ti'
,
'titanx'
,
'gfx900'
],
default
=
'1080ti'
,
help
=
"The model of the test device. If your device is not listed in "
...
...
apps/benchmark/mobile_gpu_imagenet_bench.py
View file @
9a620c69
...
...
@@ -58,8 +58,10 @@ def evaluate_network(network, target, target_host, number):
if
__name__
==
"__main__"
:
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"--network"
,
type
=
str
,
choices
=
[
'resnet-18'
,
'resnet-34'
,
'vgg-16'
,
'mobilenet'
,
'mobilenet_v2'
,
'squeezenet v1.1'
])
[
'resnet-18'
,
'resnet-34'
,
'resnet-50'
,
'vgg-16'
,
'vgg-19'
,
'densenet-121'
,
'inception_v3'
,
'mobilenet'
,
'mobilenet_v2'
,
'squeezenet_v1.0'
,
'squeezenet_v1.1'
],
help
=
'The name of neural network'
)
parser
.
add_argument
(
"--model"
,
type
=
str
,
choices
=
[
'rk3399'
],
default
=
'rk3399'
,
help
=
"The model of the test device. If your device is not listed in "
...
...
@@ -67,7 +69,7 @@ if __name__ == "__main__":
parser
.
add_argument
(
"--host"
,
type
=
str
,
default
=
'localhost'
)
parser
.
add_argument
(
"--port"
,
type
=
int
,
default
=
9190
)
parser
.
add_argument
(
"--rpc-key"
,
type
=
str
,
required
=
True
)
parser
.
add_argument
(
"--number"
,
type
=
int
,
default
=
1
0
)
parser
.
add_argument
(
"--number"
,
type
=
int
,
default
=
3
0
)
args
=
parser
.
parse_args
()
dtype
=
'float32'
...
...
python/tvm/autotvm/tophub.py
View file @
9a620c69
...
...
@@ -20,12 +20,12 @@ AUTOTVM_TOPHUB_ROOT_PATH = os.path.join(os.path.expanduser('~'), ".tvm", "tophub
# the version of each package
PACKAGE_VERSION
=
{
'arm_cpu'
:
"v0.0
1
"
,
'arm_cpu'
:
"v0.0
3
"
,
'cuda'
:
"v0.02"
,
'rocm'
:
"v0.01"
,
'opencl'
:
"v0.01"
,
'mali'
:
"v0.0
1
"
,
'mali'
:
"v0.0
2
"
,
'vta'
:
"v0.01"
,
}
...
...
@@ -38,7 +38,7 @@ def _alias(name):
'vtacpu'
:
'vta'
,
'metal'
:
'opencl'
,
'nvptx'
:
'cuda'
'nvptx'
:
'cuda'
,
}
return
table
.
get
(
name
,
name
)
...
...
@@ -61,11 +61,12 @@ def context(target, extra_files=None):
if
isinstance
(
target
,
str
):
target
=
_target
.
create
(
target
)
possible_names
=
[
str
(
target
)
.
split
()[
0
]
]
possible_names
=
[]
for
opt
in
target
.
options
:
if
opt
.
startswith
(
"-device"
):
device
=
_alias
(
opt
[
8
:])
possible_names
.
append
(
device
)
possible_names
.
append
(
target
.
target_name
)
all_packages
=
list
(
PACKAGE_VERSION
.
keys
())
for
name
in
possible_names
:
...
...
@@ -75,6 +76,7 @@ def context(target, extra_files=None):
filename
=
"
%
s_
%
s.log"
%
(
name
,
PACKAGE_VERSION
[
name
])
best_context
.
load
(
os
.
path
.
join
(
AUTOTVM_TOPHUB_ROOT_PATH
,
filename
))
break
# only load one file to avoid some fallback template mismatch problem
if
extra_files
:
for
filename
in
extra_files
:
...
...
topi/python/topi/arm_cpu/conv2d.py
View file @
9a620c69
...
...
@@ -506,8 +506,8 @@ def schedule_conv2d_winograd_without_weight_transform_(cfg, outs):
##### REGISTER ALTER OP LAYOUT #####
@conv2d_alter_layout.register
([
"arm_cpu"
,
"mali"
])
def
_alter_conv2d_layout
(
attrs
,
inputs
,
tinfos
):
@conv2d_alter_layout.register
([
"arm_cpu"
])
def
_alter_conv2d_layout
_arm
(
attrs
,
inputs
,
tinfos
):
"""Alter op layout for pre-computing kernel transformation"""
import
nnvm.symbol
as
sym
copy_inputs
=
[
s
for
s
in
inputs
]
...
...
topi/python/topi/mali/conv2d.py
View file @
9a620c69
...
...
@@ -9,11 +9,11 @@ from tvm.autotvm.task.space import get_factors
from
..generic
import
schedule_conv2d_nchw
,
schedule_conv2d_winograd_without_weight_transform
from
..util
import
traverse_inline
,
get_const_int
,
get_const_tuple
,
const_matrix
from
..nn
import
conv2d
,
conv2d_winograd_without_weight_transform
,
\
get_pad_tuple
,
pad
get_pad_tuple
,
pad
,
conv2d_alter_layout
# reuse some compute declarations from ARM CPU
from
..arm_cpu.conv2d
import
_conv_arg_to_workload
,
_decl_spatial_pack
,
\
_winograd_conv_arg_to_workload
_winograd_conv_arg_to_workload
,
_alter_conv2d_layout_arm
@conv2d.register
(
'mali'
)
...
...
@@ -410,6 +410,12 @@ def _schedule_winograd(cfg, s, op):
s
[
Y
]
.
compute_at
(
s
[
output
],
tt
)
@conv2d_alter_layout.register
([
"mali"
])
def
_alter_conv2d_layout
(
attrs
,
inputs
,
tinfos
):
try
:
return
_alter_conv2d_layout_arm
(
attrs
,
inputs
,
tinfos
)
except
KeyError
:
# to filter out fallback opencl templates
return
None
##### REGISTER TOPI COMPUTE / SCHEDULE FOR WINOGRAD WITH WEIGHT TRANSFORM #####
@conv2d_winograd_without_weight_transform.register
([
'mali'
])
...
...
topi/tests/python/test_topi_conv2d_nchw.py
View file @
9a620c69
...
...
@@ -69,16 +69,11 @@ def verify_conv2d_nchw(batch, in_channel, in_size, num_filter, kernel, stride, p
np
.
testing
.
assert_allclose
(
c
.
asnumpy
(),
c_np
,
rtol
=
1e-5
)
for
device
in
get_all_backend
():
check_device
(
device
)
with
autotvm
.
tophub
.
context
(
device
):
# load tophub pre-tuned parameters
check_device
(
device
)
def
test_conv2d_nchw
():
# load tophub
ctx
=
autotvm
.
apply_history_best
([])
for
device
in
get_all_backend
():
context
=
autotvm
.
tophub
.
context
(
device
)
context
.
__enter__
()
# ResNet18 workloads
verify_conv2d_nchw
(
1
,
3
,
224
,
64
,
7
,
2
,
3
)
verify_conv2d_nchw
(
1
,
64
,
56
,
64
,
3
,
1
,
1
)
...
...
topi/tests/python/test_topi_depthwise_conv2d.py
View file @
9a620c69
...
...
@@ -102,7 +102,8 @@ def depthwise_conv2d_with_workload_nchw(batch, in_channel, in_height, channel_mu
np
.
testing
.
assert_allclose
(
relu_tvm
.
asnumpy
(),
relu_scipy
,
rtol
=
1e-5
)
for
device
in
get_all_backend
():
check_device
(
device
)
with
autotvm
.
tophub
.
context
(
device
):
# load tophub pre-tuned parameters
check_device
(
device
)
def
depthwise_conv2d_with_workload_nhwc
(
batch
,
in_channel
,
in_height
,
channel_multiplier
,
filter_height
,
stride_h
,
padding
,
dilation
=
1
):
...
...
@@ -201,16 +202,11 @@ def depthwise_conv2d_with_workload_nhwc(batch, in_channel, in_height, channel_mu
np
.
testing
.
assert_allclose
(
relu_tvm
.
asnumpy
(),
relu_scipy
,
rtol
=
1e-5
)
for
device
in
get_all_backend
():
check_device
(
device
)
with
autotvm
.
tophub
.
context
(
device
):
# load tophub pre-tuned parameters
check_device
(
device
)
def
test_depthwise_conv2d
():
# load tophub
ctx
=
autotvm
.
apply_history_best
([])
for
device
in
get_all_backend
():
context
=
autotvm
.
tophub
.
context
(
device
)
context
.
__enter__
()
# mobilenet workloads
depthwise_conv2d_with_workload_nchw
(
1
,
32
,
112
,
1
,
3
,
1
,
"SAME"
)
depthwise_conv2d_with_workload_nchw
(
1
,
64
,
112
,
1
,
3
,
2
,
"SAME"
)
...
...
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