Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
fc709181
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看板
提交
fc709181
编写于
10月 19, 2018
作者:
Z
Zhen Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use less load
上级
48369c6d
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
49 addition
and
54 deletion
+49
-54
src/operators/math/gemm_int8.cpp
src/operators/math/gemm_int8.cpp
+46
-51
test/common/test_gemm_perf.cpp
test/common/test_gemm_perf.cpp
+3
-3
未找到文件。
src/operators/math/gemm_int8.cpp
浏览文件 @
fc709181
...
...
@@ -55,189 +55,185 @@ void Gemm::AddDot6x8(int32_t k, const int8_t *a, const int8_t *b, int32_t *c,
"vmov.s8 q13, #0
\n\t
"
"vmov.s8 q14, #0
\n\t
"
"vmov.s8 q15, #0
\n\t
"
"mov r0, #
6
\n\t
"
"mov r0, #
12
\n\t
"
"subs %[kc1], %[kc1], #1
\n\t
"
"blt 1f
\n\t
"
"0:
\n\t
"
"vld1.s8 {d0
}, [%[a_ptr]], r0
\n\t
"
// A col0
"vld1.s8 {d0
, d1}, [%[a_ptr]], r0
\n\t
"
// A col0, q0 used
"vmov.s8 q2, #0
\n\t
"
// q2 used
"vld1.s8 {d1}, [%[a_ptr]], r0
\n\t
"
// A col1, q0 used
"vdup.s8 d6, d0[0]
\n\t
"
"vdup.s8 d6, d0[0]
\n\t
"
// 1/2 q3 used
"vld1.s8 {d2-d3}, [%[b_ptr]]!
\n\t
"
// B row0, B row1, q1 used
"vdup.s8 d7, d
1[0
]
\n\t
"
// q3 used
"vdup.s8 d7, d
0[6
]
\n\t
"
// q3 used
"vmlal.s8 q2, d2, d6
\n\t
"
// A col00 * B row0
"vmlal.s8 q2, d3, d7
\n\t
"
// A col10 * B row1, q3 free
"vaddw.s16 q4, q4, d4
\n\t
"
"vaddw.s16 q5, q5, d5
\n\t
"
// res row 0
"vmov.s8 q2, #0
\n\t
"
"vdup.s8 d6, d0[1]
\n\t
"
"vdup.s8 d7, d
1[1
]
\n\t
"
"vdup.s8 d7, d
0[7
]
\n\t
"
"vmlal.s8 q2, d2, d6
\n\t
"
"vmlal.s8 q2, d3, d7
\n\t
"
"vaddw.s16 q6, q6, d4
\n\t
"
"vaddw.s16 q7, q7, d5
\n\t
"
// res row 1
"vmov.s8 q2, #0
\n\t
"
"vdup.s8 d6, d0[2]
\n\t
"
"vdup.s8 d7, d1[
2
]
\n\t
"
"vdup.s8 d7, d1[
0
]
\n\t
"
"vmlal.s8 q2, d2, d6
\n\t
"
"vmlal.s8 q2, d3, d7
\n\t
"
"vaddw.s16 q8, q8, d4
\n\t
"
"vaddw.s16 q9, q9, d5
\n\t
"
// res row 2
"vmov.s8 q2, #0
\n\t
"
"vdup.s8 d6, d0[3]
\n\t
"
"vdup.s8 d7, d1[
3
]
\n\t
"
"vdup.s8 d7, d1[
1
]
\n\t
"
"vmlal.s8 q2, d2, d6
\n\t
"
"vmlal.s8 q2, d3, d7
\n\t
"
"vaddw.s16 q10, q10, d4
\n\t
"
"vaddw.s16 q11, q11, d5
\n\t
"
// res row 3
"vmov.s8 q2, #0.
\n\t
"
"vdup.s8 d6, d0[4]
\n\t
"
"vdup.s8 d7, d1[
4
]
\n\t
"
"vdup.s8 d7, d1[
2
]
\n\t
"
"vmlal.s8 q2, d2, d6
\n\t
"
"vmlal.s8 q2, d3, d7
\n\t
"
"vaddw.s16 q12, q12, d4
\n\t
"
"vaddw.s16 q13, q13, d5
\n\t
"
// res row 4
"vmov.s8 q2, #0
\n\t
"
"vdup.s8 d6, d0[5]
\n\t
"
"vdup.s8 d7, d1[
5
]
\n\t
"
"vdup.s8 d7, d1[
3
]
\n\t
"
"vmlal.s8 q2, d2, d6
\n\t
"
"vmlal.s8 q2, d3, d7
\n\t
"
"vaddw.s16 q14, q14, d4
\n\t
"
"vaddw.s16 q15, q15, d5
\n\t
"
// res row 5
"vld1.s8 {d0}, [%[a_ptr]], r0
\n\t
"
// A col0
"vld1.s8 {d1}, [%[a_ptr]], r0
\n\t
"
// A col1, q0 used
"vld1.s8 {d2-d3}, [%[b_ptr]]!
\n\t
"
// B row0, B row1, q1 used
"vld1.s8 {d0, d1}, [%[a_ptr]], r0
\n\t
"
// A col0, q0 used
"vmov.s8 q2, #0
\n\t
"
// q2 used
"vdup.s8 d6, d0[0]
\n\t
"
"vdup.s8 d7, d1[0]
\n\t
"
// q3 used
"vdup.s8 d6, d0[0]
\n\t
"
// 1/2 q3 used
"vld1.s8 {d2-d3}, [%[b_ptr]]!
\n\t
"
// B row0, B row1, q1 used
"vdup.s8 d7, d0[6]
\n\t
"
// q3 used
"vmlal.s8 q2, d2, d6
\n\t
"
// A col00 * B row0
"vmlal.s8 q2, d3, d7
\n\t
"
// A col10 * B row1, q3 free
"vaddw.s16 q4, q4, d4
\n\t
"
"vaddw.s16 q5, q5, d5
\n\t
"
// res row 0
"vmov.s8 q2, #0
\n\t
"
"vdup.s8 d6, d0[1]
\n\t
"
"vdup.s8 d7, d
1[1
]
\n\t
"
"vdup.s8 d7, d
0[7
]
\n\t
"
"vmlal.s8 q2, d2, d6
\n\t
"
"vmlal.s8 q2, d3, d7
\n\t
"
"vaddw.s16 q6, q6, d4
\n\t
"
"vaddw.s16 q7, q7, d5
\n\t
"
// res row 1
"vmov.s8 q2, #0
\n\t
"
"vdup.s8 d6, d0[2]
\n\t
"
"vdup.s8 d7, d1[
2
]
\n\t
"
"vdup.s8 d7, d1[
0
]
\n\t
"
"vmlal.s8 q2, d2, d6
\n\t
"
"vmlal.s8 q2, d3, d7
\n\t
"
"vaddw.s16 q8, q8, d4
\n\t
"
"vaddw.s16 q9, q9, d5
\n\t
"
// res row 2
"vmov.s8 q2, #0
\n\t
"
"vdup.s8 d6, d0[3]
\n\t
"
"vdup.s8 d7, d1[
3
]
\n\t
"
"vdup.s8 d7, d1[
1
]
\n\t
"
"vmlal.s8 q2, d2, d6
\n\t
"
"vmlal.s8 q2, d3, d7
\n\t
"
"vaddw.s16 q10, q10, d4
\n\t
"
"vaddw.s16 q11, q11, d5
\n\t
"
// res row 3
"vmov.s8 q2, #0.
\n\t
"
"vdup.s8 d6, d0[4]
\n\t
"
"vdup.s8 d7, d1[
4
]
\n\t
"
"vdup.s8 d7, d1[
2
]
\n\t
"
"vmlal.s8 q2, d2, d6
\n\t
"
"vmlal.s8 q2, d3, d7
\n\t
"
"vaddw.s16 q12, q12, d4
\n\t
"
"vaddw.s16 q13, q13, d5
\n\t
"
// res row 4
"vmov.s8 q2, #0
\n\t
"
"vdup.s8 d6, d0[5]
\n\t
"
"vdup.s8 d7, d1[
5
]
\n\t
"
"vdup.s8 d7, d1[
3
]
\n\t
"
"vmlal.s8 q2, d2, d6
\n\t
"
"vmlal.s8 q2, d3, d7
\n\t
"
"vaddw.s16 q14, q14, d4
\n\t
"
"vaddw.s16 q15, q15, d5
\n\t
"
// res row 5
"vld1.s8 {d0}, [%[a_ptr]], r0
\n\t
"
// A col0
"vld1.s8 {d1}, [%[a_ptr]], r0
\n\t
"
// A col1, q0 used
"vld1.s8 {d2-d3}, [%[b_ptr]]!
\n\t
"
// B row0, B row1, q1 used
"vld1.s8 {d0, d1}, [%[a_ptr]], r0
\n\t
"
// A col0, q0 used
"vmov.s8 q2, #0
\n\t
"
// q2 used
"vdup.s8 d6, d0[0]
\n\t
"
"vdup.s8 d7, d1[0]
\n\t
"
// q3 used
"vdup.s8 d6, d0[0]
\n\t
"
// 1/2 q3 used
"vld1.s8 {d2-d3}, [%[b_ptr]]!
\n\t
"
// B row0, B row1, q1 used
"vdup.s8 d7, d0[6]
\n\t
"
// q3 used
"vmlal.s8 q2, d2, d6
\n\t
"
// A col00 * B row0
"vmlal.s8 q2, d3, d7
\n\t
"
// A col10 * B row1, q3 free
"vaddw.s16 q4, q4, d4
\n\t
"
"vaddw.s16 q5, q5, d5
\n\t
"
// res row 0
"vmov.s8 q2, #0
\n\t
"
"vdup.s8 d6, d0[1]
\n\t
"
"vdup.s8 d7, d
1[1
]
\n\t
"
"vdup.s8 d7, d
0[7
]
\n\t
"
"vmlal.s8 q2, d2, d6
\n\t
"
"vmlal.s8 q2, d3, d7
\n\t
"
"vaddw.s16 q6, q6, d4
\n\t
"
"vaddw.s16 q7, q7, d5
\n\t
"
// res row 1
"vmov.s8 q2, #0
\n\t
"
"vdup.s8 d6, d0[2]
\n\t
"
"vdup.s8 d7, d1[
2
]
\n\t
"
"vdup.s8 d7, d1[
0
]
\n\t
"
"vmlal.s8 q2, d2, d6
\n\t
"
"vmlal.s8 q2, d3, d7
\n\t
"
"vaddw.s16 q8, q8, d4
\n\t
"
"vaddw.s16 q9, q9, d5
\n\t
"
// res row 2
"vmov.s8 q2, #0
\n\t
"
"vdup.s8 d6, d0[3]
\n\t
"
"vdup.s8 d7, d1[
3
]
\n\t
"
"vdup.s8 d7, d1[
1
]
\n\t
"
"vmlal.s8 q2, d2, d6
\n\t
"
"vmlal.s8 q2, d3, d7
\n\t
"
"vaddw.s16 q10, q10, d4
\n\t
"
"vaddw.s16 q11, q11, d5
\n\t
"
// res row 3
"vmov.s8 q2, #0.
\n\t
"
"vdup.s8 d6, d0[4]
\n\t
"
"vdup.s8 d7, d1[
4
]
\n\t
"
"vdup.s8 d7, d1[
2
]
\n\t
"
"vmlal.s8 q2, d2, d6
\n\t
"
"vmlal.s8 q2, d3, d7
\n\t
"
"vaddw.s16 q12, q12, d4
\n\t
"
"vaddw.s16 q13, q13, d5
\n\t
"
// res row 4
"vmov.s8 q2, #0
\n\t
"
"vdup.s8 d6, d0[5]
\n\t
"
"vdup.s8 d7, d1[
5
]
\n\t
"
"vdup.s8 d7, d1[
3
]
\n\t
"
"vmlal.s8 q2, d2, d6
\n\t
"
"vmlal.s8 q2, d3, d7
\n\t
"
"vaddw.s16 q14, q14, d4
\n\t
"
"vaddw.s16 q15, q15, d5
\n\t
"
// res row 5
"vld1.s8 {d0}, [%[a_ptr]], r0
\n\t
"
// A col0
"vld1.s8 {d1}, [%[a_ptr]], r0
\n\t
"
// A col1, q0 used
"vld1.s8 {d2-d3}, [%[b_ptr]]!
\n\t
"
// B row0, B row1, q1 used
"vld1.s8 {d0, d1}, [%[a_ptr]], r0
\n\t
"
// A col0, q0 used
"vmov.s8 q2, #0
\n\t
"
// q2 used
"vdup.s8 d6, d0[0]
\n\t
"
"vdup.s8 d7, d1[0]
\n\t
"
// q3 used
"vdup.s8 d6, d0[0]
\n\t
"
// 1/2 q3 used
"vld1.s8 {d2-d3}, [%[b_ptr]]!
\n\t
"
// B row0, B row1, q1 used
"vdup.s8 d7, d0[6]
\n\t
"
// q3 used
"vmlal.s8 q2, d2, d6
\n\t
"
// A col00 * B row0
"vmlal.s8 q2, d3, d7
\n\t
"
// A col10 * B row1, q3 free
"vaddw.s16 q4, q4, d4
\n\t
"
"vaddw.s16 q5, q5, d5
\n\t
"
// res row 0
"vmov.s8 q2, #0
\n\t
"
"vdup.s8 d6, d0[1]
\n\t
"
"vdup.s8 d7, d
1[1
]
\n\t
"
"vdup.s8 d7, d
0[7
]
\n\t
"
"vmlal.s8 q2, d2, d6
\n\t
"
"vmlal.s8 q2, d3, d7
\n\t
"
"vaddw.s16 q6, q6, d4
\n\t
"
"vaddw.s16 q7, q7, d5
\n\t
"
// res row 1
"vmov.s8 q2, #0
\n\t
"
"vdup.s8 d6, d0[2]
\n\t
"
"vdup.s8 d7, d1[
2
]
\n\t
"
"vdup.s8 d7, d1[
0
]
\n\t
"
"vmlal.s8 q2, d2, d6
\n\t
"
"vmlal.s8 q2, d3, d7
\n\t
"
"vaddw.s16 q8, q8, d4
\n\t
"
"vaddw.s16 q9, q9, d5
\n\t
"
// res row 2
"vmov.s8 q2, #0
\n\t
"
"vdup.s8 d6, d0[3]
\n\t
"
"vdup.s8 d7, d1[
3
]
\n\t
"
"vdup.s8 d7, d1[
1
]
\n\t
"
"vmlal.s8 q2, d2, d6
\n\t
"
"vmlal.s8 q2, d3, d7
\n\t
"
"vaddw.s16 q10, q10, d4
\n\t
"
"vaddw.s16 q11, q11, d5
\n\t
"
// res row 3
"vmov.s8 q2, #0.
\n\t
"
"vdup.s8 d6, d0[4]
\n\t
"
"vdup.s8 d7, d1[
4
]
\n\t
"
"vdup.s8 d7, d1[
2
]
\n\t
"
"vmlal.s8 q2, d2, d6
\n\t
"
"vmlal.s8 q2, d3, d7
\n\t
"
"vaddw.s16 q12, q12, d4
\n\t
"
"vaddw.s16 q13, q13, d5
\n\t
"
// res row 4
"vmov.s8 q2, #0
\n\t
"
"vdup.s8 d6, d0[5]
\n\t
"
"vdup.s8 d7, d1[
5
]
\n\t
"
"vdup.s8 d7, d1[
3
]
\n\t
"
"vmlal.s8 q2, d2, d6
\n\t
"
"vmlal.s8 q2, d3, d7
\n\t
"
"vaddw.s16 q14, q14, d4
\n\t
"
...
...
@@ -249,51 +245,50 @@ void Gemm::AddDot6x8(int32_t k, const int8_t *a, const int8_t *b, int32_t *c,
"subs %[kc3], %[kc3], #1
\n\t
"
"blt 3f
\n\t
"
"2:
\n\t
"
"vld1.s8 {d0}, [%[a_ptr]], r0
\n\t
"
// A col0
"vld1.s8 {d1}, [%[a_ptr]], r0
\n\t
"
// A col1, q0 used
"vld1.s8 {d2-d3}, [%[b_ptr]]!
\n\t
"
// B row0, B row1, q1 used
"vld1.s8 {d0, d1}, [%[a_ptr]], r0
\n\t
"
// A col0, q0 used
"vmov.s8 q2, #0
\n\t
"
// q2 used
"vdup.s8 d6, d0[0]
\n\t
"
"vdup.s8 d7, d1[0]
\n\t
"
// q3 used
"vdup.s8 d6, d0[0]
\n\t
"
// 1/2 q3 used
"vld1.s8 {d2-d3}, [%[b_ptr]]!
\n\t
"
// B row0, B row1, q1 used
"vdup.s8 d7, d0[6]
\n\t
"
// q3 used
"vmlal.s8 q2, d2, d6
\n\t
"
// A col00 * B row0
"vmlal.s8 q2, d3, d7
\n\t
"
// A col10 * B row1, q3 free
"vaddw.s16 q4, q4, d4
\n\t
"
"vaddw.s16 q5, q5, d5
\n\t
"
// res row 0
"vmov.s8 q2, #0
\n\t
"
"vdup.s8 d6, d0[1]
\n\t
"
"vdup.s8 d7, d
1[1
]
\n\t
"
"vdup.s8 d7, d
0[7
]
\n\t
"
"vmlal.s8 q2, d2, d6
\n\t
"
"vmlal.s8 q2, d3, d7
\n\t
"
"vaddw.s16 q6, q6, d4
\n\t
"
"vaddw.s16 q7, q7, d5
\n\t
"
// res row 1
"vmov.s8 q2, #0
\n\t
"
"vdup.s8 d6, d0[2]
\n\t
"
"vdup.s8 d7, d1[
2
]
\n\t
"
"vdup.s8 d7, d1[
0
]
\n\t
"
"vmlal.s8 q2, d2, d6
\n\t
"
"vmlal.s8 q2, d3, d7
\n\t
"
"vaddw.s16 q8, q8, d4
\n\t
"
"vaddw.s16 q9, q9, d5
\n\t
"
// res row 2
"vmov.s8 q2, #0
\n\t
"
"vdup.s8 d6, d0[3]
\n\t
"
"vdup.s8 d7, d1[
3
]
\n\t
"
"vdup.s8 d7, d1[
1
]
\n\t
"
"vmlal.s8 q2, d2, d6
\n\t
"
"vmlal.s8 q2, d3, d7
\n\t
"
"vaddw.s16 q10, q10, d4
\n\t
"
"vaddw.s16 q11, q11, d5
\n\t
"
// res row 3
"vmov.s8 q2, #0.
\n\t
"
"vdup.s8 d6, d0[4]
\n\t
"
"vdup.s8 d7, d1[
4
]
\n\t
"
"vdup.s8 d7, d1[
2
]
\n\t
"
"vmlal.s8 q2, d2, d6
\n\t
"
"vmlal.s8 q2, d3, d7
\n\t
"
"vaddw.s16 q12, q12, d4
\n\t
"
"vaddw.s16 q13, q13, d5
\n\t
"
// res row 4
"vmov.s8 q2, #0
\n\t
"
"vdup.s8 d6, d0[5]
\n\t
"
"vdup.s8 d7, d1[
5
]
\n\t
"
"vdup.s8 d7, d1[
3
]
\n\t
"
"vmlal.s8 q2, d2, d6
\n\t
"
"vmlal.s8 q2, d3, d7
\n\t
"
"vaddw.s16 q14, q14, d4
\n\t
"
"vaddw.s16 q15, q15, d5
\n\t
"
// res row5
"vaddw.s16 q15, q15, d5
\n\t
"
// res row
5
"subs %[kc3], %[kc3], #1
\n\t
"
"bge 2b
\n\t
"
...
...
test/common/test_gemm_perf.cpp
浏览文件 @
fc709181
...
...
@@ -22,9 +22,9 @@ limitations under the License. */
#define b(i, j) b[(i)*ldb + (j)]
#define c1(i, j) c1[(i)*ldc + (j)]
#define m
1024
#define n
1024
#define k
1024
#define m
2048
#define n
2048
#define k
2048
int
main
()
{
paddle_mobile
::
PaddleMobile
<
paddle_mobile
::
CPU
>
paddle_mobile
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录