Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
e5d26427
O
Opencv
项目概览
Greenplum
/
Opencv
大约 1 年 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e5d26427
编写于
12月 07, 2020
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #19015 from alalek:dnn_use_fma
上级
a9f4f8de
00f36a31
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
32 addition
and
27 deletion
+32
-27
modules/dnn/src/layers/convolution_layer.cpp
modules/dnn/src/layers/convolution_layer.cpp
+24
-21
modules/dnn/src/layers/fully_connected_layer.cpp
modules/dnn/src/layers/fully_connected_layer.cpp
+8
-6
未找到文件。
modules/dnn/src/layers/convolution_layer.cpp
浏览文件 @
e5d26427
...
@@ -1370,15 +1370,15 @@ public:
...
@@ -1370,15 +1370,15 @@ public:
v_float32x4
r2
=
v_load_aligned
(
rptr
+
vsz_a
*
2
);
v_float32x4
r2
=
v_load_aligned
(
rptr
+
vsz_a
*
2
);
v_float32x4
r3
=
v_load_aligned
(
rptr
+
vsz_a
*
3
);
v_float32x4
r3
=
v_load_aligned
(
rptr
+
vsz_a
*
3
);
vs00
+=
w0
*
r0
;
vs00
=
v_fma
(
w0
,
r0
,
vs00
)
;
vs01
+=
w0
*
r1
;
vs01
=
v_fma
(
w0
,
r1
,
vs01
)
;
vs02
+=
w0
*
r2
;
vs02
=
v_fma
(
w0
,
r2
,
vs02
)
;
vs03
+=
w0
*
r3
;
vs03
=
v_fma
(
w0
,
r3
,
vs03
)
;
vs10
+=
w1
*
r0
;
vs10
=
v_fma
(
w1
,
r0
,
vs10
)
;
vs11
+=
w1
*
r1
;
vs11
=
v_fma
(
w1
,
r1
,
vs11
)
;
vs12
+=
w1
*
r2
;
vs12
=
v_fma
(
w1
,
r2
,
vs12
)
;
vs13
+=
w1
*
r3
;
vs13
=
v_fma
(
w1
,
r3
,
vs13
)
;
}
}
s0
+=
v_reduce_sum4
(
vs00
,
vs01
,
vs02
,
vs03
);
s0
+=
v_reduce_sum4
(
vs00
,
vs01
,
vs02
,
vs03
);
s1
+=
v_reduce_sum4
(
vs10
,
vs11
,
vs12
,
vs13
);
s1
+=
v_reduce_sum4
(
vs10
,
vs11
,
vs12
,
vs13
);
...
@@ -2035,20 +2035,21 @@ public:
...
@@ -2035,20 +2035,21 @@ public:
for
(
;
n
<=
nmax
-
4
;
n
+=
4
)
for
(
;
n
<=
nmax
-
4
;
n
+=
4
)
{
{
v_float32x4
d0
=
v_load
(
dst0
+
n
);
v_float32x4
d1
=
v_load
(
dst1
+
n
);
v_float32x4
b0
=
v_load
(
bptr0
+
n
);
v_float32x4
b0
=
v_load
(
bptr0
+
n
);
v_float32x4
b1
=
v_load
(
bptr1
+
n
);
v_float32x4
b1
=
v_load
(
bptr1
+
n
);
v_float32x4
b2
=
v_load
(
bptr2
+
n
);
v_float32x4
b2
=
v_load
(
bptr2
+
n
);
v_float32x4
b3
=
v_load
(
bptr3
+
n
);
v_float32x4
b3
=
v_load
(
bptr3
+
n
);
v_float32x4
d0
=
v_load
(
dst0
+
n
);
// TODO try to improve pipeline width
v_float32x4
d1
=
v_load
(
dst1
+
n
);
d0
=
v_fma
(
b0
,
a00
,
d0
);
d0
+=
b0
*
a00
;
d1
=
v_fma
(
b0
,
a01
,
d1
);
d1
+=
b0
*
a01
;
d0
=
v_fma
(
b1
,
a10
,
d0
);
d0
+=
b1
*
a10
;
d1
=
v_fma
(
b1
,
a11
,
d1
);
d1
+=
b1
*
a11
;
d0
=
v_fma
(
b2
,
a20
,
d0
);
d0
+=
b2
*
a20
;
d1
=
v_fma
(
b2
,
a21
,
d1
);
d1
+=
b2
*
a21
;
d0
=
v_fma
(
b3
,
a30
,
d0
);
d0
+=
b3
*
a30
;
d1
=
v_fma
(
b3
,
a31
,
d1
);
d1
+=
b3
*
a31
;
v_store
(
dst0
+
n
,
d0
);
v_store
(
dst0
+
n
,
d0
);
v_store
(
dst1
+
n
,
d1
);
v_store
(
dst1
+
n
,
d1
);
}
}
...
@@ -2056,8 +2057,10 @@ public:
...
@@ -2056,8 +2057,10 @@ public:
for
(
;
n
<
nmax
;
n
++
)
for
(
;
n
<
nmax
;
n
++
)
{
{
float
b0
=
bptr0
[
n
],
b1
=
bptr1
[
n
];
float
b0
=
bptr0
[
n
];
float
b2
=
bptr2
[
n
],
b3
=
bptr3
[
n
];
float
b1
=
bptr1
[
n
];
float
b2
=
bptr2
[
n
];
float
b3
=
bptr3
[
n
];
float
d0
=
dst0
[
n
]
+
alpha00
*
b0
+
alpha10
*
b1
+
alpha20
*
b2
+
alpha30
*
b3
;
float
d0
=
dst0
[
n
]
+
alpha00
*
b0
+
alpha10
*
b1
+
alpha20
*
b2
+
alpha30
*
b3
;
float
d1
=
dst1
[
n
]
+
alpha01
*
b0
+
alpha11
*
b1
+
alpha21
*
b2
+
alpha31
*
b3
;
float
d1
=
dst1
[
n
]
+
alpha01
*
b0
+
alpha11
*
b1
+
alpha21
*
b2
+
alpha31
*
b3
;
dst0
[
n
]
=
d0
;
dst0
[
n
]
=
d0
;
...
...
modules/dnn/src/layers/fully_connected_layer.cpp
浏览文件 @
e5d26427
...
@@ -241,16 +241,18 @@ public:
...
@@ -241,16 +241,18 @@ public:
#if CV_SIMD128
#if CV_SIMD128
for
(
;
i
<=
nw
-
4
;
i
+=
4
,
wptr
+=
4
*
wstep
)
for
(
;
i
<=
nw
-
4
;
i
+=
4
,
wptr
+=
4
*
wstep
)
{
{
v_float32x4
vs0
=
v_setall_f32
(
0.
f
),
vs1
=
v_setall_f32
(
0.
f
);
v_float32x4
vs0
=
v_setall_f32
(
0.
f
);
v_float32x4
vs2
=
v_setall_f32
(
0.
f
),
vs3
=
v_setall_f32
(
0.
f
);
v_float32x4
vs1
=
v_setall_f32
(
0.
f
);
v_float32x4
vs2
=
v_setall_f32
(
0.
f
);
v_float32x4
vs3
=
v_setall_f32
(
0.
f
);
for
(
k
=
0
;
k
<
vecsize
;
k
+=
4
)
for
(
k
=
0
;
k
<
vecsize
;
k
+=
4
)
{
{
v_float32x4
v
=
v_load_aligned
(
sptr
+
k
);
v_float32x4
v
=
v_load_aligned
(
sptr
+
k
);
vs0
+=
v
*
v_load_aligned
(
wptr
+
k
);
vs0
=
v_fma
(
v
,
v_load_aligned
(
wptr
+
k
),
vs0
);
vs1
+=
v
*
v_load_aligned
(
wptr
+
wstep
+
k
);
vs1
=
v_fma
(
v
,
v_load_aligned
(
wptr
+
wstep
+
k
),
vs1
);
vs2
+=
v
*
v_load_aligned
(
wptr
+
wstep
*
2
+
k
);
vs2
=
v_fma
(
v
,
v_load_aligned
(
wptr
+
wstep
*
2
+
k
),
vs2
);
vs3
+=
v
*
v_load_aligned
(
wptr
+
wstep
*
3
+
k
);
vs3
=
v_fma
(
v
,
v_load_aligned
(
wptr
+
wstep
*
3
+
k
),
vs3
);
}
}
v_float32x4
s
=
v_reduce_sum4
(
vs0
,
vs1
,
vs2
,
vs3
);
v_float32x4
s
=
v_reduce_sum4
(
vs0
,
vs1
,
vs2
,
vs3
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录