Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
2265d63c
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
Star
20931
Fork
5422
代码
文件
提交
分支
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看板
未验证
提交
2265d63c
编写于
7月 31, 2023
作者:
H
hong
提交者:
GitHub
7月 31, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[NewIR]fix new ir shadow typo (#55706)
* fix new ir shadow typo * update
上级
ae93930f
变更
12
显示空白变更内容
内联
并排
Showing
12 changed file
with
45 addition
and
40 deletion
+45
-40
paddle/fluid/framework/executor_cache.cc
paddle/fluid/framework/executor_cache.cc
+2
-2
paddle/fluid/framework/new_executor/interpreter/interpreter_util.cc
...id/framework/new_executor/interpreter/interpreter_util.cc
+1
-1
paddle/fluid/ir/dialect/pd_op.yaml
paddle/fluid/ir/dialect/pd_op.yaml
+2
-2
paddle/fluid/ir/phi_kernel_adaptor/phi_kernel_util.cc
paddle/fluid/ir/phi_kernel_adaptor/phi_kernel_util.cc
+3
-3
paddle/fluid/ir/transforms/pd_op_to_kernel_pass.cc
paddle/fluid/ir/transforms/pd_op_to_kernel_pass.cc
+11
-11
paddle/fluid/ir_adaptor/translator/op_translator.cc
paddle/fluid/ir_adaptor/translator/op_translator.cc
+2
-2
paddle/phi/api/yaml/op_compat.yaml
paddle/phi/api/yaml/op_compat.yaml
+4
-0
paddle/phi/api/yaml/ops.yaml
paddle/phi/api/yaml/ops.yaml
+2
-2
paddle/phi/kernels/cpu/feed_with_place_kernel.cc
paddle/phi/kernels/cpu/feed_with_place_kernel.cc
+7
-6
paddle/phi/kernels/feed_with_place_kernel.h
paddle/phi/kernels/feed_with_place_kernel.h
+6
-6
paddle/phi/kernels/gpu/feed_with_place_kernel.cu
paddle/phi/kernels/gpu/feed_with_place_kernel.cu
+2
-2
paddle/phi/kernels/impl/feed_with_place_impl.h
paddle/phi/kernels/impl/feed_with_place_impl.h
+3
-3
未找到文件。
paddle/fluid/framework/executor_cache.cc
浏览文件 @
2265d63c
...
...
@@ -402,7 +402,7 @@ std::unique_ptr<::ir::Program> ConstructFowardIrProgram(
}
auto
op_desc
=
local_program
.
MutableBlock
(
0
)
->
AppendOp
();
op_desc
->
SetType
(
"shad
d
ow_output"
);
op_desc
->
SetType
(
"shadow_output"
);
op_desc
->
SetAttr
(
"name"
,
name
);
op_desc
->
SetInput
(
"x"
,
{
name
});
op_desc
->
SetOutput
(
"out"
,
{
"@EMPTY@"
});
...
...
@@ -458,7 +458,7 @@ std::unique_ptr<::ir::Program> ConstructBackwardIrProgram(
continue
;
}
auto
op_desc
=
local_program
.
MutableBlock
(
0
)
->
AppendOp
();
op_desc
->
SetType
(
"shad
d
ow_output"
);
op_desc
->
SetType
(
"shadow_output"
);
op_desc
->
SetAttr
(
"name"
,
name
);
op_desc
->
SetInput
(
"x"
,
{
name
});
op_desc
->
SetOutput
(
"out"
,
{
"@EMPTY@"
});
...
...
paddle/fluid/framework/new_executor/interpreter/interpreter_util.cc
浏览文件 @
2265d63c
...
...
@@ -980,7 +980,7 @@ void BuildOpFuncList(
if
(
op_name
==
"builtin.combine"
||
op_name
==
"pd.feed"
||
op_name
==
"builtin.set_parameter"
||
op_name
==
"builtin.get_parameter"
||
op_name
==
"builtin.slice"
||
op_name
==
"pd.feed_with_place"
||
op_name
==
"pd.shad
d
ow_output"
)
{
op_name
==
"pd.feed_with_place"
||
op_name
==
"pd.shadow_output"
)
{
VLOG
(
6
)
<<
"skip process "
<<
op_name
;
continue
;
}
...
...
paddle/fluid/ir/dialect/pd_op.yaml
浏览文件 @
2265d63c
...
...
@@ -277,7 +277,7 @@
backward
:
null
-
name
:
shad
d
ow_feed
-
name
:
shadow_feed
inputs
:
-
typename
:
Tensor
name
:
x
...
...
@@ -293,7 +293,7 @@
func
:
UnchangedInferMeta
param
:
[
x
]
kernel
:
func
:
[
shad
d
ow_feed
]
func
:
[
shadow_feed
]
param
:
[
x
]
backend
:
null
layout
:
null
...
...
paddle/fluid/ir/phi_kernel_adaptor/phi_kernel_util.cc
浏览文件 @
2265d63c
...
...
@@ -278,8 +278,8 @@ void HandleForSpecialOp(
(
*
value_2_var_name
)[
value
]
=
param_name
;
}
if
(
op_name
==
"pd.shad
d
ow_output"
)
{
VLOG
(
6
)
<<
"Handle for pd.shad
d
ow_ouptut"
;
if
(
op_name
==
"pd.shadow_output"
)
{
VLOG
(
6
)
<<
"Handle for pd.shadow_ouptut"
;
auto
var_name
=
op
->
attributes
().
at
(
"name"
).
dyn_cast
<
ir
::
StrAttribute
>
().
AsString
();
...
...
@@ -408,7 +408,7 @@ void BuildScope(const ir::Block& block,
if
(
op_name
==
"pd.feed"
||
op_name
==
"pd.fetch"
||
op_name
==
"builtin.combine"
||
op_name
==
"builtin.set_parameter"
||
op_name
==
"builtin.get_parameter"
||
op_name
==
"builtin.slice"
||
op_name
==
"pd.feed_with_place"
||
op_name
==
"pd.shad
d
ow_output"
)
{
op_name
==
"pd.feed_with_place"
||
op_name
==
"pd.shadow_output"
)
{
HandleForSpecialOp
(
op
,
inner_scope
,
var_name_prefix
,
...
...
paddle/fluid/ir/transforms/pd_op_to_kernel_pass.cc
浏览文件 @
2265d63c
...
...
@@ -437,30 +437,30 @@ std::unique_ptr<ir::Program> PdOpLowerToKernelPass(ir::Program* prog,
program
->
block
()
->
push_back
(
op
);
if
((
*
it
)
->
name
()
==
"pd.feed"
&&
platform
::
is_gpu_place
(
place
))
{
// add shad
d
ow feed op
phi
::
KernelKey
shad
d
ow_key
{
// add shadow feed op
phi
::
KernelKey
shadow_key
{
phi
::
Backend
::
GPU
,
phi
::
DataLayout
::
ANY
,
TransToPhiDataType
(
(
*
it
)
->
result
(
0
).
type
().
dyn_cast
<
DenseTensorType
>
().
dtype
())};
std
::
unordered_map
<
std
::
string
,
ir
::
Attribute
>
attr_map
{
{
"op_name"
,
ir
::
StrAttribute
::
get
(
ctx
,
"pd.shad
d
ow_feed"
)},
{
"kernel_name"
,
ir
::
StrAttribute
::
get
(
ctx
,
"shad
d
ow_feed"
)},
{
"kernel_key"
,
dialect
::
KernelAttribute
::
get
(
ctx
,
shad
d
ow_key
)}};
{
"op_name"
,
ir
::
StrAttribute
::
get
(
ctx
,
"pd.shadow_feed"
)},
{
"kernel_name"
,
ir
::
StrAttribute
::
get
(
ctx
,
"shadow_feed"
)},
{
"kernel_key"
,
dialect
::
KernelAttribute
::
get
(
ctx
,
shadow_key
)}};
auto
out_type
=
paddle
::
dialect
::
AllocatedDenseTensorType
::
get
(
ctx
,
phi
::
TransToPhiPlace
(
shad
d
ow_key
.
backend
()),
phi
::
TransToPhiPlace
(
shadow_key
.
backend
()),
(
*
it
)
->
result
(
0
).
type
().
dyn_cast
<
dialect
::
DenseTensorType
>
());
ir
::
Operation
*
shad
d
ow_op
=
ir
::
Operation
*
shadow_op
=
ir
::
Operation
::
Create
({
op
->
result
(
0
)},
attr_map
,
{
out_type
},
op_info
);
map_op_pair
[
*
it
]
=
shad
d
ow_op
;
program
->
block
()
->
push_back
(
shad
d
ow_op
);
map_op_pair
[
*
it
]
=
shadow_op
;
program
->
block
()
->
push_back
(
shadow_op
);
if
((
*
it
)
->
num_results
()
>
0
)
{
for
(
size_t
i
=
0
;
i
<
shad
d
ow_op
->
num_results
();
++
i
)
{
map_value_pair
[(
*
it
)
->
result
(
i
)]
=
shad
d
ow_op
->
result
(
i
);
for
(
size_t
i
=
0
;
i
<
shadow_op
->
num_results
();
++
i
)
{
map_value_pair
[(
*
it
)
->
result
(
i
)]
=
shadow_op
->
result
(
i
);
}
}
}
...
...
paddle/fluid/ir_adaptor/translator/op_translator.cc
浏览文件 @
2265d63c
...
...
@@ -1136,7 +1136,7 @@ struct FetchOpTranscriber : public OpTranscriber {
}
};
struct
Shad
d
owOutputOpTranscriber
:
public
OpTranscriber
{
struct
ShadowOutputOpTranscriber
:
public
OpTranscriber
{
ir
::
Operation
*
operator
()(
ir
::
IrContext
*
ctx
,
TranslationContext
*
param_map
,
const
OpDesc
&
op_desc
,
...
...
@@ -1463,7 +1463,7 @@ OpTranslator::OpTranslator() {
special_handlers
[
"reduce_all"
]
=
ReduceOpTranscriber
();
special_handlers
[
"reduce_any"
]
=
ReduceOpTranscriber
();
special_handlers
[
"rnn"
]
=
RnnOpTranscriber
();
special_handlers
[
"shad
dow_output"
]
=
Shad
dowOutputOpTranscriber
();
special_handlers
[
"shad
ow_output"
]
=
Sha
dowOutputOpTranscriber
();
special_handlers
[
"split"
]
=
SplitOpTranscriber
();
special_handlers
[
"sum"
]
=
AddNOpTranscriber
();
...
...
paddle/phi/api/yaml/op_compat.yaml
浏览文件 @
2265d63c
...
...
@@ -2412,6 +2412,10 @@
extra
:
attrs
:
[
bool use_mkldnn=false
]
-
op
:
shadow_output
inputs
:
{
x
:
x
}
outputs
:
{
out
:
out
}
-
op
:
shape
inputs
:
input
:
Input
...
...
paddle/phi/api/yaml/ops.yaml
浏览文件 @
2265d63c
...
...
@@ -2256,14 +2256,14 @@
optional
:
master_param, master_param_out
inplace
:
(param -> param_out), (master_param -> master_param_out)
-
op
:
shad
d
ow_output
-
op
:
shadow_output
args
:
(Tensor x, str name)
output
:
Tensor(out)
infer_meta
:
func
:
UnchangedInferMeta
param
:
[
x
]
kernel
:
func
:
shad
d
ow_output
func
:
shadow_output
param
:
[
x
]
-
op
:
shape
...
...
paddle/phi/kernels/cpu/feed_with_place_kernel.cc
浏览文件 @
2265d63c
...
...
@@ -27,18 +27,19 @@ void FeedWithPlaceKernel(const Context& ctx,
DenseTensor
*
out
)
{}
template
<
typename
T
,
typename
Context
>
void
Shad
d
owOutputKernel
(
const
Context
&
ctx
,
void
ShadowOutputKernel
(
const
Context
&
ctx
,
const
DenseTensor
&
x
,
DenseTensor
*
out
)
{}
}
// namespace phi
PD_REGISTER_KERNEL
(
feed_with_place
,
CPU
,
ALL_LAYOUT
,
phi
::
FeedWithPlaceKernel
,
float
)
{}
PD_REGISTER_KERNEL
(
shad
d
ow_feed
,
PD_REGISTER_KERNEL
(
shadow_feed
,
CPU
,
ALL_LAYOUT
,
phi
::
Shad
d
owFeedKernel
,
phi
::
ShadowFeedKernel
,
bool
,
float
,
int32_t
,
...
...
@@ -50,4 +51,4 @@ PD_REGISTER_KERNEL(shaddow_feed,
phi
::
complex128
)
{}
PD_REGISTER_KERNEL
(
shad
dow_output
,
CPU
,
ALL_LAYOUT
,
phi
::
Shad
dowOutputKernel
,
float
)
{}
shad
ow_output
,
CPU
,
ALL_LAYOUT
,
phi
::
Sha
dowOutputKernel
,
float
)
{}
paddle/phi/kernels/feed_with_place_kernel.h
浏览文件 @
2265d63c
...
...
@@ -26,12 +26,12 @@ void FeedWithPlaceKernel(const Context& ctx,
DenseTensor
*
out
);
template
<
typename
T
,
typename
Context
>
void
Shad
d
owOutputKernel
(
const
Context
&
ctx
,
void
ShadowOutputKernel
(
const
Context
&
ctx
,
const
DenseTensor
&
x
,
DenseTensor
*
out
);
template
<
typename
T
,
typename
Context
>
void
Shad
d
owFeedKernel
(
const
Context
&
ctx
,
void
ShadowFeedKernel
(
const
Context
&
ctx
,
const
DenseTensor
&
x
,
DenseTensor
*
out
);
...
...
paddle/phi/kernels/gpu/feed_with_place_kernel.cu
浏览文件 @
2265d63c
...
...
@@ -18,10 +18,10 @@
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/kernels/impl/feed_with_place_impl.h"
PD_REGISTER_KERNEL
(
shad
d
ow_feed
,
PD_REGISTER_KERNEL
(
shadow_feed
,
GPU
,
ALL_LAYOUT
,
phi
::
Shad
d
owFeedKernel
,
phi
::
ShadowFeedKernel
,
bool
,
float
,
int32_t
,
...
...
paddle/phi/kernels/impl/feed_with_place_impl.h
浏览文件 @
2265d63c
...
...
@@ -20,7 +20,7 @@
namespace
phi
{
template
<
typename
T
,
typename
Context
>
void
Shad
d
owFeedKernel
(
const
Context
&
ctx
,
void
ShadowFeedKernel
(
const
Context
&
ctx
,
const
DenseTensor
&
x
,
DenseTensor
*
out
)
{
ctx
.
template
Alloc
<
T
>(
out
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录