Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Xiaomi
Mace
提交
b812c7a9
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,发现更多精彩内容 >>
提交
b812c7a9
编写于
3月 27, 2018
作者:
W
wuchenghui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support new version of nnlib named nngraph
上级
8619928b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
85 addition
and
47 deletion
+85
-47
mace/core/runtime/hexagon/hexagon_control_wrapper.cc
mace/core/runtime/hexagon/hexagon_control_wrapper.cc
+18
-6
third_party/nnlib/hexagon_nn.h
third_party/nnlib/hexagon_nn.h
+6
-3
third_party/nnlib/libhexagon_controller.so
third_party/nnlib/libhexagon_controller.so
+0
-0
third_party/nnlib/ops.h
third_party/nnlib/ops.h
+61
-38
未找到文件。
mace/core/runtime/hexagon/hexagon_control_wrapper.cc
浏览文件 @
b812c7a9
...
...
@@ -58,9 +58,9 @@ bool HexagonControlWrapper::Config() {
bool
HexagonControlWrapper
::
Init
()
{
LOG
(
INFO
)
<<
"Hexagon init"
;
nn_id_
=
hexagon_nn_init
(
);
MACE_CHECK
(
hexagon_nn_init
(
&
nn_id_
)
==
0
,
"hexagon_nn_init failed"
);
ResetPerfInfo
();
return
nn_id_
!=
0
;
return
true
;
}
bool
HexagonControlWrapper
::
Finalize
()
{
...
...
@@ -139,8 +139,19 @@ bool HexagonControlWrapper::SetupGraph(const NetDef &net_def,
inputs
[
i
].
output_idx
=
op
.
node_input
()[
i
].
output_port
();
}
outputs
.
resize
(
op
.
out_max_byte_size
().
size
());
for
(
int
i
=
0
;
i
<
op
.
out_max_byte_size
().
size
();
++
i
)
{
outputs
[
i
].
max_size
=
op
.
out_max_byte_size
()[
i
];
for
(
size_t
i
=
0
;
i
<
op
.
out_max_byte_size
().
size
();
++
i
)
{
outputs
[
i
].
rank
=
op
.
output_shape
()[
i
].
dims
().
size
();
for
(
size_t
j
=
0
;
j
<
outputs
[
i
].
rank
;
++
j
)
{
outputs
[
i
].
max_sizes
[
j
]
=
op
.
output_shape
()[
i
].
dims
()[
j
];
}
if
(
outputs
[
i
].
rank
==
0
)
{
outputs
[
i
].
rank
=
1
;
outputs
[
i
].
max_sizes
[
0
]
=
1
;
}
outputs
[
i
].
max_sizes
[
outputs
[
i
].
rank
]
=
0
;
outputs
[
i
].
elementsize
=
GetEnumTypeSize
(
op
.
output_type
()[
i
]);
outputs
[
i
].
zero_offset
=
0
;
outputs
[
i
].
stepsize
=
0
;
}
cached_inputs
.
push_back
(
inputs
);
cached_outputs
.
push_back
(
outputs
);
...
...
@@ -215,13 +226,13 @@ bool HexagonControlWrapper::SetupGraph(const NetDef &net_def,
int64_t
t1
=
NowMicros
();
int
res
=
hexagon_nn_prepare
(
nn_id_
);
MACE_CHECK
(
hexagon_nn_prepare
(
nn_id_
)
==
0
,
"hexagon_nn_prepare failed"
);
int64_t
t2
=
NowMicros
();
VLOG
(
1
)
<<
"Setup time: "
<<
t1
-
t0
<<
" "
<<
t2
-
t1
;
return
res
==
0
;
return
true
;
}
bool
HexagonControlWrapper
::
TeardownGraph
()
{
...
...
@@ -289,6 +300,7 @@ void HexagonControlWrapper::GetPerfInfo() {
std
::
string
node_type
(
node_type_buf
);
LOG
(
INFO
)
<<
"node id: "
<<
perf_info
[
i
].
node_id
<<
", node type: "
<<
node_type
<<
", node type id: "
<<
node_type_id
<<
", executions: "
<<
perf_info
[
i
].
executions
<<
", duration: "
<<
node_id_counters
[
node_id
];
...
...
third_party/nnlib/hexagon_nn.h
浏览文件 @
b812c7a9
...
...
@@ -77,8 +77,11 @@ struct hexagon_nn_input {
};
typedef
struct
hexagon_nn_output
hexagon_nn_output
;
struct
hexagon_nn_output
{
unsigned
int
max_size
;
unsigned
int
unused
;
unsigned
int
rank
;
unsigned
int
max_sizes
[
8
];
unsigned
int
elementsize
;
int
zero_offset
;
float
stepsize
;
};
typedef
struct
hexagon_nn_perfinfo
hexagon_nn_perfinfo
;
struct
hexagon_nn_perfinfo
{
...
...
@@ -128,7 +131,7 @@ struct hexagon_nn_const_node {
};
__QAIC_HEADER_EXPORT
int
__QAIC_HEADER
(
hexagon_nn_config
)(
void
)
__QAIC_HEADER_ATTRIBUTE
;
__QAIC_HEADER_EXPORT
int
__QAIC_HEADER
(
hexagon_nn_init
)(
void
)
__QAIC_HEADER_EXPORT
int
__QAIC_HEADER
(
hexagon_nn_init
)(
hexagon_nn_nn_id
*
g
)
__QAIC_HEADER_ATTRIBUTE
;
__QAIC_HEADER_EXPORT
int
__QAIC_HEADER
(
hexagon_nn_set_debug_level
)(
hexagon_nn_nn_id
id
,
int
level
)
__QAIC_HEADER_ATTRIBUTE
;
...
...
third_party/nnlib/libhexagon_controller.so
浏览文件 @
b812c7a9
无法预览此类型文件
third_party/nnlib/ops.h
浏览文件 @
b812c7a9
/*
* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted (subject to the limitations in the
* disclaimer below) provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* * Neither the name of The Linux Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
* GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/*
* You probably want to
...
...
@@ -107,6 +73,7 @@ DEF_OP_WREF(QuantizedRelu_8)
DEF_OP_WREF
(
QuantizedReluX_8
)
DEF_OP_WREF
(
QuantizedMaxPool_8
)
DEF_OP_WREF
(
QuantizedAvgPool_8
)
DEF_OP_WREF
(
QuantizedL2Pool_8
)
DEF_OP_WREF
(
QuantizedConcat_8
)
DEF_OP_WREF
(
QuantizedBiasAdd_8p8to32
)
DEF_OP_WREF
(
Min_f
)
...
...
@@ -122,6 +89,7 @@ DEF_OP(MatMul_f)
DEF_OP
(
Relu_f
)
DEF_OP
(
ReluX_f
)
DEF_OP
(
AvgPool_f
)
DEF_OP
(
L2Pool_f
)
DEF_OP
(
MaxPool_f
)
DEF_OP
(
Concat_f
)
DEF_OP
(
BiasAdd_f
)
...
...
@@ -187,6 +155,7 @@ DEF_OP_WREF(QuantizedSigmoid_8)
DEF_OP_WREF
(
QuantizedTanh_8
)
DEF_OP_WREF
(
QuantizedSoftmax_8
)
DEF_OP_WREF
(
QuantizedLRN_8
)
DEF_OP_WREF
(
Quantizedpad2d_frame_8p
)
DEF_OP_WREF
(
QuantizedSub_8p8to32
)
DEF_OP_WREF
(
QuantizedMaximum_8
)
DEF_OP_WREF
(
QuantizedMinimum_8
)
...
...
@@ -194,23 +163,77 @@ DEF_OP_WREF(QuantizedMinimum_8)
DEF_OP
(
Pad_f
)
DEF_OP
(
SpaceToBatchND_f
)
DEF_OP
(
BatchToSpaceND_f
)
DEF_OP
(
QuantizedSpaceToBatchND_8
)
DEF_OP
(
QuantizedBatchToSpaceND_8
)
DEF_OP
(
QuantizedPad_8
)
DEF_OP
(
ResizeBilinear_f
)
DEF_OP
(
QuantizedResizeBilinear_8
)
DEF_OP
(
ConcatV2_f
)
DEF_OP
(
ConcatV2_int32
)
DEF_OP
(
Prod_int32
)
DEF_OP
(
Slice_int32
)
DEF_OP
(
QuantizedAdd_8p8to8
)
DEF_OP
(
QuantizedResizeBilinear_8
)
DEF_OP
(
Supernode_8x8p8to8_d32
)
DEF_OP
(
Convert_to_d32
)
DEF_OP
(
Convert_from_d32
)
DEF_OP_WREF
(
QuantizedMaxPool_8_d32
)
DEF_OP_WREF
(
QuantizedConcat_8_d32
)
DEF_OP_WREF
(
QuantizedAvgPool_8_d32
)
DEF_OP
(
Sink
)
DEF_OP_WREF
(
QuantizedPRelu_8_d32
)
DEF_OP_WREF
(
AutoQuantize
)
DEF_OP_WREF
(
QuantizedDepthwiseConv2d_8x8to32
)
DEF_OP
(
DepthwiseConv2d_f
)
DEF_OP
(
QuantizedBiasAdd_8p8to8
)
DEF_OP
(
DepthwiseSupernode_8x8p8to8
)
DEF_OP
(
DepthwiseSupernode_8x8p8to8_d32
)
DEF_OP_WREF
(
QuantizedMul_8x8to8_d32
)
DEF_OP
(
FullyConnected_u8
)
#if 0
DEF_OP_WREF(QuantizedFC_8x8p8to8)
#endif
DEF_OP_WREF
(
QuantizedAdd_8p8to8_d32
)
DEF_OP_WREF
(
QuantizedClamp_8
)
DEF_OP
(
Clamp_f
)
DEF_OP
(
QuantizeForTest_d32
)
DEF_OP
(
Close_d32
)
DEF_OP_WREF
(
QuantizedSub_8p8to8_d32
)
DEF_OP
(
InputSupernode_8x8p8to8_outd32
)
DEF_OP
(
QuantizedLRN_8_d32
)
DEF_OP_WREF
(
QuantizedBiasAdd_32p32to32
)
DEF_OP_WREF
(
Quantize_int32
)
DEF_OP
(
Supernode_8x8p32to8
)
DEF_OP
(
DepthwiseSupernode_8x8p32to8
)
DEF_OP
(
Supernode_8x8p32to8_d32
)
DEF_OP
(
DepthwiseSupernode_8x8p32to8_d32
)
DEF_OP
(
InputSupernode_8x8p32to8_outd32
)
DEF_OP
(
PPrint_8_d32
)
DEF_OP
(
PPrintWithPadding_8_d32
)
DEF_OP_WREF
(
AutoQuantize_d32
)
DEF_OP_WREF
(
QuantizedTanh_8_d32
)
DEF_OP_WREF
(
QuantizedSigmoid_8_d32
)
DEF_OP_WREF
(
QuantizedSoftmax_8_d32
)
DEF_OP_WREF
(
QuantizedL2Pool_8_d32
)
DEF_OP
(
Gather_f
)
DEF_OP
(
Gather_int32
)
DEF_OP
(
Gather_8
)
DEF_OP
(
Table_f
)
DEF_OP
(
Table_int32
)
DEF_OP
(
Table_8
)
DEF_OP
(
FillPadding_8_d32
)
DEF_OP
(
QuantizedResizeBilinear_8_d32
)
#ifdef __SELF_DEF_OP_WREF
#undef __SELF_DEF_OP_WREF
#undef DEF_OP_WREF
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录