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

Is the combination of var-len, paged KV and split KV supported? #1217

Open
masahi opened this issue Sep 10, 2024 · 0 comments
Open

Is the combination of var-len, paged KV and split KV supported? #1217

masahi opened this issue Sep 10, 2024 · 0 comments

Comments

@masahi
Copy link

masahi commented Sep 10, 2024

Support for var-len + paged KV was added in #831 and I confirmed that it works when num_splits = 1. But if I force the kernel to use num_splits > 1, I get incorrect results.

Looking at the code, I suspect var-len + paged KV + split KV is not currently supported. First, the storage representation of partial reductions is very wasteful for the var-len case:
https://github.com/Dao-AILab/flash-attention/blob/main/csrc/flash_attn/flash_api.cpp#L316

Second, the way the output pointer is indexed in combine_attn_seqk_parallel seems to assume the fixed query-length format (batch_size x seqlen_q x num_heads x head_size). Shouldn't we use binfo.q_offset there?
https://github.com/Dao-AILab/flash-attention/blob/main/csrc/flash_attn/src/flash_fwd_kernel.h#L1273-L1274

@tridao @sgrigory

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

No branches or pull requests

1 participant