Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
f1cebfef
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看板
提交
f1cebfef
编写于
10月 04, 2022
作者:
J
Jacek Czaja
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
- more fixes
上级
d7652d5f
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
17 addition
and
43 deletion
+17
-43
paddle/fluid/framework/tensor_util.cc
paddle/fluid/framework/tensor_util.cc
+2
-2
paddle/fluid/operators/mkldnn/mul_mkldnn_op.cc
paddle/fluid/operators/mkldnn/mul_mkldnn_op.cc
+8
-8
paddle/fluid/operators/mkldnn/requantize_mkldnn_op.cc
paddle/fluid/operators/mkldnn/requantize_mkldnn_op.cc
+2
-4
paddle/fluid/operators/mkldnn/reshape_mkldnn_op.cc
paddle/fluid/operators/mkldnn/reshape_mkldnn_op.cc
+2
-2
paddle/fluid/operators/slice_op.cc
paddle/fluid/operators/slice_op.cc
+2
-12
paddle/phi/core/dense_tensor.cc
paddle/phi/core/dense_tensor.cc
+0
-3
paddle/phi/core/dense_tensor.h
paddle/phi/core/dense_tensor.h
+0
-10
paddle/phi/core/dense_tensor_impl.cc
paddle/phi/core/dense_tensor_impl.cc
+0
-1
paddle/phi/kernels/onednn/split_kernel.cc
paddle/phi/kernels/onednn/split_kernel.cc
+1
-1
未找到文件。
paddle/fluid/framework/tensor_util.cc
浏览文件 @
f1cebfef
...
...
@@ -1205,8 +1205,8 @@ std::ostream& operator<<(std::ostream& os, const phi::DenseTensor& t) {
<<
"
\n
"
;
#ifdef PADDLE_WITH_MKLDNN
os
<<
" -
format
: "
<<
dnnl_fmt_tag2str
(
static_cast
<
dnnl_format_tag_t
>
(
t
.
format
()
))
<<
"
\n
"
;
os
<<
" -
memory desc
: "
<<
(
t
.
mem_desc
(
))
<<
"
\n
"
;
#endif
DenseTensor
tensor
;
...
...
paddle/fluid/operators/mkldnn/mul_mkldnn_op.cc
浏览文件 @
f1cebfef
...
...
@@ -203,15 +203,15 @@ class MulPrimitiveFactory {
const
ExecutionContext
&
ctx
)
{
Tensor
x_tmp
;
Tensor
data_matrix
;
MKLDNNMemoryFormat
src_fmt
=
data
->
format
();
MKLDNNMemoryFormat
dst_fmt
;
auto
src_mdesc
=
CreateMemDescriptor
<
T
>
(
data
,
src_fmt
);
if
((
data
->
dims
().
size
()
==
4
&&
src_fmt
!=
(
dst_fmt
=
MKLDNNMemoryFormat
::
nchw
))
||
(
data
->
dims
().
size
()
==
5
&&
src_fmt
!=
(
dst_fmt
=
MKLDNNMemoryFormat
::
ncdhw
)))
{
auto
dst_mdesc
=
CreateMemDescriptor
<
T
>
(
data
,
dst_fmt
);
// This code is enforcing plain (non-blocked) memory arrangement
// in order to flatten (reduce dimensionality) of Tensor later
auto
src_mdesc
=
data
->
mem_desc
();
auto
dst_mdesc
=
data
->
dims
().
size
()
>=
4
?
(
data
->
dims
().
size
()
==
5
?
CreateMemDescriptor
(
data
,
MKLDNNMemoryFormat
::
ncdhw
)
:
CreateMemDescriptor
(
data
,
MKLDNNMemoryFormat
::
nchw
)
)
:
src_mdesc
;
if
(
src_mdesc
!=
dst_mdesc
)
{
x_tmp
.
mutable_data
<
T
>
(
ctx
.
GetPlace
(),
data
->
memory_size
());
Reorder
(
src_mdesc
,
...
...
paddle/fluid/operators/mkldnn/requantize_mkldnn_op.cc
浏览文件 @
f1cebfef
...
...
@@ -85,15 +85,13 @@ class ReQuantOpKernel : public framework::OpKernel<T> {
const
T
*
input_data
=
input
->
data
<
T
>
();
if
(
reorder_p
==
nullptr
)
{
auto
dst_tz
=
phi
::
vectorize
(
output
->
dims
());
auto
src_dt
=
framework
::
ToMKLDNNDataType
(
framework
::
TransToProtoVarType
(
input
->
dtype
()));
auto
dst_dt
=
with_shift
?
framework
::
MKLDNNDataType
::
u8
:
src_dt
;
auto
src_md
=
platform
::
MKLDNNMemDesc
({
src_tz
},
src_dt
,
input
->
format
());
src_memory
=
std
::
make_shared
<
dnnl
::
memory
>
(
src_md
,
engine
,
to_void_cast
<
T
>
(
input_data
));
auto
dst_md
=
platform
::
MKLDNNMemDesc
({
dst_tz
},
dst_dt
,
input
->
format
()
);
input
->
mem_desc
()
,
engine
,
to_void_cast
<
T
>
(
input_data
));
auto
dst_md
=
platform
::
MKLDNNMemDesc
({
src_tz
},
dst_dt
,
input
->
mem_desc
().
strides
);
dnnl
::
primitive_attr
attri
;
int
mask
=
0
;
...
...
paddle/fluid/operators/mkldnn/reshape_mkldnn_op.cc
浏览文件 @
f1cebfef
...
...
@@ -83,7 +83,7 @@ class ReshapeMKLDNNKernel : public framework::OpKernel<T> {
onednn_engine
);
auto
reorder_src_memory_p
=
reorder_handler
.
AcquireSrcMemory
(
x
->
format
(),
platform
::
to_void_cast
(
x
->
data
<
T
>
()));
x
->
mem_desc
(),
platform
::
to_void_cast
(
x
->
data
<
T
>
()));
out
->
Resize
(
x_dims
);
// to match x numel, format is changed later
// reorder is done into a plain tag to allow usage with blocked formats
auto
reorder_dst_memory_p
=
reorder_handler
.
AcquireDstMemory
(
...
...
@@ -356,7 +356,7 @@ class ReshapeGradMKLDNNKernel : public ReshapeMKLDNNKernel<T, op_name> {
onednn_engine
);
auto
reorder_src_memory_p
=
reorder_handler
.
AcquireSrcMemory
(
dout
->
format
(),
platform
::
to_void_cast
(
dout
->
data
<
T
>
()));
dout
->
mem_desc
(),
platform
::
to_void_cast
(
dout
->
data
<
T
>
()));
auto
reorder_dst_memory_p
=
reorder_handler
.
AcquireDstMemory
(
dx
,
this
->
getPlainFormatTag
(
dout
),
ctx
.
GetPlace
());
auto
reorder_p
=
reorder_handler
.
AcquireReorder
(
reorder_dst_memory_p
,
...
...
paddle/fluid/operators/slice_op.cc
浏览文件 @
f1cebfef
...
...
@@ -161,11 +161,7 @@ class SliceOp : public framework::OperatorWithKernel {
// reorders, because if blocked dimension is not divisible by 8 or
// 16(depending on which blocking format is used) submemory cannot be
// created, so in that scenario a fallback is needed
auto
tmp_md
=
dnnl
::
memory
::
desc
(
phi
::
vectorize
(
ctx
.
Input
<
phi
::
DenseTensor
>
(
"Input"
)
->
dims
()),
dnnl
::
memory
::
data_type
::
f32
,
ctx
.
Input
<
phi
::
DenseTensor
>
(
"Input"
)
->
format
());
if
(
tmp_md
.
data
.
format_desc
.
blocking
.
inner_nblks
==
0
)
if
(
ctx
.
Input
<
phi
::
DenseTensor
>
(
"Input"
)
->
mem_desc
().
data
.
format_desc
.
blocking
.
inner_nblks
==
0
)
return
framework
::
OpKernelType
(
input_data_type
,
ctx
.
GetPlace
(),
framework
::
DataLayout
::
kMKLDNN
,
...
...
@@ -336,13 +332,7 @@ class SliceOpGrad : public framework::OperatorWithKernel {
// reorders, because if blocked dimension is not divisible by 8 or
// 16(depending on which blocking format is used) submemory cannot be
// created, so in that scenario a fallback is needed
auto
tmp_md
=
dnnl
::
memory
::
desc
(
phi
::
vectorize
(
ctx
.
Input
<
phi
::
DenseTensor
>
(
framework
::
GradVarName
(
"Out"
))
->
dims
()),
dnnl
::
memory
::
data_type
::
f32
,
ctx
.
Input
<
phi
::
DenseTensor
>
(
framework
::
GradVarName
(
"Out"
))
->
format
());
if
(
tmp_md
.
data
.
format_desc
.
blocking
.
inner_nblks
==
0
)
if
(
ctx
.
Input
<
phi
::
DenseTensor
>
(
framework
::
GradVarName
(
"Out"
))
->
mem_desc
().
data
.
format_desc
.
blocking
.
inner_nblks
==
0
)
return
framework
::
OpKernelType
(
input_data_type
,
ctx
.
GetPlace
(),
framework
::
DataLayout
::
kMKLDNN
,
...
...
paddle/phi/core/dense_tensor.cc
浏览文件 @
f1cebfef
...
...
@@ -56,7 +56,6 @@ DenseTensor::DenseTensor(const DenseTensor& other) : meta_(other.meta()) {
inplace_version_counter_
=
other
.
inplace_version_counter_
;
#ifdef PADDLE_WITH_MKLDNN
format_
=
other
.
format_
;
mem_desc_
=
other
.
mem_desc_
;
#endif
}
...
...
@@ -66,7 +65,6 @@ DenseTensor& DenseTensor::operator=(const DenseTensor& other) {
holder_
=
other
.
holder_
;
inplace_version_counter_
=
other
.
inplace_version_counter_
;
#ifdef PADDLE_WITH_MKLDNN
format_
=
other
.
format_
;
mem_desc_
=
other
.
mem_desc_
;
#endif
return
*
this
;
...
...
@@ -77,7 +75,6 @@ DenseTensor& DenseTensor::operator=(DenseTensor&& other) {
std
::
swap
(
holder_
,
other
.
holder_
);
std
::
swap
(
inplace_version_counter_
,
other
.
inplace_version_counter_
);
#ifdef PADDLE_WITH_MKLDNN
format_
=
other
.
format_
;
mem_desc_
=
other
.
mem_desc_
;
#endif
return
*
this
;
...
...
paddle/phi/core/dense_tensor.h
浏览文件 @
f1cebfef
...
...
@@ -227,16 +227,6 @@ In the final state, we should come up with a MKLDNN_Tensor and move the
following codes there.
*/
#ifdef PADDLE_WITH_MKLDNN
/**
* @brief the detail format of memory block which have layout as kMKLDNN
*
* @note MKLDNN lib support various memory format like nchw, nhwc, nChw8C,
* nChw16c, etc. For a MKLDNN memory block, layout will be set as
* DataLayout::kMKLDNN meanwhile detail memory format will be kept in
* this field.
*/
dnnl
::
memory
::
format_tag
format_
=
dnnl
::
memory
::
format_tag
::
undef
;
/// \brief memory descriptor of tensor which have layout set as kMKLDNN
dnnl
::
memory
::
desc
mem_desc_
;
#endif
...
...
paddle/phi/core/dense_tensor_impl.cc
浏览文件 @
f1cebfef
...
...
@@ -365,7 +365,6 @@ DenseTensor& DenseTensor::ShareDataWith(const DenseTensor& src) {
meta_
.
layout
=
src
.
meta_
.
layout
;
meta_
.
offset
=
src
.
meta_
.
offset
;
#ifdef PADDLE_WITH_MKLDNN
format_
=
src
.
format_
;
mem_desc_
=
src
.
mem_desc_
;
#endif
return
*
this
;
...
...
paddle/phi/kernels/onednn/split_kernel.cc
浏览文件 @
f1cebfef
...
...
@@ -49,7 +49,7 @@ void SplitKernel(const Context& dev_ctx,
out_vec_dims
,
offset
,
reorder_src_memory_p
);
auto
reorder_dst_memory_p
=
reorder_handler
.
AcquireDstMemory
(
out
[
i
],
out_vec_dims
,
x
.
format
(),
dev_ctx
.
GetPlace
());
out
[
i
],
slice_mem_p
->
get_desc
(),
dev_ctx
.
GetPlace
());
auto
reorder_p
=
reorder_handler
.
AcquireReorder
(
reorder_dst_memory_p
,
slice_mem_p
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录