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

Fuse split rotary for Group Query Attention #940

Merged
merged 2 commits into from
Sep 19, 2023

Conversation

jinhongyii
Copy link
Member

No description provided.

@junrushao
Copy link
Member

CC @masahi as the original author of this optimization :)

@@ -70,10 +70,84 @@ def split_rotary(

return split_rotary

def get_split_rotary_group_query_attention(num_query_heads, num_kv_heads, head_dim, position_embedding_base):
Copy link
Member

Choose a reason for hiding this comment

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

I’m wondering if we can merge the two get_split_rotary into one.

Copy link
Member Author

@jinhongyii jinhongyii Sep 19, 2023

Choose a reason for hiding this comment

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

We fuse split rotary of GQA into 2 kernels because of num_heads are different, while split rotary of non-GQA is fused into 1 kernel. So let's keep them as different function

@masahi
Copy link
Contributor

masahi commented Sep 19, 2023

nice, does a big model that use MQA / GQA benefit from this pass? The speed up for 13B was much smaller than 7B when I tested.

@jinhongyii
Copy link
Member Author

llama2 70b uses GQA. Indeed the speed up is small. Only 2% I observed

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.

4 participants