Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MindSpore
mindspore
提交
9730e1f4
M
mindspore
项目概览
MindSpore
/
mindspore
通知
35
Star
15
Fork
15
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
9730e1f4
编写于
9月 02, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
9月 02, 2020
浏览文件
操作
浏览文件
下载
差异文件
!5630 [MS][LITE][Develop] conv1x1 int8 bug : input buf malloc using allocator
Merge pull request !5630 from ling/optimize
上级
4ec34396
7781f704
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
17 addition
and
24 deletion
+17
-24
mindspore/lite/src/runtime/kernel/arm/int8/convolution_1x1_int8.cc
.../lite/src/runtime/kernel/arm/int8/convolution_1x1_int8.cc
+17
-24
未找到文件。
mindspore/lite/src/runtime/kernel/arm/int8/convolution_1x1_int8.cc
浏览文件 @
9730e1f4
...
...
@@ -170,36 +170,28 @@ int Convolution1x1Int8CPUKernel::InitParam() {
matmul_param_
->
deep_4_
=
UP_ROUND
(
matmul_param_
->
deep_
,
C4NUM
);
matmul_param_
->
deep_16_
=
UP_ROUND
(
matmul_param_
->
deep_
,
C16NUM
);
/* init input sum size */
int
row_pack_count
=
0
;
int
col_pack_count
=
0
;
if
(
support_optimize_
)
{
if
(
conv_quant_arg_
->
per_channel_
&
FILTER_PER_CHANNEL
)
{
input_sum_size
=
UP_ROUND
(
conv_param_
->
output_channel_
,
C8NUM
)
*
UP_ROUND
(
matmul_param_
->
row_
,
C8NUM
);
}
else
{
input_sum_size
=
UP_ROUND
(
matmul_param_
->
row_
,
C8NUM
);
}
row_pack_count
=
C8NUM
;
col_pack_count
=
C8NUM
;
}
else
{
if
(
conv_quant_arg_
->
per_channel_
&
FILTER_PER_CHANNEL
)
{
input_sum_size
=
UP_ROUND
(
conv_param_
->
output_channel_
,
C4NUM
)
*
UP_ROUND
(
matmul_param_
->
row_
,
C4NUM
);
}
else
{
input_sum_size
=
UP_ROUND
(
matmul_param_
->
row_
,
C4NUM
);
}
row_pack_count
=
C4NUM
;
col_pack_count
=
C4NUM
;
}
if
(
support_optimize_
)
{
thread_count_
=
MSMIN
(
op_parameter_
->
thread_num_
,
UP_DIV
(
matmul_param_
->
col_
,
C8NUM
));
thread_stride_
=
UP_DIV
(
UP_DIV
(
matmul_param_
->
col_
,
C8NUM
),
thread_count_
);
/* init input sum size */
if
(
conv_quant_arg_
->
per_channel_
&
FILTER_PER_CHANNEL
)
{
input_sum_size
=
UP_ROUND
(
matmul_param_
->
col_
,
col_pack_count
)
*
UP_ROUND
(
matmul_param_
->
row_
,
row_pack_count
);
}
else
{
thread_count_
=
MSMIN
(
op_parameter_
->
thread_num_
,
UP_DIV
(
matmul_param_
->
col_
,
C4NUM
));
thread_stride_
=
UP_DIV
(
UP_DIV
(
matmul_param_
->
col_
,
C4NUM
),
thread_count_
);
input_sum_size
=
UP_ROUND
(
matmul_param_
->
row_
,
row_pack_count
);
}
if
(
support_optimize_
)
{
thread_count_hw_
=
MSMIN
(
op_parameter_
->
thread_num_
,
UP_DIV
(
matmul_param_
->
row_
,
C8NUM
));
thread_stride_hw_
=
UP_DIV
(
UP_DIV
(
matmul_param_
->
row_
,
C8NUM
),
thread_count_hw_
);
}
else
{
thread_count_hw_
=
MSMIN
(
op_parameter_
->
thread_num_
,
UP_DIV
(
matmul_param_
->
row_
,
C4NUM
));
thread_stride_hw_
=
UP_DIV
(
UP_DIV
(
matmul_param_
->
row_
,
C4NUM
),
thread_count_hw_
);
}
thread_count_
=
MSMIN
(
op_parameter_
->
thread_num_
,
UP_DIV
(
matmul_param_
->
col_
,
row_pack_count
));
thread_stride_
=
UP_DIV
(
UP_DIV
(
matmul_param_
->
col_
,
row_pack_count
),
thread_count_
);
thread_count_hw_
=
MSMIN
(
op_parameter_
->
thread_num_
,
UP_DIV
(
matmul_param_
->
row_
,
col_pack_count
));
thread_stride_hw_
=
UP_DIV
(
UP_DIV
(
matmul_param_
->
row_
,
col_pack_count
),
thread_count_hw_
);
if
(
pre_trans_input_
)
{
input_ptr_
=
reinterpret_cast
<
int8_t
*>
(
malloc
(
matmul_param_
->
row_
*
matmul_param_
->
deep_
*
sizeof
(
int8_t
)));
...
...
@@ -296,7 +288,7 @@ int Convolution1x1Int8Impl(void *cdata, int task_id) {
}
int
Convolution1x1Int8CPUKernel
::
InitRunBuf
()
{
input_sum_
=
reinterpret_cast
<
int32_t
*>
(
m
alloc
(
input_sum_size
*
sizeof
(
int32_t
)));
input_sum_
=
reinterpret_cast
<
int32_t
*>
(
ctx_
->
allocator
->
M
alloc
(
input_sum_size
*
sizeof
(
int32_t
)));
if
(
input_sum_
==
nullptr
)
{
MS_LOG
(
ERROR
)
<<
"malloc input_sum_ failed."
;
return
RET_ERROR
;
...
...
@@ -334,6 +326,7 @@ int Convolution1x1Int8CPUKernel::Run() {
int
error_code
=
InitRunBuf
();
if
(
error_code
!=
RET_OK
)
{
MS_LOG
(
ERROR
)
<<
"conv1x1 int8 InitRunBuf error_code["
<<
error_code
<<
"]"
;
FreeRunBuf
();
return
RET_ERROR
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录