Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
04f826f1
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
331
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
271
列表
看板
标记
里程碑
合并请求
78
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle-Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
271
Issue
271
列表
看板
标记
里程碑
合并请求
78
合并请求
78
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
04f826f1
编写于
3月 13, 2019
作者:
H
hjchen2
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix multi-thread bug for gemv when n==1
上级
53956140
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
6 addition
and
6 deletion
+6
-6
src/operators/math/gemm/gemm_kernel.h
src/operators/math/gemm/gemm_kernel.h
+4
-4
test/operators/test_conv_op.cpp
test/operators/test_conv_op.cpp
+2
-2
未找到文件。
src/operators/math/gemm/gemm_kernel.h
浏览文件 @
04f826f1
...
@@ -332,7 +332,6 @@ void sgemv_notrans_mx1(const int M, const int N, const float alpha,
...
@@ -332,7 +332,6 @@ void sgemv_notrans_mx1(const int M, const int N, const float alpha,
uint32_t
mask
[
4
]
=
{
0
,
1
,
2
,
3
};
uint32_t
mask
[
4
]
=
{
0
,
1
,
2
,
3
};
int
remain_n
=
N
&
0x3
;
int
remain_n
=
N
&
0x3
;
uint32x4_t
vmask
=
vcltq_u32
(
vld1q_u32
(
mask
),
vdupq_n_u32
(
remain_n
));
uint32x4_t
vmask
=
vcltq_u32
(
vld1q_u32
(
mask
),
vdupq_n_u32
(
remain_n
));
float32x4_t
_sum0
,
_sum1
,
_sum2
,
_sum3
;
float32x4_t
_valpha
=
vdupq_n_f32
(
alpha
);
float32x4_t
_valpha
=
vdupq_n_f32
(
alpha
);
#pragma omp parallel for
#pragma omp parallel for
...
@@ -342,11 +341,12 @@ void sgemv_notrans_mx1(const int M, const int N, const float alpha,
...
@@ -342,11 +341,12 @@ void sgemv_notrans_mx1(const int M, const int N, const float alpha,
const
float
*
in2
=
in1
+
lda
;
const
float
*
in2
=
in1
+
lda
;
const
float
*
in3
=
in2
+
lda
;
const
float
*
in3
=
in2
+
lda
;
float
*
output
=
C
+
m
;
float
*
output
=
C
+
m
;
float32x4_t
_sum0
,
_sum1
,
_sum2
,
_sum3
;
_sum0
=
vdupq_n_f32
(
0.
f
);
_sum0
=
vdupq_n_f32
(
0.
f
);
_sum1
=
vdupq_n_f32
(
0.
f
);
_sum1
=
vdupq_n_f32
(
0.
f
);
_sum2
=
vdupq_n_f32
(
0.
f
);
_sum2
=
vdupq_n_f32
(
0.
f
);
_sum3
=
vdupq_n_f32
(
0.
f
);
_sum3
=
vdupq_n_f32
(
0.
f
);
int
n
=
0
;
int
n
=
0
;
for
(;
n
<
N
-
3
;
n
+=
4
)
{
for
(;
n
<
N
-
3
;
n
+=
4
)
{
float32x4_t
_r0
=
vld1q_f32
(
in0
+
n
);
float32x4_t
_r0
=
vld1q_f32
(
in0
+
n
);
...
@@ -390,7 +390,7 @@ void sgemv_notrans_mx1(const int M, const int N, const float alpha,
...
@@ -390,7 +390,7 @@ void sgemv_notrans_mx1(const int M, const int N, const float alpha,
for
(
int
m
=
(
M
&
0xfffc
);
m
<
M
;
++
m
)
{
for
(
int
m
=
(
M
&
0xfffc
);
m
<
M
;
++
m
)
{
const
float
*
in0
=
A
+
m
*
lda
;
const
float
*
in0
=
A
+
m
*
lda
;
float
*
output
=
C
+
m
;
float
*
output
=
C
+
m
;
_sum0
=
vdupq_n_f32
(
0.
f
);
float32x4_t
_sum0
=
vdupq_n_f32
(
0.
f
);
int
n
=
0
;
int
n
=
0
;
for
(;
n
<
N
-
3
;
n
+=
4
)
{
for
(;
n
<
N
-
3
;
n
+=
4
)
{
...
@@ -408,7 +408,7 @@ void sgemv_notrans_mx1(const int M, const int N, const float alpha,
...
@@ -408,7 +408,7 @@ void sgemv_notrans_mx1(const int M, const int N, const float alpha,
_sum0
=
vpaddq_f32
(
_sum0
,
_sum0
);
_sum0
=
vpaddq_f32
(
_sum0
,
_sum0
);
_sum0
=
vmulq_f32
(
_sum0
,
_valpha
);
_sum0
=
vmulq_f32
(
_sum0
,
_valpha
);
if
(
beta
!=
0.
f
)
{
if
(
beta
!=
0.
f
)
{
_sum2
=
vmulq_n_f32
(
vld1q_f32
(
output
),
beta
);
float32x4_t
_sum2
=
vmulq_n_f32
(
vld1q_f32
(
output
),
beta
);
_sum0
=
vpaddq_f32
(
_sum0
,
_sum2
);
_sum0
=
vpaddq_f32
(
_sum0
,
_sum2
);
}
}
// restore
// restore
...
...
test/operators/test_conv_op.cpp
浏览文件 @
04f826f1
...
@@ -206,11 +206,11 @@ int TestConvOp(int in_channels, int in_height, int in_width, int out_channels,
...
@@ -206,11 +206,11 @@ int TestConvOp(int in_channels, int in_height, int in_width, int out_channels,
const
Otype
*
output_data
=
output
->
data
<
Otype
>
();
const
Otype
*
output_data
=
output
->
data
<
Otype
>
();
Otype
*
output_cmp_data
=
output_cmp
.
data
<
Otype
>
();
Otype
*
output_cmp_data
=
output_cmp
.
data
<
Otype
>
();
for
(
int
i
=
0
;
i
<
output
->
numel
();
++
i
)
{
for
(
int
i
=
0
;
i
<
output
->
numel
();
++
i
)
{
float
gap
=
output_data
[
i
]
-
output_cmp_data
[
i
]
;
float
gap
=
abs
(
output_data
[
i
]
-
output_cmp_data
[
i
])
;
// PADDLE_MOBILE_ENFORCE(std::abs(gap / (output_data[i] + 1e-5)) < 1e-3,
// PADDLE_MOBILE_ENFORCE(std::abs(gap / (output_data[i] + 1e-5)) < 1e-3,
// "output[%d] = %d, output_cmp[%d] = %d", i,
// "output[%d] = %d, output_cmp[%d] = %d", i,
// output_data[i], i, output_cmp_data[i]);
// output_data[i], i, output_cmp_data[i]);
if
(
gap
>
1e-2
&&
std
::
abs
(
gap
/
(
output_data
[
i
]
+
1e-5
))
>
1e-3
)
{
if
(
gap
>
1e-2
&&
abs
(
gap
/
(
output_data
[
i
]
+
1e-5
))
>
1e-3
)
{
std
::
cerr
<<
"output_data["
<<
i
<<
"] = "
<<
output_data
[
i
]
std
::
cerr
<<
"output_data["
<<
i
<<
"] = "
<<
output_data
[
i
]
<<
", output_cmp_data["
<<
i
<<
"] = "
<<
output_cmp_data
[
i
]
<<
", output_cmp_data["
<<
i
<<
"] = "
<<
output_cmp_data
[
i
]
<<
std
::
endl
;
<<
std
::
endl
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录