Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【Inference PIR】add fused_rotary_position_embedding_pass #65265

Merged
merged 4 commits into from
Jun 20, 2024

Conversation

lizexu123
Copy link
Contributor

@lizexu123 lizexu123 commented Jun 18, 2024

PR Category

Inference

PR Types

New features

Description

Pcard-71500
增加fused_rotary_position_embedding_pass

A30测试结果:
Llama-7b batch-size:1 no fused_rotary_position_embedding_pass:32857.339ms
Llama-7b batch-size:1 have fused_rotary_position_embedding_pass:31191.201ms
Llama-7b batch-size:4 no fused_rotary_position_embedding_pass:52057.086ms
Llama-7b batch-size:4 have fused_rotary_position_embedding_pass:50541.888ms
在pir 下,llama-7b 模型在 batch_size=1 与batch_size=4 的平均时延方面分别有 5.071% 与 2.911% 的性能提升,其余模型无明显影响;显存方面基本持平

Copy link

paddle-bot bot commented Jun 18, 2024

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@@ -623,6 +623,7 @@ const std::vector<std::string> kPirGpuPasses{
"transpose_flatten_concat_fuse_pass",
"remove_redundant_transpose_pass",
"transfer_layout_pass",
"fused_rotary_position_embedding_pass",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个pass放在embedding_eltwise_layernorm_fuse_pass前一个

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的


auto axis = match_ctx.Attr<std::vector<int64_t>>("full_13_value");
auto axis_2 = match_ctx.Attr<std::vector<int64_t>>("full_12_value");
return check_axes(axis) && check_axes(axis_2);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个地方return了,后面的check就不会执行了吧

Comment on lines 237 to 240
return check_unsqueeze_axes(unsqueeze_axis) &&
check_unsqueeze_axes(unsqueeze_axis_1) &&
check_unsqueeze_axes(unsqueeze_axis_2) &&
check_unsqueeze_axes(unsqueeze_axis_3);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同理

@yuanlehome yuanlehome merged commit 7688fa8 into PaddlePaddle:develop Jun 20, 2024
32 of 33 checks passed
co63oc pushed a commit to co63oc/Paddle that referenced this pull request Jun 25, 2024
…#65265)

* fused

* 前面retrun true后面就不检查了

* 修改return true的后面无法检查

* 删除多余的注释
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants