Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Xiaomi
Mace
提交
bec34bb7
Mace
项目概览
Xiaomi
/
Mace
通知
106
Star
40
Fork
27
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Mace
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bec34bb7
编写于
1月 08, 2018
作者:
L
liuqi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix memory optimization bug and add some tuning parameters.
上级
bc576436
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
13 addition
and
6 deletion
+13
-6
mace/kernels/opencl/addn.cc
mace/kernels/opencl/addn.cc
+1
-0
mace/kernels/opencl/batch_norm_opencl.cc
mace/kernels/opencl/batch_norm_opencl.cc
+1
-0
mace/kernels/opencl/concat.cc
mace/kernels/opencl/concat.cc
+1
-0
mace/kernels/opencl/conv_2d_opencl_1x1.cc
mace/kernels/opencl/conv_2d_opencl_1x1.cc
+1
-0
mace/kernels/opencl/conv_2d_opencl_3x3.cc
mace/kernels/opencl/conv_2d_opencl_3x3.cc
+1
-0
mace/kernels/opencl/conv_2d_opencl_general.cc
mace/kernels/opencl/conv_2d_opencl_general.cc
+1
-0
mace/kernels/opencl/pooling_opencl.cc
mace/kernels/opencl/pooling_opencl.cc
+1
-0
mace/kernels/opencl/relu_opencl.cc
mace/kernels/opencl/relu_opencl.cc
+1
-0
mace/kernels/opencl/resize_bilinear_opencl.cc
mace/kernels/opencl/resize_bilinear_opencl.cc
+1
-0
mace/kernels/opencl/softmax_opencl.cc
mace/kernels/opencl/softmax_opencl.cc
+1
-0
mace/python/tools/memory_optimizer.py
mace/python/tools/memory_optimizer.py
+2
-5
tools/gcn.config
tools/gcn.config
+1
-1
未找到文件。
mace/kernels/opencl/addn.cc
浏览文件 @
bec34bb7
...
...
@@ -54,6 +54,7 @@ static void AddN(const std::vector<const Tensor *> &input_tensors,
local_ws
[
0
]
=
std
::
min
<
uint32_t
>
(
width_pixels
,
kwg_size
);
local_ws
[
1
]
=
std
::
min
<
uint32_t
>
(
batch_height_pixels
,
kwg_size
/
local_ws
[
0
]);
return
{{
local_ws
[
0
],
local_ws
[
1
]},
{
local_ws
[
1
],
local_ws
[
0
]},
{
kwg_size
/
16
,
16
},
{
kwg_size
/
32
,
32
},
{
kwg_size
/
64
,
64
},
...
...
mace/kernels/opencl/batch_norm_opencl.cc
浏览文件 @
bec34bb7
...
...
@@ -67,6 +67,7 @@ void BatchNormFunctor<DeviceType::OPENCL, T>::operator()(
local_ws
[
2
]
=
std
::
min
<
uint32_t
>
(
height
*
batch
,
kwg_size
/
(
local_ws
[
0
]
*
local_ws
[
1
]));
return
{{
8
,
128
,
1
},
//SNPE size
{
local_ws
[
0
],
local_ws
[
1
],
local_ws
[
2
]},
{
local_ws
[
2
],
local_ws
[
1
],
local_ws
[
0
]},
{
kwg_size
/
16
,
4
,
4
},
{
kwg_size
/
32
,
4
,
8
},
{
kwg_size
/
32
,
8
,
4
},
...
...
mace/kernels/opencl/concat.cc
浏览文件 @
bec34bb7
...
...
@@ -57,6 +57,7 @@ static void Concat2(const Tensor *input0,
local_ws
[
2
]
=
std
::
min
<
uint32_t
>
(
height
*
batch
,
kwg_size
/
(
local_ws
[
0
]
*
local_ws
[
1
]));
return
{{
4
,
15
,
8
},
//SNPE size
{
local_ws
[
0
],
local_ws
[
1
],
local_ws
[
2
]},
{
local_ws
[
2
],
local_ws
[
1
],
local_ws
[
0
]},
{
kwg_size
/
16
,
4
,
4
},
{
kwg_size
/
32
,
4
,
8
},
{
kwg_size
/
32
,
8
,
4
},
...
...
mace/kernels/opencl/conv_2d_opencl_1x1.cc
浏览文件 @
bec34bb7
...
...
@@ -74,6 +74,7 @@ void Conv1x1(const Tensor *input,
local_ws
[
2
]
=
std
::
min
<
uint32_t
>
(
height
*
batch
,
kwg_size
/
(
local_ws
[
0
]
*
local_ws
[
1
]));
return
{{
4
,
15
,
8
},
//SNPE size
{
local_ws
[
0
],
local_ws
[
1
],
local_ws
[
2
]},
{
local_ws
[
2
],
local_ws
[
1
],
local_ws
[
0
]},
{
kwg_size
/
16
,
4
,
4
},
{
kwg_size
/
32
,
4
,
8
},
{
kwg_size
/
32
,
8
,
4
},
...
...
mace/kernels/opencl/conv_2d_opencl_3x3.cc
浏览文件 @
bec34bb7
...
...
@@ -68,6 +68,7 @@ static void Conv2d3x3S12(const Tensor *input, const Tensor *filter,
local_ws
[
2
]
=
std
::
min
<
uint32_t
>
(
height
*
batch
,
kwg_size
/
(
local_ws
[
0
]
*
local_ws
[
1
]));
return
{{
4
,
15
,
8
},
//SNPE size
{
local_ws
[
0
],
local_ws
[
1
],
local_ws
[
2
]},
{
local_ws
[
2
],
local_ws
[
1
],
local_ws
[
0
]},
{
kwg_size
/
16
,
4
,
4
},
{
kwg_size
/
32
,
4
,
8
},
{
kwg_size
/
32
,
8
,
4
},
...
...
mace/kernels/opencl/conv_2d_opencl_general.cc
浏览文件 @
bec34bb7
...
...
@@ -70,6 +70,7 @@ void Conv2dOpencl(const Tensor *input, const Tensor *filter,
local_ws
[
2
]
=
std
::
min
<
uint32_t
>
(
height
*
batch
,
kwg_size
/
(
local_ws
[
0
]
*
local_ws
[
1
]));
return
{{
4
,
15
,
8
},
//SNPE size
{
local_ws
[
0
],
local_ws
[
1
],
local_ws
[
2
]},
{
local_ws
[
2
],
local_ws
[
1
],
local_ws
[
0
]},
{
kwg_size
/
16
,
4
,
4
},
{
kwg_size
/
32
,
4
,
8
},
{
kwg_size
/
32
,
8
,
4
},
...
...
mace/kernels/opencl/pooling_opencl.cc
浏览文件 @
bec34bb7
...
...
@@ -69,6 +69,7 @@ static void Pooling(const Tensor *input,
local_ws
[
2
]
=
std
::
min
<
uint32_t
>
(
out_height
*
batch
,
kwg_size
/
(
local_ws
[
0
]
*
local_ws
[
1
]));
return
{{
4
,
15
,
8
},
//SNPE size
{
local_ws
[
0
],
local_ws
[
1
],
local_ws
[
2
]},
{
local_ws
[
2
],
local_ws
[
1
],
local_ws
[
0
]},
{
kwg_size
/
16
,
4
,
4
},
{
kwg_size
/
32
,
4
,
8
},
{
kwg_size
/
32
,
8
,
4
},
...
...
mace/kernels/opencl/relu_opencl.cc
浏览文件 @
bec34bb7
...
...
@@ -57,6 +57,7 @@ void ReluFunctor<DeviceType::OPENCL, T>::operator()(const Tensor *input,
local_ws
[
2
]
=
std
::
min
<
uint32_t
>
(
height
*
batch
,
kwg_size
/
(
local_ws
[
0
]
*
local_ws
[
1
]));
return
{{
4
,
15
,
8
},
//SNPE size
{
local_ws
[
0
],
local_ws
[
1
],
local_ws
[
2
]},
{
local_ws
[
2
],
local_ws
[
1
],
local_ws
[
0
]},
{
kwg_size
/
16
,
4
,
4
},
{
kwg_size
/
32
,
4
,
8
},
{
kwg_size
/
32
,
8
,
4
},
...
...
mace/kernels/opencl/resize_bilinear_opencl.cc
浏览文件 @
bec34bb7
...
...
@@ -66,6 +66,7 @@ void ResizeBilinearFunctor<DeviceType::OPENCL, T>::operator()(
local_ws
[
2
]
=
std
::
min
<
uint32_t
>
(
out_height
*
batch
,
kwg_size
/
(
local_ws
[
0
]
*
local_ws
[
1
]));
return
{{
4
,
15
,
8
},
//SNPE size
{
local_ws
[
0
],
local_ws
[
1
],
local_ws
[
2
]},
{
local_ws
[
2
],
local_ws
[
1
],
local_ws
[
0
]},
{
kwg_size
/
16
,
4
,
4
},
{
kwg_size
/
32
,
4
,
8
},
{
kwg_size
/
32
,
8
,
4
},
...
...
mace/kernels/opencl/softmax_opencl.cc
浏览文件 @
bec34bb7
...
...
@@ -48,6 +48,7 @@ void SoftmaxFunctor<DeviceType::OPENCL, T>::operator()(const Tensor *logits,
local_ws
[
2
]
=
std
::
min
<
uint32_t
>
(
height
*
batch
,
kwg_size
/
(
local_ws
[
0
]
*
local_ws
[
1
]));
return
{{
4
,
15
,
8
},
//SNPE size
{
local_ws
[
0
],
local_ws
[
1
],
local_ws
[
2
]},
{
local_ws
[
2
],
local_ws
[
1
],
local_ws
[
0
]},
{
kwg_size
/
16
,
4
,
4
},
{
kwg_size
/
32
,
4
,
8
},
{
kwg_size
/
32
,
8
,
4
},
...
...
mace/python/tools/memory_optimizer.py
浏览文件 @
bec34bb7
...
...
@@ -23,15 +23,12 @@ class MemoryOptimizer(object):
for
op
in
net_def
.
op
:
if
self
.
is_buffer_image_op
(
op
):
continue
tensor_name
=
self
.
_op_to_tensor
(
op
)
tensor_name
=
op
.
output
[
0
]
if
tensor_name
in
consumers
:
self
.
ref_counter
[
tensor_name
]
=
len
(
consumers
[
tensor_name
])
else
:
self
.
ref_counter
[
tensor_name
]
=
0
def
_op_to_tensor
(
self
,
op
):
return
op
.
name
+
':0'
def
is_buffer_image_op
(
self
,
op
):
return
op
.
type
==
'BufferToImage'
or
op
.
type
==
'ImageToBuffer'
...
...
@@ -51,7 +48,7 @@ class MemoryOptimizer(object):
print
(
'WARNING: There is no output shape information to do memory optimization.'
)
return
op
.
mem_id
=
mem_id
self
.
op_mem
[
self
.
_op_to_tensor
(
op
)
]
=
mem_id
self
.
op_mem
[
op
.
output
[
0
]
]
=
mem_id
if
mem_id
not
in
self
.
mem_block
:
self
.
mem_block
[
mem_id
]
=
[
0
,
0
]
mem_size
=
self
.
mem_block
[
mem_id
]
...
...
tools/gcn.config
浏览文件 @
bec34bb7
TF_INPUT_NODE
=
input
TF_OUTPUT_NODE
=
GCN
/
br_result_2
/
fcn_br
\ No newline at end of file
TF_OUTPUT_NODE
=
softmax
/
Reshape_1
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录