Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
22511f30
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
22511f30
编写于
2月 14, 2022
作者:
W
Wangzheee
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support preln_ernie
上级
3b0eaee9
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
10 addition
and
6 deletion
+10
-6
paddle/fluid/framework/ir/pass.h
paddle/fluid/framework/ir/pass.h
+2
-0
paddle/fluid/framework/ir/preln_embedding_eltwise_layernorm_fuse_pass.cc
...amework/ir/preln_embedding_eltwise_layernorm_fuse_pass.cc
+1
-1
paddle/fluid/framework/ir/preln_skip_layernorm_fuse_pass.cc
paddle/fluid/framework/ir/preln_skip_layernorm_fuse_pass.cc
+3
-3
paddle/fluid/inference/analysis/ir_passes/tensorrt_subgraph_pass.cc
...id/inference/analysis/ir_passes/tensorrt_subgraph_pass.cc
+4
-2
未找到文件。
paddle/fluid/framework/ir/pass.h
浏览文件 @
22511f30
...
...
@@ -47,6 +47,8 @@ constexpr char kPassRecorder[] = "pass_recorder";
constexpr
char
kEmbEltwiseLayernormPass
[]
=
"embedding_eltwise_layernorm_fuse_pass_flag"
;
constexpr
char
kMultiheadMatmulPass
[]
=
"multihead_matmul_fuse_pass_flag"
;
constexpr
char
kPrelnEmbEltwiseLayernormPass
[]
=
"preln_embedding_eltwise_layernorm_fuse_pass_flag"
;
class
Pass
{
public:
...
...
paddle/fluid/framework/ir/preln_embedding_eltwise_layernorm_fuse_pass.cc
浏览文件 @
22511f30
...
...
@@ -364,7 +364,7 @@ int PrelnEmbeddingEltwiseLayerNormFusePass::BuildFusion(
IR_NODE_LINK_TO
(
end_pattern_biases
[
k
],
preln_embedding_eltwise_layernorm
);
IR_NODE_LINK_TO
(
end_pattern_scales
[
k
],
preln_embedding_eltwise_layernorm
);
IR_NODE_LINK_TO
(
preln_embedding_eltwise_layernorm
,
end_pattern_out
[
k
]);
IR_NODE_LINK_TO
(
embedding_eltwise_layernorm
,
inner_pattern_out
[
k
]);
IR_NODE_LINK_TO
(
preln_
embedding_eltwise_layernorm
,
inner_pattern_out
[
k
]);
// Remove unneeded nodes.
std
::
unordered_set
<
const
Node
*>
marked_nodes
;
...
...
paddle/fluid/framework/ir/preln_skip_layernorm_fuse_pass.cc
浏览文件 @
22511f30
...
...
@@ -53,7 +53,7 @@ struct PrelnSkipLayerNorm : public PatternBase {
PATTERN_DECL_NODE
(
layer_norm_variance
);
};
void
*
PrelnSkipLayerNorm
::
operator
()(
PDNode
*
x
,
PDNode
*
y
)
{
void
PrelnSkipLayerNorm
::
operator
()(
PDNode
*
x
,
PDNode
*
y
)
{
// Create nodes for elementwise add op.
x
->
assert_is_op_input
(
"elementwise_add"
,
"X"
);
y
->
assert_is_op_input
(
"elementwise_add"
,
"Y"
);
...
...
@@ -61,7 +61,7 @@ void *PrelnSkipLayerNorm::operator()(PDNode *x, PDNode *y) {
pattern
->
NewNode
(
elementwise_repr
())
->
assert_is_op
(
"elementwise_add"
);
auto
*
elementwise_out_var
=
pattern
->
NewNode
(
elementwise_out_repr
())
->
assert_is_op_output
(
"elementwise_add"
)
->
assert_is_op_input
(
"layer_norm"
,
"X"
)
;
->
assert_is_op_input
(
"layer_norm"
,
"X"
)
->
assert_is_op_input
(
"elementwise_add"
,
"Y"
);
// Add links for elementwise_add op.
...
...
paddle/fluid/inference/analysis/ir_passes/tensorrt_subgraph_pass.cc
浏览文件 @
22511f30
...
...
@@ -377,8 +377,10 @@ void TensorRtSubgraphPass::CreateTensorRTOp(
trt_engine
->
SetDLACore
(
Get
<
int
>
(
"trt_dla_core"
));
trt_engine
->
SetWithErnie
(
graph
->
Has
(
framework
::
ir
::
kEmbEltwiseLayernormPass
)
&&
graph
->
Has
(
framework
::
ir
::
kMultiheadMatmulPass
));
(
graph
->
Has
(
framework
::
ir
::
kEmbEltwiseLayernormPass
)
&&
graph
->
Has
(
framework
::
ir
::
kMultiheadMatmulPass
))
||
(
graph
->
Has
(
framework
::
ir
::
kPrelnEmbEltwiseLayernormPass
)
&&
graph
->
Has
(
framework
::
ir
::
kMultiheadMatmulPass
)));
if
(
use_static_engine
)
{
trt_engine_serialized_data
=
GetTrtEngineSerializedData
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录