Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
cfcb96d2
P
Paddle
项目概览
Crayon鑫
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
cfcb96d2
编写于
7月 30, 2019
作者:
J
Jacek Czaja
提交者:
Tao Luo
7月 30, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[MKL-DNN] Fix int8 performance regression (#18758)
test=develop - optimization of TID to string test=develop
上级
e0a2d4df
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
24 addition
and
15 deletion
+24
-15
paddle/fluid/operators/mkldnn/concat_mkldnn_op.cc
paddle/fluid/operators/mkldnn/concat_mkldnn_op.cc
+2
-4
paddle/fluid/operators/mkldnn/conv_mkldnn_op.cc
paddle/fluid/operators/mkldnn/conv_mkldnn_op.cc
+15
-6
paddle/fluid/platform/mkldnn_reuse.h
paddle/fluid/platform/mkldnn_reuse.h
+7
-5
未找到文件。
paddle/fluid/operators/mkldnn/concat_mkldnn_op.cc
浏览文件 @
cfcb96d2
...
...
@@ -83,11 +83,9 @@ std::string CreateKey(const paddle::framework::ExecutionContext& ctx,
std
::
to_string
(
multi_input
[
0
]
->
format
()));
if
(
platform
::
get_cur_mkldnn_session_id
()
==
platform
::
kMKLDNNSessionID_Default
)
{
auto
tid
=
std
::
this_thread
::
get_id
();
std
::
stringstream
ss
;
ss
<<
tid
;
platform
::
MKLDNNHandler
::
AppendKey
(
&
key
,
"-t:"
);
platform
::
MKLDNNHandler
::
AppendKey
(
&
key
,
ss
.
str
());
platform
::
MKLDNNHandler
::
AppendKey
(
&
key
,
platform
::
MKLDNNHandler
::
ThreadIDasStr
());
}
return
key
;
}
...
...
paddle/fluid/operators/mkldnn/conv_mkldnn_op.cc
浏览文件 @
cfcb96d2
...
...
@@ -408,12 +408,21 @@ class ConvMKLDNNOpKernel : public paddle::framework::OpKernel<T> {
std
::
shared_ptr
<
mkldnn
::
convolution_forward
::
primitive_desc
>
conv_pd
;
std
::
shared_ptr
<
platform
::
ConvMKLDNNHandler
>
handler
;
auto
prim_key
=
key
+
"@conv_p"
;
auto
dst_key
=
key
+
"@dst_mem_p"
;
auto
src_key
=
key
+
"@src_mem_p"
;
auto
user_src_key
=
key
+
"@user_src_mem_p"
;
auto
src_reorder_key
=
key
+
"@src_mem_preorder_p"
;
auto
residual_reorder_key
=
key
+
"@residual_data_mem_preorder_p"
;
// This is workaround for hacky implementation
// of conv int8 mkl-dnn. Once conv fp32 and conv int8
// are merged/unified, this will disappear
std
::
string
key_tid
=
""
;
if
(
platform
::
get_cur_mkldnn_session_id
()
==
platform
::
kMKLDNNSessionID_Default
)
{
key_tid
=
"-t:"
+
platform
::
MKLDNNHandler
::
ThreadIDasStr
();
}
auto
prim_key
=
key
+
key_tid
+
"@conv_p"
;
auto
dst_key
=
key
+
key_tid
+
"@dst_mem_p"
;
auto
src_key
=
key
+
key_tid
+
"@src_mem_p"
;
auto
user_src_key
=
key
+
key_tid
+
"@user_src_mem_p"
;
auto
src_reorder_key
=
key
+
key_tid
+
"@src_mem_preorder_p"
;
auto
residual_reorder_key
=
key
+
key_tid
+
"@residual_data_mem_preorder_p"
;
conv_p
=
std
::
static_pointer_cast
<
mkldnn
::
convolution_forward
>
(
dev_ctx
.
GetBlob
(
prim_key
));
...
...
paddle/fluid/platform/mkldnn_reuse.h
浏览文件 @
cfcb96d2
...
...
@@ -34,14 +34,11 @@ class MKLDNNHandler {
MKLDNNHandler
(
const
MKLDNNDeviceContext
&
dev_ctx
,
mkldnn
::
engine
engine
,
const
std
::
string
&
base_key
)
:
dev_ctx_
(
dev_ctx
),
engine_
(
engine
),
key_common_
(
base_key
)
{
// TODO(jczaja): Make it faster
auto
tid
=
std
::
this_thread
::
get_id
();
std
::
stringstream
ss
;
ss
<<
tid
;
key_
=
key_common_
+
"-t:"
+
ss
.
str
();
if
(
platform
::
get_cur_mkldnn_session_id
()
!=
platform
::
kMKLDNNSessionID_Default
)
{
key_
=
key_common_
;
}
else
{
key_
=
key_common_
+
"-t:"
+
MKLDNNHandler
::
ThreadIDasStr
();
}
}
...
...
@@ -205,6 +202,11 @@ class MKLDNNHandler {
return
target_memory_p
;
}
static
std
::
string
ThreadIDasStr
(
void
)
{
return
std
::
to_string
(
std
::
hash
<
std
::
thread
::
id
>
()(
std
::
this_thread
::
get_id
()));
}
static
std
::
string
GetHash
(
mkldnn
::
memory
::
dims
&
operand_dims
,
// NOLINT
const
std
::
string
&
suffix
)
{
return
dims2str
(
operand_dims
)
+
suffix
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录