Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
4cf499c0
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看板
提交
4cf499c0
编写于
10月 18, 2019
作者:
B
bingyanghuang
提交者:
Tao Luo
10月 18, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cherry-pick PR#20640 to release 1.6, test=release/1.6 (#20706)
上级
33a58e58
变更
2
展开全部
隐藏空白更改
内联
并排
Showing
2 changed file
with
303 addition
and
200 deletion
+303
-200
paddle/fluid/operators/mkldnn/conv_mkldnn_op.cc
paddle/fluid/operators/mkldnn/conv_mkldnn_op.cc
+253
-200
paddle/fluid/platform/mkldnn_reuse.h
paddle/fluid/platform/mkldnn_reuse.h
+50
-0
未找到文件。
paddle/fluid/operators/mkldnn/conv_mkldnn_op.cc
浏览文件 @
4cf499c0
此差异已折叠。
点击以展开。
paddle/fluid/platform/mkldnn_reuse.h
浏览文件 @
4cf499c0
...
@@ -816,6 +816,15 @@ class ConvMKLDNNTemplateHandler : public MKLDNNHandler {
...
@@ -816,6 +816,15 @@ class ConvMKLDNNTemplateHandler : public MKLDNNHandler {
mkldnn
::
engine
engine
,
const
std
::
string
&
base_key
)
mkldnn
::
engine
engine
,
const
std
::
string
&
base_key
)
:
platform
::
MKLDNNHandler
(
dev_ctx
,
engine
,
base_key
)
{}
:
platform
::
MKLDNNHandler
(
dev_ctx
,
engine
,
base_key
)
{}
// TODO(jczaja): remove after conv int8 is adapted
ConvMKLDNNTemplateHandler
(
std
::
shared_ptr
<
typename
forward_t
::
primitive_desc
>
conv_pd
,
const
platform
::
MKLDNNDeviceContext
&
dev_ctx
,
mkldnn
::
engine
engine
,
const
std
::
string
&
base_key
)
:
platform
::
MKLDNNHandler
(
dev_ctx
,
engine
,
base_key
)
{
conv_pd_
=
conv_pd
;
}
ConvMKLDNNTemplateHandler
(
ConvMKLDNNTemplateHandler
(
std
::
shared_ptr
<
typename
forward_t
::
primitive_desc
>
conv_pd
,
std
::
shared_ptr
<
typename
forward_t
::
primitive_desc
>
conv_pd
,
std
::
shared_ptr
<
typename
backward_data_t
::
primitive_desc
>
std
::
shared_ptr
<
typename
backward_data_t
::
primitive_desc
>
...
@@ -1136,6 +1145,47 @@ using ConvTransposeMKLDNNHandler =
...
@@ -1136,6 +1145,47 @@ using ConvTransposeMKLDNNHandler =
mkldnn
::
deconvolution_backward_data
,
mkldnn
::
deconvolution_backward_data
,
mkldnn
::
deconvolution_backward_weights
>
;
mkldnn
::
deconvolution_backward_weights
>
;
template
<
typename
T
>
static
std
::
shared_ptr
<
mkldnn
::
memory
>
SetDstMemory
(
const
framework
::
ExecutionContext
&
ctx
,
framework
::
Tensor
*
output
,
const
std
::
shared_ptr
<
ConvMKLDNNHandler
>&
handler
)
{
T
*
output_data
=
output
->
mutable_data
<
T
>
(
ctx
.
GetPlace
(),
handler
->
GetDstMemorySize
());
std
::
shared_ptr
<
mkldnn
::
memory
>
dst_memory_p
=
handler
->
AcquireDstMemoryFromPrimitive
(
to_void_cast
<
T
>
(
output_data
));
return
dst_memory_p
;
}
template
<
typename
T
>
static
std
::
shared_ptr
<
mkldnn
::
memory
>
SetDstMemory
(
const
framework
::
ExecutionContext
&
ctx
,
framework
::
Tensor
*
output
,
const
framework
::
Tensor
*
residual_param
,
const
mkldnn
::
memory
::
desc
&
user_residual_md
,
const
std
::
shared_ptr
<
ConvMKLDNNHandler
>&
handler
,
std
::
vector
<
mkldnn
::
primitive
>*
pipeline
)
{
const
T
*
residual_param_data
=
residual_param
->
data
<
T
>
();
PADDLE_ENFORCE
(
residual_param_data
!=
nullptr
,
"Provide data if you want MKLDNN conv+elementwise_add fusion"
);
std
::
shared_ptr
<
mkldnn
::
memory
>
user_residual_memory_p
=
handler
->
AcquireResidualDataMemory
(
user_residual_md
,
to_void_cast
<
T
>
(
residual_param_data
));
T
*
output_data
=
output
->
mutable_data
<
T
>
(
ctx
.
GetPlace
());
std
::
shared_ptr
<
mkldnn
::
memory
>
dst_memory_p
=
handler
->
AcquireDstMemoryFromResidualDataMemory
(
user_residual_memory_p
,
to_void_cast
<
T
>
(
output_data
),
*
pipeline
);
return
dst_memory_p
;
}
template
<
typename
T
>
static
void
SetDstMemoryHandler
(
const
framework
::
ExecutionContext
&
ctx
,
framework
::
Tensor
*
output
,
const
std
::
shared_ptr
<
ConvMKLDNNHandler
>&
handler
,
std
::
shared_ptr
<
mkldnn
::
memory
>
dst_memory_p
)
{
T
*
output_data
=
output
->
mutable_data
<
T
>
(
ctx
.
GetPlace
(),
handler
->
GetDstMemorySize
());
dst_memory_p
->
set_data_handle
(
to_void_cast
<
T
>
(
output_data
));
}
template
<
typename
T
>
template
<
typename
T
>
static
void
SetDstMemoryQuantized
(
static
void
SetDstMemoryQuantized
(
const
framework
::
ExecutionContext
&
ctx
,
framework
::
Tensor
*
output
,
const
framework
::
ExecutionContext
&
ctx
,
framework
::
Tensor
*
output
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录