Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
6c68024d
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 2 年 前同步成功
通知
2325
Star
20933
Fork
5424
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
6c68024d
编写于
6月 21, 2019
作者:
X
xingzhaolong
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'xzl/incubate/lite' into 'incubate/lite'
add gemv gemm int8 neon kernel See merge request inference/paddlelite!41
上级
ee0e12fe
8202e25d
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
64 addition
and
4 deletion
+64
-4
paddle/fluid/lite/api/cxx_api.h
paddle/fluid/lite/api/cxx_api.h
+1
-0
paddle/fluid/lite/arm/math/CMakeLists.txt
paddle/fluid/lite/arm/math/CMakeLists.txt
+2
-0
paddle/fluid/lite/core/mir/fusion/quant_dequant_op_fuser.h
paddle/fluid/lite/core/mir/fusion/quant_dequant_op_fuser.h
+1
-1
paddle/fluid/lite/core/mir/pattern_matcher_high_api.cc
paddle/fluid/lite/core/mir/pattern_matcher_high_api.cc
+1
-1
paddle/fluid/lite/core/op_registry.h
paddle/fluid/lite/core/op_registry.h
+2
-0
paddle/fluid/lite/core/optimizer.h
paddle/fluid/lite/core/optimizer.h
+0
-1
paddle/fluid/lite/core/target_wrapper.h
paddle/fluid/lite/core/target_wrapper.h
+15
-1
paddle/fluid/lite/kernels/arm/conv_compute.cc
paddle/fluid/lite/kernels/arm/conv_compute.cc
+23
-0
paddle/fluid/lite/kernels/arm/conv_compute.h
paddle/fluid/lite/kernels/arm/conv_compute.h
+19
-0
未找到文件。
paddle/fluid/lite/api/cxx_api.h
浏览文件 @
6c68024d
...
@@ -50,6 +50,7 @@ class ExecutorLite {
...
@@ -50,6 +50,7 @@ class ExecutorLite {
optimizer_
.
KernelPickPreferPlace
(
prefer_place
);
optimizer_
.
KernelPickPreferPlace
(
prefer_place
);
core
::
KernelPickFactor
factor
;
core
::
KernelPickFactor
factor
;
factor
.
ConsiderTarget
();
factor
.
ConsiderTarget
();
factor
.
ConsiderPrecision
();
optimizer_
.
Run
(
std
::
move
(
program
),
valid_places
,
factor
);
optimizer_
.
Run
(
std
::
move
(
program
),
valid_places
,
factor
);
program_
=
optimizer_
.
GenRuntimeProgram
();
program_
=
optimizer_
.
GenRuntimeProgram
();
}
}
...
...
paddle/fluid/lite/arm/math/CMakeLists.txt
浏览文件 @
6c68024d
...
@@ -35,6 +35,8 @@ cc_library(math_arm SRCS
...
@@ -35,6 +35,8 @@ cc_library(math_arm SRCS
split.cc
split.cc
activation.cc
activation.cc
dropout.cc
dropout.cc
gemm_prepacked_int8.cc
gemv_arm_int8.cc
DEPS
${
lite_kernel_deps
}
eigen3 framework_proto_lite
)
DEPS
${
lite_kernel_deps
}
eigen3 framework_proto_lite
)
# TODO(TJ): fix me do not deps proto
# TODO(TJ): fix me do not deps proto
...
...
paddle/fluid/lite/core/mir/fusion/quant_dequant_op_fuser.h
浏览文件 @
6c68024d
paddle/fluid/lite/core/mir/pattern_matcher_high_api.cc
浏览文件 @
6c68024d
...
@@ -41,7 +41,7 @@ void FuseBase::DeleteInterNodes(SSAGraph *graph) {
...
@@ -41,7 +41,7 @@ void FuseBase::DeleteInterNodes(SSAGraph *graph) {
}
}
}
}
LOG
(
INFO
)
<<
"keys: "
<<
key2nodes_
.
size
();
VLOG
(
4
)
<<
"keys: "
<<
key2nodes_
.
size
();
std
::
unordered_set
<
const
Node
*>
nodes2rm
;
std
::
unordered_set
<
const
Node
*>
nodes2rm
;
for
(
auto
&
matched
:
key2nodes_
)
{
for
(
auto
&
matched
:
key2nodes_
)
{
for
(
const
auto
&
key
:
keys
)
{
for
(
const
auto
&
key
:
keys
)
{
...
...
paddle/fluid/lite/core/op_registry.h
浏览文件 @
6c68024d
...
@@ -80,6 +80,8 @@ class KernelRegistry final {
...
@@ -80,6 +80,8 @@ class KernelRegistry final {
KernelRegistryForTarget
<
TARGET
(
kARM
),
PRECISION
(
kAny
),
KernelRegistryForTarget
<
TARGET
(
kARM
),
PRECISION
(
kAny
),
DATALAYOUT
(
kAny
)
>
*
,
//
DATALAYOUT
(
kAny
)
>
*
,
//
KernelRegistryForTarget
<
TARGET
(
kARM
),
PRECISION
(
kFloat
),
KernelRegistryForTarget
<
TARGET
(
kARM
),
PRECISION
(
kFloat
),
DATALAYOUT
(
kNCHW
)
>
*
,
//
KernelRegistryForTarget
<
TARGET
(
kARM
),
PRECISION
(
kInt8
),
DATALAYOUT
(
kNCHW
)
>
*
//
DATALAYOUT
(
kNCHW
)
>
*
//
>
;
>
;
...
...
paddle/fluid/lite/core/optimizer.h
浏览文件 @
6c68024d
...
@@ -58,7 +58,6 @@ class Optimizer {
...
@@ -58,7 +58,6 @@ class Optimizer {
#ifdef LITE_WITH_LIGHT_WEIGHT_FRAMEWORK
#ifdef LITE_WITH_LIGHT_WEIGHT_FRAMEWORK
"lite_elementwise_add_activation_fuse_pass"
,
//
"lite_elementwise_add_activation_fuse_pass"
,
//
#endif
#endif
"lite_fc_fuse_pass"
,
//
"static_kernel_pick_pass"
,
//
"static_kernel_pick_pass"
,
//
"variable_place_inference_pass"
,
//
"variable_place_inference_pass"
,
//
"argument_type_display_pass"
,
//
"argument_type_display_pass"
,
//
...
...
paddle/fluid/lite/core/target_wrapper.h
浏览文件 @
6c68024d
...
@@ -38,6 +38,7 @@ enum class PrecisionType : int {
...
@@ -38,6 +38,7 @@ enum class PrecisionType : int {
kUnk
=
0
,
kUnk
=
0
,
kFloat
,
kFloat
,
kInt8
,
kInt8
,
kInt32
,
kAny
,
// any precision
kAny
,
// any precision
NUM
,
// number of fields.
NUM
,
// number of fields.
};
};
...
@@ -48,6 +49,19 @@ enum class DataLayoutType : int {
...
@@ -48,6 +49,19 @@ enum class DataLayoutType : int {
NUM
,
// number of fields.
NUM
,
// number of fields.
};
};
static
size_t
PrecisionTypeLength
(
PrecisionType
type
)
{
switch
(
type
)
{
case
PrecisionType
::
kFloat
:
return
4
;
case
PrecisionType
::
kInt8
:
return
1
;
case
PrecisionType
::
kInt32
:
return
4
;
default:
return
4
;
}
}
// Some helper macro to get a specific TargetType.
// Some helper macro to get a specific TargetType.
#define TARGET(item__) paddle::lite::TargetType::item__
#define TARGET(item__) paddle::lite::TargetType::item__
// Some helper macro to get a specific PrecisionType.
// Some helper macro to get a specific PrecisionType.
...
@@ -87,7 +101,7 @@ static const std::string& TargetRepr(TargetType target) {
...
@@ -87,7 +101,7 @@ static const std::string& TargetRepr(TargetType target) {
static
const
std
::
string
&
PrecisionRepr
(
PrecisionType
precision
)
{
static
const
std
::
string
&
PrecisionRepr
(
PrecisionType
precision
)
{
static
const
std
::
string
precision2string
[]
=
{
"kUnk"
,
"kFloat"
,
"kInt8"
,
static
const
std
::
string
precision2string
[]
=
{
"kUnk"
,
"kFloat"
,
"kInt8"
,
"kAny"
};
"k
Int32"
,
"k
Any"
};
auto
x
=
static_cast
<
int
>
(
precision
);
auto
x
=
static_cast
<
int
>
(
precision
);
CHECK_LT
(
x
,
static_cast
<
int
>
(
PRECISION
(
NUM
)));
CHECK_LT
(
x
,
static_cast
<
int
>
(
PRECISION
(
NUM
)));
return
precision2string
[
x
];
return
precision2string
[
x
];
...
...
paddle/fluid/lite/kernels/arm/conv_compute.cc
浏览文件 @
6c68024d
...
@@ -92,6 +92,9 @@ void ConvCompute::Run() {
...
@@ -92,6 +92,9 @@ void ConvCompute::Run() {
// }
// }
}
}
void
ConvComputeInt8
::
PrepareForRun
()
{}
void
ConvComputeInt8
::
Run
()
{}
}
// namespace arm
}
// namespace arm
}
// namespace kernels
}
// namespace kernels
}
// namespace lite
}
// namespace lite
...
@@ -112,3 +115,23 @@ REGISTER_LITE_KERNEL(depthwise_conv2d, kARM, kFloat, kNCHW,
...
@@ -112,3 +115,23 @@ REGISTER_LITE_KERNEL(depthwise_conv2d, kARM, kFloat, kNCHW,
.
BindInput
(
"Filter"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kARM
))})
.
BindInput
(
"Filter"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kARM
))})
.
BindOutput
(
"Output"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kARM
))})
.
BindOutput
(
"Output"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kARM
))})
.
Finalize
();
.
Finalize
();
REGISTER_LITE_KERNEL
(
conv2d
,
kARM
,
kInt8
,
kNCHW
,
paddle
::
lite
::
kernels
::
arm
::
ConvComputeInt8
,
def
)
.
BindInput
(
"Input"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kARM
),
PRECISION
(
kInt8
))})
.
BindInput
(
"Bias"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kARM
),
PRECISION
(
kInt32
))})
.
BindInput
(
"Filter"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kARM
),
PRECISION
(
kInt8
))})
.
BindOutput
(
"Output"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kARM
),
PRECISION
(
kInt8
))})
.
Finalize
();
REGISTER_LITE_KERNEL
(
depthwise_conv2d
,
kARM
,
kInt8
,
kNCHW
,
paddle
::
lite
::
kernels
::
arm
::
ConvComputeInt8
,
def
)
.
BindInput
(
"Input"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kARM
),
PRECISION
(
kInt8
))})
.
BindInput
(
"Bias"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kARM
),
PRECISION
(
kInt32
))})
.
BindInput
(
"Filter"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kARM
),
PRECISION
(
kInt8
))})
.
BindOutput
(
"Output"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kARM
),
PRECISION
(
kInt8
))})
.
Finalize
();
paddle/fluid/lite/kernels/arm/conv_compute.h
浏览文件 @
6c68024d
...
@@ -41,6 +41,25 @@ class ConvCompute : public KernelLite<TARGET(kARM), PRECISION(kFloat)> {
...
@@ -41,6 +41,25 @@ class ConvCompute : public KernelLite<TARGET(kARM), PRECISION(kFloat)> {
nullptr
};
nullptr
};
};
};
class
ConvComputeInt8
:
public
KernelLite
<
TARGET
(
kARM
),
PRECISION
(
kInt8
)
>
{
public:
using
param_t
=
operators
::
ConvParam
;
void
PrepareForRun
()
override
;
void
Run
()
override
;
~
ConvComputeInt8
()
{
if
(
impl_
!=
nullptr
)
{
delete
impl_
;
}
}
private:
lite
::
arm
::
math
::
ImplBase
<
TARGET
(
kARM
),
PRECISION
(
kInt8
),
param_t
>*
impl_
{
nullptr
};
};
}
// namespace arm
}
// namespace arm
}
// namespace kernels
}
// namespace kernels
}
// namespace lite
}
// namespace lite
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录