Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
正统之独孤求败
mindspore
提交
99cc44d2
M
mindspore
项目概览
正统之独孤求败
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
99cc44d2
编写于
8月 24, 2020
作者:
L
lixian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add c4 output support for fp32 matmul kernel
上级
75af5464
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
50 addition
and
16 deletion
+50
-16
mindspore/lite/nnacl/assembly/arm64/MatmulFp32Opt.S
mindspore/lite/nnacl/assembly/arm64/MatmulFp32Opt.S
+42
-8
mindspore/lite/nnacl/fp32/matmul.c
mindspore/lite/nnacl/fp32/matmul.c
+5
-5
mindspore/lite/nnacl/fp32/matmul.h
mindspore/lite/nnacl/fp32/matmul.h
+2
-2
mindspore/lite/src/runtime/kernel/arm/fp32/convolution_1x1.cc
...spore/lite/src/runtime/kernel/arm/fp32/convolution_1x1.cc
+1
-1
未找到文件。
mindspore/lite/nnacl/assembly/arm64/MatmulFp32Opt.S
浏览文件 @
99cc44d2
...
...
@@ -47,7 +47,7 @@
/////////////////////////////////////////////////////////////////////////////////
//
//
void
MatmulFloatNeon64
(
const
float
*
a
,
const
float
*
b
,
float
*
c
,
const
float
*
bias
,
int
act_type
,
int
depth
//
int
row
,
int
col
,
int
stride
,
bool
write_nhwc
)
//
int
row
,
int
col
,
size_t
stride
,
size_t
writeNhwc
,
size_t
writeC4
)
//
x0
:
a
//
x1
:
b
//
x2
:
c
...
...
@@ -57,7 +57,7 @@
//
w6
:
row
//
w7
:
col
//
w17
:
stride
//
w13
:
writeC8
//
w13
:
c8_nhwc_c4
MatmulFloatNeon64Opt
:
sub
sp
,
sp
,
#
128
...
...
@@ -209,8 +209,8 @@ Activation:
b
Write
Relu6
:
mov
w
8
,
#
6
dup
v2
.4
s
,
w
8
mov
w
13
,
#
6
dup
v2
.4
s
,
w
13
scvtf
v2
.4
s
,
v2
.4
s
fmin
v8
.4
s
,
v8
.4
s
,
v2
.4
s
fmin
v9
.4
s
,
v9
.4
s
,
v2
.4
s
...
...
@@ -265,8 +265,10 @@ Relu:
fmax
v31
.4
s
,
v31
.4
s
,
v3
.4
s
Write
:
ldrb
w13
,
[
sp
,
#
8
]
cbz
w13
,
WriteC8
ldr
w8
,
[
sp
,
#
8
]
cbz
w8
,
WriteC8
ldr
w8
,
[
sp
,
#
16
]
cbnz
w8
,
WriteC4
cmp
w7
,
#
1
beq
Write1
cmp
w7
,
#
2
...
...
@@ -726,6 +728,33 @@ WriteC8:
st1
{
v24
.8
h
,
v25
.8
h
,
v26
.8
h
,
v27
.8
h
},
[
x2
],
#
64
st1
{
v28
.8
h
,
v29
.8
h
,
v30
.8
h
,
v31
.8
h
},
[
x2
],
#
64
b
WriteEnd
WriteC4
:
st1
{
v8
.8
h
},
[
x2
],
#
16
st1
{
v10
.8
h
},
[
x2
],
#
16
st1
{
v12
.8
h
},
[
x2
],
#
16
st1
{
v14
.8
h
},
[
x2
],
#
16
st1
{
v16
.8
h
},
[
x2
],
#
16
st1
{
v18
.8
h
},
[
x2
],
#
16
st1
{
v20
.8
h
},
[
x2
],
#
16
st1
{
v22
.8
h
},
[
x2
],
#
16
st1
{
v24
.8
h
},
[
x2
],
#
16
st1
{
v26
.8
h
},
[
x2
],
#
16
st1
{
v28
.8
h
},
[
x2
],
#
16
st1
{
v30
.8
h
},
[
x2
],
#
16
add
x18
,
x2
,
x17
st1
{
v9
.8
h
},
[
x18
],
#
16
st1
{
v11
.8
h
},
[
x18
],
#
16
st1
{
v13
.8
h
},
[
x18
],
#
16
st1
{
v15
.8
h
},
[
x18
],
#
16
st1
{
v17
.8
h
},
[
x18
],
#
16
st1
{
v19
.8
h
},
[
x18
],
#
16
st1
{
v21
.8
h
},
[
x18
],
#
16
st1
{
v23
.8
h
},
[
x18
],
#
16
st1
{
v25
.8
h
},
[
x18
],
#
16
st1
{
v27
.8
h
},
[
x18
],
#
16
st1
{
v29
.8
h
},
[
x18
],
#
16
st1
{
v31
.8
h
},
[
x18
],
#
16
b
WriteEnd
Write8
:
st1
{
v8
.4
s
,
v9
.4
s
},
[
x18
],
x17
cmp
w10
,
#
1
...
...
@@ -770,9 +799,14 @@ End2:
subs
w7
,
w7
,
#
8
//
rhs
col
-
8
add
x1
,
x1
,
x15
//
rhs
ptr
+
stride
add
x3
,
x3
,
#
32
//
bias
ptr
+
stride
ldrb
w13
,
[
sp
,
#
8
]
cbz
w13
,
NoDstStep
ldr
w8
,
[
sp
,
#
8
]
cbz
w8
,
NoDstStep
ldr
w8
,
[
sp
,
#
16
]
cbnz
w8
,
C4DstStep
add
x2
,
x2
,
#
32
//
dst
ptr
+
stride
b
NoDstStep
C4DstStep
:
add
x2
,
x2
,
x17
NoDstStep
:
bgt
L1
...
...
mindspore/lite/nnacl/fp32/matmul.c
浏览文件 @
99cc44d2
...
...
@@ -370,8 +370,8 @@ void MatMul8x8(const float *a, const float *b, float *dst, const float *bias, Ac
}
void
MatMul12x8
(
const
float
*
a
,
const
float
*
b
,
float
*
dst
,
const
float
*
bias
,
ActType
act_type
,
int
deep
,
int
row
,
int
col
,
int
stride
,
bool
write_nhwc
)
{
if
(
write
_nhwc
)
{
int
col
,
size_t
stride
,
size_t
writeNhwc
,
size_t
writeC4
)
{
if
(
write
Nhwc
!=
0
)
{
/* col8-major * row8-major => col-major */
for
(
int
r
=
0
;
r
<
row
;
r
++
)
{
for
(
int
c
=
0
;
c
<
col
;
c
++
)
{
...
...
@@ -404,10 +404,10 @@ void MatMul(const float *a, const float *b, float *c, const float *bias, ActType
}
void
MatMulOpt
(
const
float
*
a
,
const
float
*
b
,
float
*
c
,
const
float
*
bias
,
ActType
act_type
,
int
deep
,
int
row
,
int
col
,
int
stride
,
bool
write_nhwc
)
{
int
col
,
size_t
stride
,
size_t
writeNhwc
,
size_t
writeC4
)
{
#ifdef ENABLE_ARM64
MatmulFloatNeon64Opt
(
a
,
b
,
c
,
bias
,
(
int
)
act_type
,
deep
,
row
,
col
,
stride
,
write
_nhwc
);
MatmulFloatNeon64Opt
(
a
,
b
,
c
,
bias
,
(
int
)
act_type
,
deep
,
row
,
col
,
stride
,
write
Nhwc
,
writeC4
);
#else
MatMul12x8
(
a
,
b
,
c
,
bias
,
act_type
,
deep
,
row
,
col
,
stride
,
write_nhwc
);
MatMul12x8
(
a
,
b
,
c
,
bias
,
act_type
,
deep
,
row
,
col
,
stride
,
writeNhwc
,
writeC4
);
#endif
}
mindspore/lite/nnacl/fp32/matmul.h
浏览文件 @
99cc44d2
...
...
@@ -29,7 +29,7 @@ extern "C" {
void
MatMul
(
const
float
*
a
,
const
float
*
b
,
float
*
c
,
const
float
*
bias
,
ActType
act_type
,
int
depth
,
int
row
,
int
col
,
int
stride
,
bool
write_nhwc
);
void
MatMulOpt
(
const
float
*
a
,
const
float
*
b
,
float
*
c
,
const
float
*
bias
,
ActType
act_type
,
int
depth
,
int
row
,
int
col
,
int
stride
,
bool
write_nhwc
);
int
col
,
size_t
stride
,
size_t
writeNhwc
,
size_t
writeC4
);
void
RowMajor2Row8Major
(
float
*
src_ptr
,
float
*
dst_ptr
,
int
row
,
int
col
);
void
RowMajor2Col8Major
(
float
*
src_ptr
,
float
*
dst_ptr
,
size_t
row
,
size_t
col
);
void
RowMajor2Col12Major
(
float
*
src_ptr
,
float
*
dst_ptr
,
size_t
row
,
size_t
col
);
...
...
@@ -38,7 +38,7 @@ void Row8x8Major2RowMajor(float *src_ptr, float *dst_ptr, size_t row, size_t col
void
MatmulFloatNeon64
(
const
float
*
a
,
const
float
*
b
,
float
*
c
,
const
float
*
bias
,
int
act_type
,
int
depth
,
int
row
,
int
col
,
size_t
stride
,
bool
write_nhwc
);
void
MatmulFloatNeon64Opt
(
const
float
*
a
,
const
float
*
b
,
float
*
c
,
const
float
*
bias
,
int
act_type
,
int
depth
,
int
row
,
int
col
,
size_t
stride
,
bool
write_nhwc
);
int
col
,
size_t
stride
,
size_t
writeNhwc
,
size_t
writeC4
);
#endif
#ifdef __cplusplus
}
...
...
mindspore/lite/src/runtime/kernel/arm/fp32/convolution_1x1.cc
浏览文件 @
99cc44d2
...
...
@@ -145,7 +145,7 @@ int Convolution1x1CPUKernel::DoConv1x1(int task_id) {
MatMulOpt
(
pack_input_
,
weight_ptr_
+
task_id
*
thread_stride_
*
matmul_param_
->
deep_
,
output_ptr_
+
task_id
*
thread_stride_
,
bias
,
matmul_param_
->
act_type_
,
matmul_param_
->
deep_
,
matmul_param_
->
row_
,
cur_oc
,
matmul_param_
->
col_
,
true
);
matmul_param_
->
row_
,
cur_oc
,
matmul_param_
->
col_
,
1
,
0
);
return
RET_OK
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录