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

Extend paged attention to support query_len>1 #8328

Merged
merged 15 commits into from
Oct 31, 2024

Conversation

vanbasten23
Copy link
Collaborator

@vanbasten23 vanbasten23 commented Oct 27, 2024

This PR extends the existing paged attention kernel to support query_len>1. Additionally, it upgrades the flash attention from v1 to v2.

Test plan:

  • python pytorch/xla/test/test_pallas.py -v -k PallasTest.test_paged_attention_multi_queries_wrapper
  • python pytorch/xla/test/test_tpu_paged_attention_kernel.py 2>&1 | tee out.txt

cc: @miladm

@vanbasten23 vanbasten23 marked this pull request as ready for review October 28, 2024 17:34
page_indices, # [batch_size, pages_per_sequence]
num_kv_pages_per_compute_block,
num_queries_per_compute_block,
use_kernel=True,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

hey @WoosukKwon, this is the integration point between vLLM and torch_xla. I'm thinking if vLLM can switch this flag use_kernel perhaps by using some flags. I want to use the nonkernel version as a per baseline. Do you know if it possible?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For dynamo, it's similar. The integration point is at def multi_queries_paged_attention_xla( in the same file.

@vanbasten23 vanbasten23 merged commit 1bac062 into master Oct 31, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants