Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
fcf6fa0c
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
332
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看板
未验证
提交
fcf6fa0c
编写于
5月 29, 2020
作者:
Y
Yuan Shuai
提交者:
GitHub
5月 29, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[LITE][PROFILE] Fix profiler summary (#3724)
* [LITE][PROFILE] Fix summary info for profiler. test=develop
上级
2fbf2968
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
20 addition
and
16 deletion
+20
-16
lite/core/profile/profiler.cc
lite/core/profile/profiler.cc
+11
-16
lite/core/profile/profiler.h
lite/core/profile/profiler.h
+9
-0
未找到文件。
lite/core/profile/profiler.cc
浏览文件 @
fcf6fa0c
...
...
@@ -24,14 +24,9 @@ namespace profile {
namespace
{
auto
op_comp
=
[](
const
OpCharacter
&
c1
,
const
OpCharacter
&
c2
)
{
if
(
c1
.
kernel_func_name
==
"NotImpl"
&&
c2
.
kernel_func_name
==
"NotImpl"
)
{
return
(
c1
.
target
<
c2
.
target
)
||
(
c1
.
op_type
<
c2
.
op_type
)
||
(
c1
.
kernel_name
<
c2
.
kernel_name
)
||
(
c1
.
remark
<
c2
.
remark
);
}
else
{
// compare with ch.kernel_func_name
return
(
c1
.
target
<
c2
.
target
)
||
(
c1
.
op_type
<
c2
.
op_type
)
||
(
c1
.
kernel_name
<
c2
.
kernel_name
)
||
(
c1
.
kernel_func_name
<
c2
.
kernel_func_name
);
}
// compare for unique key of map
return
(
c1
.
kernel_name
+
c1
.
kernel_func_name
<
c2
.
kernel_name
+
c2
.
kernel_func_name
);
};
}
// namespace
...
...
@@ -95,14 +90,13 @@ void Profiler::StopTiming(Type type, const int index, KernelContext* ctx) {
}
int
Profiler
::
GetKernelFuncCalledTimes
(
const
std
::
string
&
op_type
,
const
std
::
string
&
kernel_attr
,
const
std
::
string
&
kernel_func_name
)
{
int
count
=
0
;
for
(
size_t
i
=
0
;
i
<
units_
.
size
();
++
i
)
{
if
((
units_
[
i
].
character
.
kernel_func_name
==
kernel_func_name
)
&&
(
units_
[
i
].
character
.
kernel_func_name
!=
"NotImpl"
))
{
++
count
;
}
else
if
((
units_
[
i
].
character
.
kernel_func_name
==
"NotImpl"
)
&&
(
units_
[
i
].
character
.
op_type
==
op_type
))
{
(
units_
[
i
].
character
.
kernel_attr
==
kernel_attr
)
&&
(
units_
[
i
].
character
.
op_type
==
op_type
))
{
++
count
;
}
}
...
...
@@ -110,14 +104,13 @@ int Profiler::GetKernelFuncCalledTimes(const std::string& op_type,
}
float
Profiler
::
GetKernelFuncSummaryGOPs
(
const
std
::
string
&
op_type
,
const
std
::
string
&
kernel_attr
,
const
std
::
string
&
kernel_func_name
)
{
float
GOPs
=
0
;
for
(
size_t
i
=
0
;
i
<
units_
.
size
();
++
i
)
{
if
((
units_
[
i
].
character
.
kernel_func_name
==
kernel_func_name
)
&&
(
units_
[
i
].
character
.
kernel_func_name
!=
"NotImpl"
))
{
GOPs
+=
units_
[
i
].
character
.
macs
;
}
else
if
((
units_
[
i
].
character
.
kernel_func_name
==
"NotImpl"
)
&&
(
units_
[
i
].
character
.
op_type
==
op_type
))
{
(
units_
[
i
].
character
.
kernel_attr
==
kernel_attr
)
&&
(
units_
[
i
].
character
.
op_type
==
op_type
))
{
GOPs
+=
units_
[
i
].
character
.
macs
;
}
}
...
...
@@ -232,9 +225,11 @@ std::string Profiler::Summary(Type type, bool concise, size_t w) {
<<
" "
<<
setprecision
(
2
)
<<
percent
<<
"% "
<<
" "
<<
setw
(
7
)
<<
left
<<
fixed
<<
setprecision
(
3
)
<<
GetKernelFuncSummaryGOPs
(
item
.
first
.
op_type
,
item
.
first
.
kernel_attr
,
item
.
first
.
kernel_func_name
)
<<
" "
<<
setw
(
11
)
<<
left
<<
fixed
<<
GetKernelFuncCalledTimes
(
item
.
first
.
op_type
,
item
.
first
.
kernel_attr
,
item
.
first
.
kernel_func_name
);
#ifdef LITE_WITH_OPENCL
float
cl_percent
=
0
;
...
...
lite/core/profile/profiler.h
浏览文件 @
fcf6fa0c
...
...
@@ -78,6 +78,13 @@ struct OpCharacter {
}
return
dim_str
;
}
std
::
string
str
()
{
std
::
string
str
{
""
};
str
+=
kernel_name
+
"/"
+
kernel_func_name
+
"/"
+
remark
+
"/"
+
input_shape
+
"/"
+
filter_shape
+
"/"
+
output_shape
;
return
str
;
}
};
class
StatisUnit
final
{
...
...
@@ -102,8 +109,10 @@ class Profiler final {
void
StopTiming
(
Type
type
,
const
int
index
,
KernelContext
*
ctx
);
std
::
string
Summary
(
Type
type
,
bool
concise
=
true
,
size_t
warm_up
=
10
);
int
GetKernelFuncCalledTimes
(
const
std
::
string
&
op_type
,
const
std
::
string
&
kernel_attr
,
const
std
::
string
&
kernel_func_name
);
float
GetKernelFuncSummaryGOPs
(
const
std
::
string
&
op_type
,
const
std
::
string
&
kernel_attr
,
const
std
::
string
&
kernel_func_name
);
OpCharacter
*
GetOpCharacter
(
const
size_t
index
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录